Rename and clean up MapleExpeditionBossLog

This commit is contained in:
P0nk
2021-09-09 21:59:43 +02:00
parent 1e00505671
commit 5a6ed83545
5 changed files with 44 additions and 44 deletions

View File

@@ -59,7 +59,7 @@ import server.CashShop.CashItemFactory;
import server.MapleSkillbookInformationProvider; import server.MapleSkillbookInformationProvider;
import server.ThreadManager; import server.ThreadManager;
import server.TimerManager; import server.TimerManager;
import server.expeditions.MapleExpeditionBossLog; import server.expeditions.ExpeditionBossLog;
import server.life.MaplePlayerNPCFactory; import server.life.MaplePlayerNPCFactory;
import server.quest.MapleQuest; import server.quest.MapleQuest;
import tools.DatabaseConnection; import tools.DatabaseConnection;
@@ -951,7 +951,7 @@ public class Server {
tMan.register(new RespawnTask(), YamlConfig.config.server.RESPAWN_INTERVAL, YamlConfig.config.server.RESPAWN_INTERVAL); tMan.register(new RespawnTask(), YamlConfig.config.server.RESPAWN_INTERVAL, YamlConfig.config.server.RESPAWN_INTERVAL);
timeLeft = getTimeLeftForNextDay(); timeLeft = getTimeLeftForNextDay();
MapleExpeditionBossLog.resetBossLogTable(); ExpeditionBossLog.resetBossLogTable();
tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft); tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft);
} }

View File

@@ -19,7 +19,7 @@
*/ */
package net.server.task; package net.server.task;
import server.expeditions.MapleExpeditionBossLog; import server.expeditions.ExpeditionBossLog;
/** /**
* @author Ronan * @author Ronan
@@ -28,6 +28,6 @@ public class BossLogTask implements Runnable {
@Override @Override
public void run() { public void run() {
MapleExpeditionBossLog.resetBossLogTable(); ExpeditionBossLog.resetBossLogTable();
} }
} }

View File

@@ -39,7 +39,7 @@ import scripting.npc.NPCScriptManager;
import server.MapleItemInformationProvider; import server.MapleItemInformationProvider;
import server.MapleMarriage; import server.MapleMarriage;
import server.expeditions.Expedition; import server.expeditions.Expedition;
import server.expeditions.MapleExpeditionBossLog; import server.expeditions.ExpeditionBossLog;
import server.expeditions.MapleExpeditionType; import server.expeditions.MapleExpeditionType;
import server.life.*; import server.life.*;
import server.maps.MapleMap; import server.maps.MapleMap;
@@ -1076,7 +1076,7 @@ public class AbstractPlayerInteraction {
Expedition exped = new Expedition(player, type, silent, minPlayers, maxPlayers); Expedition exped = new Expedition(player, type, silent, minPlayers, maxPlayers);
int channel = player.getMap().getChannelServer().getId(); int channel = player.getMap().getChannelServer().getId();
if (!MapleExpeditionBossLog.attemptBoss(player.getId(), channel, exped, false)) { // thanks Conrad for noticing missing expeditions entry limit if (!ExpeditionBossLog.attemptBoss(player.getId(), channel, exped, false)) { // thanks Conrad for noticing missing expeditions entry limit
return 1; return 1;
} }

View File

@@ -178,7 +178,7 @@ public class Expedition {
} }
int channel = this.getRecruitingMap().getChannelServer().getId(); int channel = this.getRecruitingMap().getChannelServer().getId();
if (!MapleExpeditionBossLog.attemptBoss(player.getId(), channel, this, false)) { // thanks Conrad, Cato for noticing some expeditions have entry limit if (!ExpeditionBossLog.attemptBoss(player.getId(), channel, this, false)) { // thanks Conrad, Cato for noticing some expeditions have entry limit
return "Sorry, you've already reached the quota of attempts for this expedition! Try again another day..."; return "Sorry, you've already reached the quota of attempts for this expedition! Try again another day...";
} }
@@ -213,7 +213,7 @@ public class Expedition {
int channel = this.getRecruitingMap().getChannelServer().getId(); int channel = this.getRecruitingMap().getChannelServer().getId();
for (Character chr : getActiveMembers()) { for (Character chr : getActiveMembers()) {
MapleExpeditionBossLog.attemptBoss(chr.getId(), channel, this, true); ExpeditionBossLog.attemptBoss(chr.getId(), channel, this, true);
} }
} }

View File

@@ -29,11 +29,10 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
*
* @author Conrad * @author Conrad
* @author Ronan * @author Ronan
*/ */
public class MapleExpeditionBossLog { public class ExpeditionBossLog {
public enum BossLogEntry { public enum BossLogEntry {
ZAKUM(2, 1, false), ZAKUM(2, 1, false),
@@ -42,16 +41,17 @@ public class MapleExpeditionBossLog {
SCARGA(1, 1, false), SCARGA(1, 1, false),
PAPULATUS(2, 1, false); PAPULATUS(2, 1, false);
private int entries; private final int entries;
private int timeLength; private final int timeLength;
private int minChannel, maxChannel; private final int minChannel;
private boolean week; private final int maxChannel;
private final boolean week;
private BossLogEntry(int entries, int timeLength, boolean week) { BossLogEntry(int entries, int timeLength, boolean week) {
this(entries, 0, Integer.MAX_VALUE, timeLength, week); this(entries, 0, Integer.MAX_VALUE, timeLength, week);
} }
private BossLogEntry(int entries, int minChannel, int maxChannel, int timeLength, boolean week) { BossLogEntry(int entries, int minChannel, int maxChannel, int timeLength, boolean week) {
this.entries = entries; this.entries = entries;
this.minChannel = minChannel; this.minChannel = minChannel;
this.maxChannel = maxChannel; this.maxChannel = maxChannel;
@@ -106,14 +106,14 @@ public class MapleExpeditionBossLog {
deltaTime -= halfDayLength; deltaTime -= halfDayLength;
if (deltaTime < halfDayLength) { if (deltaTime < halfDayLength) {
MapleExpeditionBossLog.resetBossLogTable(true, thursday); ExpeditionBossLog.resetBossLogTable(true, thursday);
} }
now.set(Calendar.HOUR, 0); now.set(Calendar.HOUR, 0);
now.set(Calendar.MINUTE, 0); now.set(Calendar.MINUTE, 0);
now.set(Calendar.SECOND, 0); now.set(Calendar.SECOND, 0);
MapleExpeditionBossLog.resetBossLogTable(false, now); ExpeditionBossLog.resetBossLogTable(false, now);
} }
private static void resetBossLogTable(boolean week, Calendar c) { private static void resetBossLogTable(boolean week, Calendar c) {