Advertisement
CostyKiller

Homunculus daily reset

Jun 6th, 2021
1,108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.57 KB | None | 0 0
  1. Index: java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
  2. ===================================================================
  3. --- java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java (revision 8826)
  4. +++ java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java (working copy)
  5. @@ -70,6 +70,7 @@
  6.         resetWorldChatPoints();
  7.         resetTrainingCamp();
  8.         resetThroneOfHeroes();
  9. +       resetHomunculusResetPoints();
  10.     }
  11.    
  12.     @ScheduleTarget
  13. @@ -290,6 +291,33 @@
  14.         LOGGER.info("Throne of Heroes Entry has been resetted.");
  15.     }
  16.    
  17. +   public void resetHomunculusResetPoints()
  18. +   {
  19. +       // Update data for offline players.
  20. +       try (Connection con = DatabaseFactory.getConnection())
  21. +       {
  22. +           try (PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var IN (" + PlayerVariables.HOMUNCULUS_USED_RESET_VP + ", " + PlayerVariables.HOMUNCULUS_USED_RESET_KILLS + ")"))
  23. +           {
  24. +               ps.setInt(1, 0);
  25. +               ps.execute();
  26. +           }
  27. +       }
  28. +       catch (Exception e)
  29. +       {
  30. +           LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset Homunculus Reset Points: " + e);
  31. +       }
  32. +      
  33. +       // Update data for online players.
  34. +       for (PlayerInstance player : World.getInstance().getPlayers())
  35. +       {
  36. +           player.getVariables().set("HOMUNCULUS_USED_RESET_KILLS", 0);
  37. +           player.getVariables().set("HOMUNCULUS_USED_RESET_VP", 0);
  38. +           player.getVariables().storeMe();
  39. +       }
  40. +      
  41. +       LOGGER.info("Homunculus Reset Points has been resetted.");
  42. +   }
  43. +  
  44.     public static DailyTaskManager getInstance()
  45.     {
  46.         return SingletonHolder.INSTANCE;
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement