Advertisement
LIONN

Hero Boss v2

May 7th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.09 KB | None | 0 0
  1. Index: config/functions/l2jfrozen.properties
  2. ===================================================================
  3. --- config/functions/l2jfrozen.properties   (revision 936)
  4. +++ config/functions/l2jfrozen.properties   (working copy)
  5. @@ -280,4 +280,9 @@
  6.  ProtectorSkillLevel = 13
  7.  ProtectorSkillTime = 600
  8.  # Npc Protector Message
  9. -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  10. \ No newline at end of file
  11. +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  12. +
  13. +# Lista dos Bosses que dao status hero ao player que der o ultimo hit.
  14. +HeroBossList = 29001,29019,29020,29022,29028
  15. +# Tempo de status hero que o player ira ganhar.
  16. +HeroBossDays = 1
  17. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java
  18. ===================================================================
  19. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java  (revision 936)
  20. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java  (working copy)
  21. @@ -25,6 +25,7 @@
  22.  import com.l2jfrozen.gameserver.model.L2Summon;
  23.  import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
  24.  import com.l2jfrozen.gameserver.network.SystemMessageId;
  25. +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
  26.  import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  27.  import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  28.  import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  29. @@ -99,6 +100,16 @@
  30.  
  31.         if(player != null)
  32.         {
  33. +           if (Config.RH_HERO_BOSS_LIST.contains(getNpcId()) && !player.isHero())
  34. +           {
  35. +               player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
  36. +               player.setIsHero(true);
  37. +               player.setHeroEndTime(Config.RH_HERO_BOSS_DAYS * 24L * 60L * 60L * 1000L);
  38. +               player.sendMessage("You Are Now a Hero! You Are Granted With Hero Status, Skills, Aura.");
  39. +               player.broadcastUserInfo();
  40. +               player.getInventory().addItem("Wings of Destiny", 6842, 1, player, null);
  41. +           }
  42. +          
  43.             SystemMessage msg = new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL);
  44.             broadcastPacket(msg);
  45.             msg = null;
  46. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  47. ===================================================================
  48. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (revision 936)
  49. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  50. @@ -14035,6 +14035,38 @@
  51.         sendSkillList();
  52.     }
  53.  
  54. +   public void setHeroEndTime(long heroTime)
  55. +   {
  56. +       Connection con = null;
  57. +       try
  58. +       {
  59. +           con = L2DatabaseFactory.getInstance().getConnection(false);
  60. +           PreparedStatement stmt = con.prepareStatement("REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)");
  61. +          
  62. +           stmt.setInt(1, getObjectId());
  63. +           stmt.setString(2, getName());
  64. +           stmt.setInt(3, 1);
  65. +           stmt.setInt(4, isNoble() ? 1 : 0);
  66. +           stmt.setInt(5, isDonator() ? 1 : 0);
  67. +           stmt.setLong(6, heroTime == 0 ? 0 : System.currentTimeMillis() + heroTime);
  68. +           stmt.execute();
  69. +           stmt.close();
  70. +           stmt = null;
  71. +       }
  72. +       catch(Exception e)
  73. +       {
  74. +           if(Config.ENABLE_ALL_EXCEPTIONS)
  75. +               e.printStackTrace();
  76. +
  77. +           _log.log(Level.SEVERE, "Error: could not update database: ", e);
  78. +       }
  79. +       finally
  80. +       {
  81. +           CloseUtil.close(con);
  82. +           con = null;
  83. +       }
  84. +   }
  85. +  
  86.     /**
  87.      * Sets the donator.
  88.      *
  89. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2GrandBossInstance.java
  90. ===================================================================
  91. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2GrandBossInstance.java (revision 936)
  92. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2GrandBossInstance.java (working copy)
  93. @@ -21,6 +21,7 @@
  94.  import com.l2jfrozen.gameserver.model.L2Summon;
  95.  import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
  96.  import com.l2jfrozen.gameserver.network.SystemMessageId;
  97. +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
  98.  import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  99.  import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  100.  import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  101. @@ -67,6 +68,16 @@
  102.  
  103.         if(player != null)
  104.         {
  105. +           if (Config.RH_HERO_BOSS_LIST.contains(getNpcId()) && !player.isHero())
  106. +           {
  107. +               player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
  108. +               player.setIsHero(true);
  109. +               player.setHeroEndTime(Config.RH_HERO_BOSS_DAYS * 24L * 60L * 60L * 1000L);
  110. +               player.sendMessage("You Are Now a Hero! You Are Granted With Hero Status, Skills, Aura.");
  111. +               player.broadcastUserInfo();
  112. +               player.getInventory().addItem("Wings of Destiny", 6842, 1, player, null);
  113. +           }
  114. +          
  115.             SystemMessage msg = new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL);
  116.             broadcastPacket(msg);
  117.             msg = null;
  118. Index: head-src/com/l2jfrozen/Config.java
  119. ===================================================================
  120. --- head-src/com/l2jfrozen/Config.java  (revision 936)
  121. +++ head-src/com/l2jfrozen/Config.java  (working copy)
  122. @@ -2379,6 +2379,10 @@
  123.     public static String PVP1_CUSTOM_MESSAGE;
  124.     public static String PVP2_CUSTOM_MESSAGE;
  125.  
  126. +    public static String RH_HERO_BOSS_ID;
  127. +    public static List<Integer> RH_HERO_BOSS_LIST = new FastList<Integer>();
  128. +   public static int RH_HERO_BOSS_DAYS;
  129. +  
  130.     //============================================================
  131.     public static void loadL2JFrozenConfig()
  132.     {
  133. @@ -2391,6 +2395,11 @@
  134.             L2JFrozenSettings.load(is);
  135.             is.close();
  136.  
  137. +            RH_HERO_BOSS_ID = L2JFrozenSettings.getProperty("HeroBossList", "0");
  138. +            for(String bossId : RH_HERO_BOSS_ID.split(","))
  139. +                RH_HERO_BOSS_LIST.add(Integer.parseInt(bossId));
  140. +            RH_HERO_BOSS_DAYS  = Integer.parseInt(L2JFrozenSettings.getProperty("HeroBossDays", "1"));
  141. +
  142.             /** Custom Tables **/
  143.             CUSTOM_SPAWNLIST_TABLE = Boolean.valueOf(L2JFrozenSettings.getProperty("CustomSpawnlistTable", "True"));
  144.             SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(L2JFrozenSettings.getProperty("SaveGmSpawnOnCustom", "True"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement