Guest User

[Java] Clan Reputation Item.

a guest
Oct 18th, 2012
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.88 KB | None | 0 0
  1. Index: gameserver/config/functions/l2jfrozen.properties
  2. ===================================================================
  3. --- gameserver/config/functions/l2jfrozen.properties    (revision 94)
  4. +++ gameserver/config/functions/l2jfrozen.properties    (revision 95)
  5. @@ -69,6 +69,22 @@
  6.  # Hero for X days, 0 forever.
  7.  HeroCustomDay = 7
  8.  
  9. +# -------------------------------------------------------
  10. +# Clan Reputation Custom Item Configuration
  11. +# -------------------------------------------------------
  12. +# Would you like to enable the Clan Reputation points item?
  13. +# Default: False
  14. +EnableTheClanRepPointsItem = False
  15. +# What's the Min Level in which clan leaders will be able to use the item?
  16. +# Default 5
  17. +MinClanLevelNeededForCR = 5
  18. +# How many rep points will be rewarded to the clan?
  19. +# Default 500
  20. +HowManyClanRepsToGive = 500
  21. +# Set the ID of the Clan Rep Points Item
  22. +# Default = 6673 (Festival Adena)
  23. +CRItemID = 9957
  24. +
  25. # --------------------------------------------
  26. # Custom hero subclass skill -
  27. # --------------------------------------------
  28. Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
  29. ===================================================================
  30. --- gameserver/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java   (revision 94)
  31. +++ gameserver/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java   (revision 95)
  32. @@ -32,6 +32,7 @@
  33. import com.l2jfrozen.gameserver.handler.itemhandlers.CharChangePotions;
  34. import com.l2jfrozen.gameserver.handler.itemhandlers.ChestKey;
  35. import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
  36. +import com.l2jfrozen.gameserver.handler.itemhandlers.ClanRepsItem;
  37. import com.l2jfrozen.gameserver.handler.itemhandlers.CrystalCarol;
  38. import com.l2jfrozen.gameserver.handler.itemhandlers.Crystals;
  39. import com.l2jfrozen.gameserver.handler.itemhandlers.CustomPotions;
  40. @@ -118,6 +119,7 @@
  41.         registerItemHandler(new BeastSoulShot());
  42.         registerItemHandler(new BeastSpiritShot());
  43.         registerItemHandler(new ChestKey());
  44. +       registerItemHandler(new ClanRepsItem());
  45.         registerItemHandler(new CustomPotions());
  46.         registerItemHandler(new PaganKeys());
  47.         registerItemHandler(new Maps());
  48. Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanRepsItem.java
  49. ===================================================================
  50. --- gameserver/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanRepsItem.java (revision 0)
  51. +++ gameserver/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanRepsItem.java (revision 95)
  52. @@ -0,0 +1,77 @@
  53. +/*
  54. + * This program is free software; you can redistribute it and/or modify
  55. + * it under the terms of the GNU General Public License as published by
  56. + * the Free Software Foundation; either version 2, or (at your option)
  57. + * any later version.
  58. + *
  59. + * This program is distributed in the hope that it will be useful,
  60. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  61. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  62. + * GNU General Public License for more details.
  63. + *
  64. + * You should have received a copy of the GNU General Public License
  65. + * along with this program; if not, write to the Free Software
  66. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  67. + * 02111-1307, USA.
  68. + *
  69. + * http://www.gnu.org/copyleft/gpl.html
  70. + */
  71. +package com.l2jfrozen.gameserver.handler.itemhandlers;
  72. +
  73. +/**
  74. + *
  75. + *
  76. + * @author Coyote
  77. + * Adapted by Strike
  78. + */
  79. +
  80. +
  81. +import com.l2jfrozen.Config;
  82. +import com.l2jfrozen.gameserver.handler.IItemHandler;
  83. +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  84. +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  85. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  86. +import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;
  87. +
  88. +public class ClanRepsItem implements IItemHandler
  89. +{
  90. +    private static final int ITEM_IDS[] =
  91. +    {
  92. +       Config.CR_ITEM_REPS_ITEM_ID
  93. +    };
  94. +
  95. +    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  96. +    {
  97. +            if (!(playable instanceof L2PcInstance))
  98. +            {
  99. +                return;
  100. +            }
  101. +
  102. +            L2PcInstance activeChar = (L2PcInstance)playable;
  103. +
  104. +            if (!activeChar.isClanLeader())
  105. +            {
  106. +                activeChar.sendMessage("This can be used only by Clan Leaders!");
  107. +                return;
  108. +            }
  109. +          
  110. +            else if (!(activeChar.getClan().getLevel() >= Config.CR_ITEM_MIN_CLAN_LVL))
  111. +            {
  112. +               activeChar.sendMessage("Your Clan Level is not big enough to use this item!");
  113. +               return;
  114. +            }
  115. +            else
  116. +            {
  117. +               activeChar.getClan().setReputationScore(activeChar.getClan().getReputationScore()+Config.CR_ITEM_REPS_TO_BE_AWARDED, true);
  118. +               activeChar.sendMessage("Your clan has earned "+ Config.CR_ITEM_REPS_TO_BE_AWARDED +" rep points!");
  119. +               MagicSkillUser  MSU = new MagicSkillUser(activeChar, activeChar, 2024, 1, 1, 0);
  120. +               activeChar.broadcastPacket(MSU);
  121. +              playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  122. +            }
  123. +        }
  124. +
  125. +    public int[] getItemIds()
  126. +    {
  127. +        return ITEM_IDS;
  128. +    }
  129. +}
  130. Index: gameserver/head-src/com/l2jfrozen/Config.java
  131. ===================================================================
  132. --- gameserver/head-src/com/l2jfrozen/Config.java   (revision 94)
  133. +++ gameserver/head-src/com/l2jfrozen/Config.java   (revision 95)
  134. @@ -2379,7 +2379,16 @@
  135.     public static String PVP1_CUSTOM_MESSAGE;
  136.     public static String PVP2_CUSTOM_MESSAGE;
  137.     public static boolean SHOW_NPC_CREST;
  138. -
  139. +  
  140. +   /**
  141. +   * Clan Reputation Item
  142. +   * Adapted By Strike
  143. +   */
  144. +   public static boolean USE_CR_ITEM;
  145. +   public static int CR_ITEM_MIN_CLAN_LVL;
  146. +   public static int CR_ITEM_REPS_TO_BE_AWARDED;
  147. +   public static int CR_ITEM_REPS_ITEM_ID;
  148. +  
  149.     //============================================================
  150.     public static void loadL2JFrozenConfig()
  151.     {
  152. @@ -2499,6 +2508,11 @@
  153.             PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
  154.             PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
  155.             SHOW_NPC_CREST = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ShowNpcCrest", "False"));
  156. +           /** Clan reputation Item**/
  157. +           USE_CR_ITEM = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableTheClanRepPointsItem", "False"));
  158. +           CR_ITEM_MIN_CLAN_LVL = Integer.parseInt(L2JFrozenSettings.getProperty("ClanLevelNeededForCR", "5"));
  159. +           CR_ITEM_REPS_TO_BE_AWARDED = Integer.parseInt(L2JFrozenSettings.getProperty("HowManyClanRepsToGive", "500"));
  160. +           CR_ITEM_REPS_ITEM_ID = Integer.parseInt(L2JFrozenSettings.getProperty("CRItemID", "6673"));
  161.         }
  162.         catch(Exception e)
  163.         {
Advertisement
Add Comment
Please, Sign In to add comment