Advertisement
warc222

Share: Clan Item lvl 8, clan rep & CSL2Diadora

Sep 17th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.27 KB | None | 0 0
  1. Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/SystemMessage.java
  2. ===================================================================
  3. --- head-src/com/l2jfrozen/gameserver/network/serverpackets/SystemMessage.java (revision 32)
  4. +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/SystemMessage.java (working copy)
  5. @@ -18,6 +18,7 @@
  6.  
  7. import com.l2jfrozen.Config;
  8. import com.l2jfrozen.gameserver.model.L2Skill;
  9. +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  10. import com.l2jfrozen.gameserver.network.SystemMessageId;
  11.  
  12. public final class SystemMessage extends L2GameServerPacket
  13. @@ -79,6 +80,10 @@
  14. return this;
  15. }
  16.  
  17. + public final SystemMessage addItemName(final L2ItemInstance item)
  18. + {
  19. + return addItemName(item.getItem().getItemId());
  20. + }
  21. public SystemMessage addItemName(int id)
  22. {
  23. _types.add(new Integer(TYPE_ITEM_NAME));
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. Index: head-src/com/l2jfrozen/Config.java
  33. ===================================================================
  34. --- head-src/com/l2jfrozen/Config.java (revision 33)
  35. +++ head-src/com/l2jfrozen/Config.java (working copy)
  36. @@ -256,6 +256,18 @@
  37. public static int AIO_TCOLOR;
  38. public static boolean ALLOW_AIO_USE_GK;
  39. public static boolean ALLOW_AIO_USE_CM;
  40. + /** Clan Item **/
  41. + public static boolean CLAN_TITLE;
  42. + public static String ADD_CLAN_TITLE;
  43. + public static boolean ENABLE_CLAN_ITEM;
  44. + public static Map<Integer, Integer> CLAN_ITEM_SKILLS;
  45. + public static int CLAN_ITEM_ID;
  46. + public static boolean ALLOW_ITEM_SET_LEVEL;
  47. + public static byte CLAN_ITEM_LEVEL;
  48. + public static boolean ALLOW_REPUTATION_ITEM;
  49. + public static int REPUTATION_ITEM_QUANTITY;
  50. + public static boolean ALLOW_CLAN_TCOLOR;
  51. + public static int CLAN_ITEM_TCOLOR;
  52. public static boolean ANNOUNCE_CASTLE_LORDS;
  53. public static boolean ALLOW_VIP_NCOLOR;
  54. public static int VIP_NCOLOR;
  55. @@ -1953,6 +1965,46 @@
  56. AIO_TCOLOR = Integer.decode("0x" + otherSettings.getProperty("AioTitleColor", "88AA88"));
  57. ALLOW_AIO_USE_GK = Boolean.parseBoolean(otherSettings.getProperty("AllowAioUseGk", "False"));
  58. ALLOW_AIO_USE_CM = Boolean.parseBoolean(otherSettings.getProperty("AllowAioUseClassMaster", "False"));
  59. + /** Clan Item **/
  60. + ENABLE_CLAN_ITEM = Boolean.parseBoolean(otherSettings.getProperty("EnableClanItem", "True"));
  61. + if(ENABLE_CLAN_ITEM)
  62. + {
  63. + String ItemSkillsSplit[] = otherSettings.getProperty("ClanItemSkills", "").split(";");
  64. + CLAN_ITEM_SKILLS = new FastMap<Integer, Integer>(ItemSkillsSplit.length);
  65. + String arr[] = ItemSkillsSplit;
  66. + int len = arr.length;
  67. + for(int i = 0; i < len; i++)
  68. + {
  69. + String skill = arr[i];
  70. + String skillSplit[] = skill.split(",");
  71. + if(skillSplit.length != 2)
  72. + {
  73. + System.out.println((new StringBuilder()).append("[Clan Item]: invalid config property in custom.properties -> ClanItemSkills \"").append(skill).append("\"").toString());
  74. + continue;
  75. + }
  76. + try
  77. + {
  78. + CLAN_ITEM_SKILLS.put(Integer.valueOf(Integer.parseInt(skillSplit[0])), Integer.valueOf(Integer.parseInt(skillSplit[1])));
  79. + continue;
  80. + }
  81. + catch(NumberFormatException nfe)
  82. + {
  83. + //
  84. + }
  85. + if(!skill.equals(""))
  86. + System.out.println((new StringBuilder()).append("[Clan Item]: invalid config property in custom.properties -> ClanItemSkills \"").append(skillSplit[0]).append("\"").append(skillSplit[1]).toString());
  87. + }
  88. + }
  89. + CLAN_ITEM_ID = Integer.parseInt(otherSettings.getProperty("ClanItemID", "666"));
  90. + ALLOW_ITEM_SET_LEVEL = TypeFormat.parseBoolean(otherSettings.getProperty("AllowClanItemLevel", "True"));
  91. + CLAN_ITEM_LEVEL = Byte.parseByte(otherSettings.getProperty("ClanItemSetLevel", "8"));
  92. + ALLOW_REPUTATION_ITEM = TypeFormat.parseBoolean(otherSettings.getProperty("AllowClanItemRep", "False"));
  93. + REPUTATION_ITEM_QUANTITY = Integer.parseInt(otherSettings.getProperty("ReputationItemScore", "10000"));
  94. + CLAN_TITLE = TypeFormat.parseBoolean(otherSettings.getProperty("ClanItemTitle", "False"));
  95. + ADD_CLAN_TITLE = otherSettings.getProperty("ClanItemAddTitle", "L2JDream");
  96. + ALLOW_CLAN_TCOLOR = TypeFormat.parseBoolean(otherSettings.getProperty("AllowClanItemTitle", "False"));
  97. + CLAN_ITEM_TCOLOR = Integer.decode("0x" + otherSettings.getProperty("ClanTitleColor", "88AA88"));
  98. +
  99. ALLOW_VIP_NCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowVipNameColor", "True"));
  100. VIP_NCOLOR = Integer.decode("0x" + otherSettings.getProperty("VipNameColor", "0088FF"));
  101. ALLOW_VIP_TCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowVipTitleColor", "True"));
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java
  109. ===================================================================
  110. --- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java (revision 0)
  111. +++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java (working copy)
  112. @@ -0,0 +1,65 @@
  113. +package com.l2jfrozen.gameserver.handler.itemhandlers;
  114. +
  115. +import com.l2jfrozen.Config;
  116. +import com.l2jfrozen.gameserver.handler.IItemHandler;
  117. +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  118. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  119. +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  120. +import com.l2jfrozen.gameserver.network.SystemMessageId;
  121. +import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  122. +
  123. +/**
  124. + * @author Bian
  125. + **/
  126. +public class ClanItem implements IItemHandler
  127. +{
  128. + private static final int ITEM_IDS[] = { Config.CLAN_ITEM_ID };
  129. +
  130. + @Override
  131. + public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  132. + {
  133. + if(!(playable instanceof L2PcInstance))
  134. + return;
  135. +
  136. + if (item == null)
  137. + {
  138. + return;
  139. + }
  140. +
  141. + L2PcInstance player = (L2PcInstance)playable;
  142. + if (!player.isClanLeader())
  143. + {
  144. + player.sendPacket(new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addItemName(item));
  145. + return;
  146. + }
  147. + else if (player.isInOlympiadMode())
  148. + {
  149. + player.sendPacket(new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addItemName(item));
  150. + return;
  151. + }
  152. + else
  153. + {
  154. + if(player.destroyItem("Consume", item.getObjectId(), 1, null, false))
  155. + {
  156. + if (Config.ALLOW_ITEM_SET_LEVEL)
  157. + {
  158. + player.getClan().changeLevel(Config.CLAN_ITEM_LEVEL);
  159. + player.sendMessage((new StringBuilder()).append("Congratulations you now have your clan level ").append(Config.CLAN_ITEM_LEVEL).append(".").toString());
  160. + }
  161. +
  162. + if (Config.CLAN_TITLE)
  163. + {
  164. + player.setTitle(Config.ADD_CLAN_TITLE);
  165. + }
  166. +
  167. + player.ClanItem();
  168. + }
  169. + }
  170. + }
  171. +
  172. + @Override
  173. + public int[] getItemIds()
  174. + {
  175. + return ITEM_IDS;
  176. + }
  177. +}
  178.  
  179.  
  180.  
  181.  
  182. Index: config/others/other.properties
  183. ===================================================================
  184. --- config/others/other.properties (revision 32)
  185. +++ config/others/other.properties (working copy)
  186. @@ -31,6 +31,44 @@
  187. # Aio Buffers can speak to Class Master?
  188. AllowAioUseClassMaster = False
  189.  
  190. +#========================================
  191. +# Clan Item
  192. +#========================================
  193. +
  194. +# Enable and Disable Item
  195. +EnableClanItem = True
  196. +
  197. +# ItemID for Clan Item
  198. +ClanItemID = 666
  199. +
  200. +# List of Skills reward for clan
  201. +# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
  202. +ClanItemSkills = 370,3;371,3;372,3;373,3;374,3;375,3;376,3;377,3;378,3;379,3;380,3;381,3;382,3;383,3;384,3;385,3;386,3;387,3;388,3;389,3;390,3;391,3;
  203. +
  204. +# Allow Clan Item Set Level
  205. +AllowClanItemLevel = True
  206. +
  207. +# LvL Clan Reward
  208. +ClanItemSetLevel = 8
  209. +
  210. +# Allow Clan Item Set Reputation
  211. +AllowClanItemRep = False
  212. +
  213. +# Quantity Reputation Points
  214. +ReputationItemScore = 10000
  215. +
  216. +# Allow Clan Item Title ADD
  217. +ClanItemTitle = False
  218. +
  219. +# Clan Title ADD
  220. +ClanItemAddTitle = L2JDream
  221. +
  222. +# Allow Clan Item Title Colow
  223. +AllowClanItemTitleColor = False
  224. +
  225. +# Clan Title Color in HEX
  226. +ClanTitleColor = 88AA88
  227. +
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  235. ===================================================================
  236. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 36)
  237. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  238. @@ -20125,7 +20132,34 @@
  239. }
  240. sendSkillList();
  241. }
  242. -
  243. + public void ClanItem()
  244. + {
  245. + for(Iterator<Integer> i = Config.CLAN_ITEM_SKILLS.keySet().iterator(); i.hasNext(); broadcastUserInfo())
  246. + {
  247. + Integer skillid = (Integer)i.next();
  248. + int skilllvl = ((Integer)Config.CLAN_ITEM_SKILLS.get(skillid)).intValue();
  249. + L2Skill skill = SkillTable.getInstance().getInfo(skillid.intValue(), skilllvl);
  250. + if(skill != null)
  251. + addSkill(skill, true);
  252. + getClan().addNewSkill(skill);
  253. + sendSkillList();
  254. + }
  255. +
  256. + if (Config.ALLOW_REPUTATION_ITEM)
  257. + {
  258. + L2Clan clan = getClan();
  259. + clan.setReputationScore(clan.getReputationScore() + Config.REPUTATION_ITEM_QUANTITY, true);
  260. + sendMessage((new StringBuilder()).append("You received ").append(Config.REPUTATION_ITEM_QUANTITY).append(" Reputation Points.").toString());
  261. + }
  262. +
  263. + if (Config.ALLOW_CLAN_TCOLOR)
  264. + {
  265. + getAppearance().setTitleColor(Config.CLAN_ITEM_TCOLOR);
  266. + }
  267. +
  268. + sendSkillList();
  269. + broadcastUserInfo();
  270. + }
  271. /**
  272. * Get the current pet skill in use or return null.<br><br>
  273. * @return
  274.  
  275.  
  276.  
  277.  
  278.  
  279. Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
  280. ===================================================================
  281. --- head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (revision 32)
  282. +++ head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (working copy)
  283. @@ -32,6 +32,7 @@
  284. import com.l2jfrozen.gameserver.handler.itemhandlers.CharChangePotions;
  285. import com.l2jfrozen.gameserver.handler.itemhandlers.ChestKey;
  286. import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
  287. +import com.l2jfrozen.gameserver.handler.itemhandlers.ClanItem;
  288. import com.l2jfrozen.gameserver.handler.itemhandlers.CrystalCarol;
  289. import com.l2jfrozen.gameserver.handler.itemhandlers.Crystals;
  290. import com.l2jfrozen.gameserver.handler.itemhandlers.CustomPotions;
  291. @@ -152,6 +153,7 @@
  292. registerItemHandler(new BreakingArrow());
  293. registerItemHandler(new ChristmasTree());
  294. registerItemHandler(new Crystals());
  295. + registerItemHandler(new ClanItem());
  296. _log.config("ItemHandler: Loaded " + _datatable.size() + " handlers.");
  297. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement