Advertisement
ChristianSDM

Pvps To Hero FROZEN 1132

Apr 11th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  2. ===================================================================
  3. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision)
  4. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  5. @@ -14035,6 +14035,38 @@
  6. sendSkillList();
  7. }
  8. + public void setHeroEndTime(long heroTime)
  9. + {
  10. + Connection con = null;
  11. + try
  12. + {
  13. + con = L2DatabaseFactory.getInstance().getConnection(false);
  14. + PreparedStatement stmt = con.prepareStatement("REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)");
  15. +
  16. + stmt.setInt(1, getObjectId());
  17. + stmt.setString(2, getName());
  18. + stmt.setInt(3, 1);
  19. + stmt.setInt(4, isNoble() ? 1 : 0);
  20. + stmt.setInt(5, isDonator() ? 1 : 0);
  21. + stmt.setLong(6, heroTime == 0 ? 0 : System.currentTimeMillis() + heroTime);
  22. + stmt.execute();
  23. + stmt.close();
  24. + stmt = null;
  25. + }
  26. + catch(Exception e)
  27. + {
  28. + if (Config.ENABLE_ALL_EXCEPTIONS)
  29. + e.printStackTrace();
  30. +
  31. + LOGGER.info("Error: could not update database: ", e);
  32. +
  33. + }
  34. + finally
  35. + {
  36. + CloseUtil.close(con);
  37. + con = null;
  38. + }
  39. + }
  40. +
  41.  
  42. /**
  43. * Sets the donator.
  44.  
  45.  
  46.  
  47.  
  48. @@ 18935,6 @@
  49. // Add karma to attacker and increase its PK counter
  50. setPvpKills(getPvpKills() + 1);
  51.  
  52. +if (Config.ENABLE_HERO_PVPS && getPvpKills() > Config.PVP_TO_HERO && !isHero())
  53. + {
  54. + setHero(true);
  55. + setHeroEndTime(Config.DIASHERO * 24L * 60L * 60L * 1000L);
  56. + Announcements.getInstance().announceToPlayers("Hero System " +getName()+ " virou Hero com " +Config.PVP_TO_HERO+ " pvps!");
  57. + SkillList iu = new SkillList();
  58. + StatusUpdate uii = new StatusUpdate(getObjectId());
  59. + sendPacket(uii);
  60. + sendPacket(iu);
  61. + }
  62.  
  63. // Increase the kill count for a special hero aura
  64. heroConsecutiveKillCount++;
  65.  
  66.  
  67. Index: head-src/com/l2jfrozen/Config.java
  68. ===================================================================
  69. --- F:/Workspace/BETA_GS/head-src/com/l2jfrozen/Config.java (revision 936)
  70. +++ F:/Workspace/BETA_GS/head-src/com/l2jfrozen/Config.java (working copy)
  71. @@ -2379,6 +2379,9 @@
  72. public static String PVP1_CUSTOM_MESSAGE;
  73. public static String PVP2_CUSTOM_MESSAGE;
  74.  
  75. + public static int PVP_TO_HERO;
  76. + public static int DIASHERO;
  77. + public static boolean ENABLE_HERO_PVPS;
  78. +
  79. //============================================================
  80. public static void loadL2JFrozenConfig()
  81. {
  82. @@ -2391,6 +2394,9 @@
  83. L2JFrozenSettings.load(is);
  84. is.close();
  85.  
  86. + PVP_TO_HERO = Integer.parseInt(L2JFrozenSettings.getProperty("PvPsParaHero", "10"));
  87. + DIASHERO = Integer.parseInt(L2JFrozenSettings.getProperty("Herodays", "1"));
  88. + ENABLE_HERO_PVPS = Boolean.valueOf(L2JFrozenSettings.getProperty("Enablehero", "True"));
  89. /** Custom Tables **/
  90. CUSTOM_SPAWNLIST_TABLE = Boolean.valueOf(L2JFrozenSettings.getProperty("CustomSpawnlistTable", "True"));
  91. SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(L2JFrozenSettings.getProperty("SaveGmSpawnOnCustom", "True"));
  92.  
  93.  
  94. Index: config/functions/l2jfrozen.properties
  95. ===================================================================
  96. --- config/functions/l2jfrozen.properties (revision 936)
  97. +++ config/functions/l2jfrozen.properties (working copy)
  98. +#Habilitar o systema.
  99. +Enablehero = False
  100. +#Dias que o player vai ficar hero.
  101. +HeroDays = 0
  102. +# Quantidade que ao atingir vira hero
  103. +PvPsParaHero = 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement