Advertisement
Sarada-L2

PvPS To Hero Frozen

Jun 21st, 2021
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. diff --git a/config/functions/l2jfrozen.properties b/config/functions/l2jfrozen.properties
  2. index b1eaa98..63bc559 100644
  3. --- a/config/functions/l2jfrozen.properties
  4. +++ b/config/functions/l2jfrozen.properties
  5. @@ -281,4 +281,12 @@
  6. ProtectorSkillLevel = 13
  7. ProtectorSkillTime = 600
  8. # Npc Protector Message
  9. ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  10. +
  11. +#Habilitar o systema.
  12. +Enablehero = False
  13. +#Dias que o player vai ficar hero.
  14. +HeroDays = 0
  15. +# Quantidade que ao atingir vira hero
  16. +PvPsParaHero = 2
  17. +
  18. diff --git a/head-src/com/l2jfrozen/Config.java b/head-src/com/l2jfrozen/Config.java
  19. index 6f07f7a..2f65e7c 100644
  20. --- a/head-src/com/l2jfrozen/Config.java
  21. +++ b/head-src/com/l2jfrozen/Config.java
  22. @@ -119,7 +119,9 @@
  23. public static int TRADE_PVP_AMOUNT;
  24. public static boolean GLOBAL_CHAT_WITH_PVP;
  25. public static int GLOBAL_PVP_AMOUNT;
  26. -
  27. + public static int PVP_TO_HERO;
  28. + public static int DIASHERO;
  29. + public static boolean ENABLE_HERO_PVPS;
  30. // Anti Brute force attack on login
  31. public static int BRUT_AVG_TIME;
  32. public static int BRUT_LOGON_ATTEMPTS;
  33. @@ -2389,7 +2391,9 @@
  34. final InputStream is = new FileInputStream(new File(L2JFROZEN));
  35. L2JFrozenSettings.load(is);
  36. is.close();
  37. -
  38. + PVP_TO_HERO = Integer.parseInt(L2JFrozenSettings.getProperty("PvPsParaHero", "10"));
  39. + DIASHERO = Integer.parseInt(L2JFrozenSettings.getProperty("Herodays", "1"));
  40. + ENABLE_HERO_PVPS = Boolean.valueOf(L2JFrozenSettings.getProperty("Enablehero", "True"));
  41. /** Custom Tables **/
  42. CUSTOM_SPAWNLIST_TABLE = Boolean.valueOf(L2JFrozenSettings.getProperty("CustomSpawnlistTable", "True"));
  43. SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(L2JFrozenSettings.getProperty("SaveGmSpawnOnCustom", "True"));
  44. index 108bb8b..0bff1b4 100644
  45. --- a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  46. +++ b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  47. @@ -1450,7 +1450,7 @@
  48. * @see java.lang.Runnable#run()
  49. */
  50. @Override
  51. public void run()
  52. {
  53. try
  54. @@ -8112,7 +8112,16 @@
  55.  
  56. // Add karma to attacker and increase its PK counter
  57. setPvpKills(getPvpKills() + 1);
  58.  
  59. + if (Config.ENABLE_HERO_PVPS && getPvpKills() > Config.PVP_TO_HERO && !isHero())
  60. + {
  61. + setHero(true);
  62. + setHeroEndTime(Config.DIASHERO * 24L * 60L * 60L * 1000L);
  63. + Announcements.getInstance().announceToAll("Hero System " +getName()+ " virou Hero com " +Config.PVP_TO_HERO+ " pvps!");
  64. + SkillList iu = new SkillList();
  65. + StatusUpdate uii = new StatusUpdate(getObjectId());
  66. + sendPacket(uii);
  67. + sendPacket(iu);
  68. + }
  69. // Increase the kill count for a special hero aura
  70. heroConsecutiveKillCount++;
  71.  
  72. @@ -13246,7 +13255,7 @@
  73. * (non-Javadoc)
  74. * @see java.lang.Runnable#run()
  75. */
  76. @Override
  77. public void run()
  78. {
  79. @@ -18928,7 +18937,7 @@
  80. }
  81.  
  82. // open/close gates
  83. private final GatesRequest _gatesRequest = new GatesRequest();
  84.  
  85. private static class GatesRequest
  86. @@ -19503,7 +19512,38 @@
  87. {
  88. _lastAttackPacket = System.currentTimeMillis();
  89. }
  90.  
  91. + public void setHeroEndTime(long heroTime)
  92. + {
  93. + Connection con = null;
  94. + try
  95. + {
  96. + con = L2DatabaseFactory.getInstance().getConnection(false);
  97. + PreparedStatement stmt = con.prepareStatement("REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)");
  98. +
  99. + stmt.setInt(1, getObjectId());
  100. + stmt.setString(2, getName());
  101. + stmt.setInt(3, 1);
  102. + stmt.setInt(4, isNoble() ? 1 : 0);
  103. + stmt.setInt(5, isDonator() ? 1 : 0);
  104. + stmt.setLong(6, heroTime == 0 ? 0 : System.currentTimeMillis() + heroTime);
  105. + stmt.execute();
  106. + stmt.close();
  107. + stmt = null;
  108. + }
  109. + catch(Exception e)
  110. + {
  111. + if (Config.ENABLE_ALL_EXCEPTIONS)
  112. + e.printStackTrace();
  113. +
  114. + LOGGER.info("Error: could not update database: ", e);
  115. +
  116. + }
  117. + finally
  118. + {
  119. + CloseUtil.close(con);
  120. + con = null;
  121. + }
  122. + }
  123. public void checkItemRestriction()
  124. {
  125. for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement