Updated Throne of Heroes to weekly reset.

Contributed by CostyKiller.
This commit is contained in:
MobiusDevelopment
2022-12-17 06:28:52 +00:00
parent 377a183b3b
commit 394af41547
10 changed files with 48 additions and 24 deletions

View File

@@ -67,7 +67,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03a.html"; htmltext = "Roiental-03a.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_GOLDBERG_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }
@@ -94,7 +94,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03b.html"; htmltext = "Roiental-03b.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_MARYREED_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }
@@ -121,7 +121,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03c.html"; htmltext = "Roiental-03c.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_TAUTI_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }

View File

@@ -228,7 +228,7 @@ public class ThroneOfHeroesGoldberg extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_GOLDBERG_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -244,7 +244,7 @@ public class ThroneOfHeroesMaryReed extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_MARYREED_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -212,7 +212,7 @@ public class ThroneOfHeroesTauti extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_TAUTI_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -71,6 +71,13 @@ public class DailyTaskManager
RESET_ITEMS.add(47387); // Balthus Knights Supply Items RESET_ITEMS.add(47387); // Balthus Knights Supply Items
RESET_ITEMS.add(60011); // Festival Fairy's Good Luck Bag RESET_ITEMS.add(60011); // Festival Fairy's Good Luck Bag
} }
public static final Set<String> RESET_CLAN_INSTANCES = new HashSet<>();
static
{
RESET_CLAN_INSTANCES.add("TOH_GOLDBERG_DONE"); // Goldberg Instance
RESET_CLAN_INSTANCES.add("TOH_MARYREED_DONE"); // MaryReed Instance
RESET_CLAN_INSTANCES.add("TOH_TAUTI_DONE"); // Tauti Instance
}
protected DailyTaskManager() protected DailyTaskManager()
{ {
@@ -118,6 +125,7 @@ public class DailyTaskManager
resetDailyMissionRewards(); resetDailyMissionRewards();
resetTimedHuntingZonesWeekly(); resetTimedHuntingZonesWeekly();
resetVitalityWeekly(); resetVitalityWeekly();
resetThroneOfHeroesWeekly();
} }
else // All days, except Wednesday. else // All days, except Wednesday.
{ {
@@ -133,7 +141,6 @@ public class DailyTaskManager
resetHomunculusResetPoints(); resetHomunculusResetPoints();
resetRecommends(); resetRecommends();
resetTimedHuntingZones(); resetTimedHuntingZones();
resetThroneOfHeroes();
resetTrainingCamp(); resetTrainingCamp();
resetWorldChatPoints(); resetWorldChatPoints();
} }
@@ -478,15 +485,18 @@ public class DailyTaskManager
LOGGER.info("Clan contributions has been resetted."); LOGGER.info("Clan contributions has been resetted.");
} }
private void resetThroneOfHeroes() private void resetThroneOfHeroesWeekly()
{ {
// Update data for offline players. // Update data for offline players.
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection())
{ {
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_variables WHERE var=?")) for (String clanInstances : RESET_CLAN_INSTANCES)
{ {
ps.setString(1, "TOH_DONE"); try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_variables WHERE var=?"))
ps.execute(); {
ps.setString(1, clanInstances);
ps.execute();
}
} }
} }
catch (Exception e) catch (Exception e)
@@ -506,7 +516,9 @@ public class DailyTaskManager
} }
for (Clan clan : clans) for (Clan clan : clans)
{ {
clan.getVariables().remove("TOH_DONE"); clan.getVariables().remove("TOH_GOLDBERG_DONE");
clan.getVariables().remove("TOH_MARYREED_DONE");
clan.getVariables().remove("TOH_TAUTI_DONE");
clan.getVariables().storeMe(); clan.getVariables().storeMe();
} }

View File

@@ -67,7 +67,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03a.html"; htmltext = "Roiental-03a.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_GOLDBERG_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }
@@ -94,7 +94,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03b.html"; htmltext = "Roiental-03b.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_MARYREED_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }
@@ -121,7 +121,7 @@ public class Roiental extends AbstractNpcAI
{ {
htmltext = "Roiental-03c.html"; htmltext = "Roiental-03c.html";
} }
else if (player.getClan().getVariables().hasVariable("TOH_DONE")) else if (player.getClan().getVariables().hasVariable("TOH_TAUTI_DONE"))
{ {
htmltext = "Roiental-AlreadyDone.html"; htmltext = "Roiental-AlreadyDone.html";
} }

View File

@@ -228,7 +228,7 @@ public class ThroneOfHeroesGoldberg extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_GOLDBERG_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -244,7 +244,7 @@ public class ThroneOfHeroesMaryReed extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_MARYREED_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -212,7 +212,7 @@ public class ThroneOfHeroesTauti extends AbstractInstance
if (!killer.isGM()) if (!killer.isGM())
{ {
// Set clan variable // Set clan variable
killer.getClan().getVariables().set("TOH_DONE", System.currentTimeMillis()); killer.getClan().getVariables().set("TOH_TAUTI_DONE", System.currentTimeMillis());
killer.getClan().getVariables().storeMe(); killer.getClan().getVariables().storeMe();
} }
} }

View File

@@ -71,6 +71,13 @@ public class DailyTaskManager
RESET_ITEMS.add(47387); // Balthus Knights Supply Items RESET_ITEMS.add(47387); // Balthus Knights Supply Items
RESET_ITEMS.add(60011); // Festival Fairy's Good Luck Bag RESET_ITEMS.add(60011); // Festival Fairy's Good Luck Bag
} }
public static final Set<String> RESET_CLAN_INSTANCES = new HashSet<>();
static
{
RESET_CLAN_INSTANCES.add("TOH_GOLDBERG_DONE"); // Goldberg Instance
RESET_CLAN_INSTANCES.add("TOH_MARYREED_DONE"); // MaryReed Instance
RESET_CLAN_INSTANCES.add("TOH_TAUTI_DONE"); // Tauti Instance
}
protected DailyTaskManager() protected DailyTaskManager()
{ {
@@ -118,6 +125,7 @@ public class DailyTaskManager
resetDailyMissionRewards(); resetDailyMissionRewards();
resetTimedHuntingZonesWeekly(); resetTimedHuntingZonesWeekly();
resetVitalityWeekly(); resetVitalityWeekly();
resetThroneOfHeroesWeekly();
} }
else // All days, except Wednesday. else // All days, except Wednesday.
{ {
@@ -133,7 +141,6 @@ public class DailyTaskManager
resetHomunculusResetPoints(); resetHomunculusResetPoints();
resetRecommends(); resetRecommends();
resetTimedHuntingZones(); resetTimedHuntingZones();
resetThroneOfHeroes();
resetTrainingCamp(); resetTrainingCamp();
resetWorldChatPoints(); resetWorldChatPoints();
} }
@@ -483,15 +490,18 @@ public class DailyTaskManager
LOGGER.info("Clan contributions has been resetted."); LOGGER.info("Clan contributions has been resetted.");
} }
private void resetThroneOfHeroes() private void resetThroneOfHeroesWeekly()
{ {
// Update data for offline players. // Update data for offline players.
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection())
{ {
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_variables WHERE var=?")) for (String clanInstances : RESET_CLAN_INSTANCES)
{ {
ps.setString(1, "TOH_DONE"); try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_variables WHERE var=?"))
ps.execute(); {
ps.setString(1, clanInstances);
ps.execute();
}
} }
} }
catch (Exception e) catch (Exception e)
@@ -511,7 +521,9 @@ public class DailyTaskManager
} }
for (Clan clan : clans) for (Clan clan : clans)
{ {
clan.getVariables().remove("TOH_DONE"); clan.getVariables().remove("TOH_GOLDBERG_DONE");
clan.getVariables().remove("TOH_MARYREED_DONE");
clan.getVariables().remove("TOH_TAUTI_DONE");
clan.getVariables().storeMe(); clan.getVariables().storeMe();
} }