JVBarbosa

[Frozen]Custom_Reward_RB_with_modification_party

Sep 10th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.02 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java  (revision 1118)
  6. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2RaidBossInstance.java  (working copy)
  7. @@ -107,10 +107,12 @@
  8.             {
  9.                 for (final L2PcInstance member : player.getParty().getPartyMembers())
  10.                 {
  11. +                   SpecialReward(member, Config.COUNT_ITEM_REWARD / player.getParty().getPartyMembers().size());
  12.                     RaidBossPointsManager.addPoints(member, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5));
  13.                 }
  14.             }
  15.             else
  16. +               SpecialReward(player, Config.COUNT_ITEM_REWARD);
  17.                 RaidBossPointsManager.addPoints(player, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5));
  18.         }
  19.        
  20. @@ -120,6 +122,21 @@
  21.         return true;
  22.     }
  23.    
  24. +   private void SpecialReward(L2PcInstance player, int countItemReward)
  25. +   {
  26. +       if (Config.ENABLE_CUSTOM_DROP_RB && getNpcId() == Config.ID_RB_CUSTOM_DROP && player.isInsideRadius(getX(), getY(), getZ(), 1200, false, false) && checkCountItemInventory(Config.ID_ITEM_REQUIRED, Config.COUNT_ITEM_REQUIRED, player))
  27. +       {
  28. +           player.getInventory().addItem("Reward", Config.ID_ITEM_REWARD, countItemReward, player, null);
  29. +           player.getInventory().updateDatabase();
  30. +       }
  31. +   }
  32. +   public boolean checkCountItemInventory(int item_id, int countRequired, L2PcInstance player)
  33. +   {
  34. +       final L2ItemInstance item = player.getInventory().getItemByItemId(item_id);
  35. +       if (item == null) return false;
  36. +       return item.getCount() >= countRequired ? player.destroyItemByItemId("Consumed", item_id, countRequired, player, false) : false;
  37. +   }
  38. +  
  39.     /**
  40.      * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home.
  41.      */
  42. Index: config/head/boss.properties
  43. ===================================================================
  44. --- config/head/boss.properties (revision 1118)
  45. +++ config/head/boss.properties (working copy)
  46. @@ -217,4 +217,14 @@
  47.  IntervalOfDoorOfAlter = 5400
  48.  # Time of closing the doors of the altar after some one zashol.
  49.  # The value in seconds in the interval 60-600
  50. -TimeOfLockUpDoorOfAltar = 180
  51. \ No newline at end of file
  52. +TimeOfLockUpDoorOfAltar = 180
  53. +
  54. +# Custom Drop Raid BOSS by João Vitor Barbosa
  55. +# Drop for party that kill Raid Boss
  56. +# Default = False
  57. +EnableCustomDropRB = True
  58. +IdRBCustomDrop = 25001
  59. +IdItemRequired = 57
  60. +CountItemRequired = 200
  61. +IdItemReward = 5072
  62. +CountItemReward = 500
  63. \ No newline at end of file
  64. Index: head-src/com/l2jfrozen/Config.java
  65. ===================================================================
  66. --- head-src/com/l2jfrozen/Config.java  (revision 1118)
  67. +++ head-src/com/l2jfrozen/Config.java  (working copy)
  68. @@ -3807,6 +3807,13 @@
  69.     public static String RAID_INFO_IDS;
  70.     public static FastList<Integer> RAID_INFO_IDS_LIST = new FastList<>();
  71.    
  72. +   public static boolean ENABLE_CUSTOM_DROP_RB;
  73. +   public static int ID_RB_CUSTOM_DROP;
  74. +   public static int ID_ITEM_REQUIRED;
  75. +   public static int COUNT_ITEM_REQUIRED;
  76. +   public static int ID_ITEM_REWARD;
  77. +   public static int COUNT_ITEM_REWARD;
  78. +  
  79.     // ============================================================
  80.     public static void loadBossConfig()
  81.     {
  82. @@ -3996,6 +4003,13 @@
  83.             }
  84.             HPH_TIMEOFLOCKUPDOOROFALTAR *= 6000;
  85.            
  86. +           ENABLE_CUSTOM_DROP_RB = Boolean.valueOf(bossSettings.getProperty("EnableCustomDropRB", "false"));
  87. +           ID_RB_CUSTOM_DROP = Integer.parseInt(bossSettings.getProperty("IdRBCustomDrop", "25001"));
  88. +           ID_ITEM_REQUIRED = Integer.parseInt(bossSettings.getProperty("IdItemRequired", "57"));
  89. +           COUNT_ITEM_REQUIRED = Integer.parseInt(bossSettings.getProperty("CountItemRequired", "200"));
  90. +           ID_ITEM_REWARD = Integer.parseInt(bossSettings.getProperty("IdItemReward", "5072"));
  91. +           COUNT_ITEM_REWARD = Integer.parseInt(bossSettings.getProperty("CountItemReward", "500"));
  92. +          
  93.         }
  94.         catch (final Exception e)
  95.         {
Add Comment
Please, Sign In to add comment