Reset task for homunculus points.

Contributed by CostyKiller.
This commit is contained in:
MobiusDevelopment
2021-06-06 22:11:07 +00:00
parent c597a45fca
commit e476c3c6b1
2 changed files with 56 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
resetWorldChatPoints(); resetWorldChatPoints();
resetTrainingCamp(); resetTrainingCamp();
resetThroneOfHeroes(); resetThroneOfHeroes();
resetHomunculusResetPoints();
} }
@ScheduleTarget @ScheduleTarget
@@ -290,6 +291,33 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
LOGGER.info("Throne of Heroes Entry has been resetted."); LOGGER.info("Throne of Heroes Entry has been resetted.");
} }
public void resetHomunculusResetPoints()
{
// Update data for offline players.
try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var IN (" + PlayerVariables.HOMUNCULUS_USED_RESET_VP + ", " + PlayerVariables.HOMUNCULUS_USED_RESET_KILLS + ")"))
{
ps.setInt(1, 0);
ps.execute();
}
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset Homunculus Reset Points: " + e);
}
// Update data for online players.
for (PlayerInstance player : World.getInstance().getPlayers())
{
player.getVariables().set("HOMUNCULUS_USED_RESET_KILLS", 0);
player.getVariables().set("HOMUNCULUS_USED_RESET_VP", 0);
player.getVariables().storeMe();
}
LOGGER.info("Homunculus Reset Points has been resetted.");
}
public static DailyTaskManager getInstance() public static DailyTaskManager getInstance()
{ {
return SingletonHolder.INSTANCE; return SingletonHolder.INSTANCE;

View File

@@ -70,6 +70,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
resetWorldChatPoints(); resetWorldChatPoints();
resetTrainingCamp(); resetTrainingCamp();
resetThroneOfHeroes(); resetThroneOfHeroes();
resetHomunculusResetPoints();
} }
@ScheduleTarget @ScheduleTarget
@@ -290,6 +291,33 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
LOGGER.info("Throne of Heroes Entry has been resetted."); LOGGER.info("Throne of Heroes Entry has been resetted.");
} }
public void resetHomunculusResetPoints()
{
// Update data for offline players.
try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var IN (" + PlayerVariables.HOMUNCULUS_USED_RESET_VP + ", " + PlayerVariables.HOMUNCULUS_USED_RESET_KILLS + ")"))
{
ps.setInt(1, 0);
ps.execute();
}
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset Homunculus Reset Points: " + e);
}
// Update data for online players.
for (PlayerInstance player : World.getInstance().getPlayers())
{
player.getVariables().set("HOMUNCULUS_USED_RESET_KILLS", 0);
player.getVariables().set("HOMUNCULUS_USED_RESET_VP", 0);
player.getVariables().storeMe();
}
LOGGER.info("Homunculus Reset Points has been resetted.");
}
public static DailyTaskManager getInstance() public static DailyTaskManager getInstance()
{ {
return SingletonHolder.INSTANCE; return SingletonHolder.INSTANCE;