Advertisement
Sarada-L2

Aio Item 2 Click L2jFrozen Yo: Sarada

Dec 4th, 2020 (edited)
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.75 KB | None | 0 0
  1. Index: com/l2jfrozen/gameserver/handler/itemhandlers/AioItem.java;
  2.  
  3. +package com.l2jfrozen.gameserver.handler.itemhandlers;
  4. +import java.util.Calendar;
  5. +import java.util.StringTokenizer;
  6. +
  7. +import com.l2jfrozen.Config;
  8. +import com.l2jfrozen.gameserver.handler.IItemHandler;
  9. +import com.l2jfrozen.gameserver.model.L2Character;
  10. +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  11. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  12. +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  13. +import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate;
  14. +/**
  15. + *
  16. + * @author Computer Sarada
  17. + *
  18. + */
  19. +public class AioItem implements IItemHandler
  20. +{
  21. + private static final int ITEM_IDS[] = { Config.AIO_ITEM, Config.AIO_ITEM2, Config.AIO_ITEM3};
  22. +
  23. + @Override
  24. + public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
  25. + {
  26. + if (!(playable instanceof L2PcInstance))
  27. + return;
  28. +
  29. + L2PcInstance activeChar = (L2PcInstance)playable;
  30. +
  31. + int itemId = item.getItemId();
  32. +
  33. + if (itemId == Config.AIO_ITEM)
  34. + {
  35. + if (activeChar.isInOlympiadMode())
  36. + {
  37. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  38. + return;
  39. + }
  40. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  41. + activeChar.sendMessage("You can only use this item in peace zone..");
  42. + return;
  43. + }
  44. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  45. + {
  46. + if (activeChar.isAio())
  47. + {
  48. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  49. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS));
  50. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS + " day of AIO.");
  51. + }
  52. + else
  53. + {
  54. + activeChar.setAio(true);
  55. + activeChar.setEndTime("aio", Config.AIO_DIAS);
  56. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS + " day.");
  57. + }
  58. +
  59. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  60. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  61. +
  62. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  63. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  64. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
  65. + activeChar.rewardAioSkills();
  66. + if (Config.ALLOW_AIO_ITEM)
  67. + {
  68. + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
  69. + while (st.hasMoreElements())
  70. + {
  71. + int item_id = Integer.parseInt(st.nextToken());
  72. + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
  73. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
  74. + }
  75. + }
  76. + activeChar.broadcastUserInfo();
  77. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  78. + }
  79. + }
  80. +
  81. + else if (itemId == Config.AIO_ITEM2)
  82. + {
  83. + if (activeChar.isInOlympiadMode())
  84. + {
  85. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  86. + return;
  87. + }
  88. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  89. + activeChar.sendMessage("You can only use this item in peace zone..");
  90. + return;
  91. + }
  92. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  93. + {
  94. + if (activeChar.isAio())
  95. + {
  96. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  97. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS2));
  98. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS2 + " day of AIO.");
  99. + }
  100. + else
  101. + {
  102. + activeChar.setAio(true);
  103. + activeChar.setEndTime("aio", Config.AIO_DIAS2);
  104. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS2 + " day.");
  105. + }
  106. +
  107. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  108. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  109. +
  110. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  111. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  112. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
  113. + activeChar.rewardAioSkills();
  114. + if (Config.ALLOW_AIO_ITEM)
  115. + {
  116. + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
  117. + while (st.hasMoreElements())
  118. + {
  119. + int item_id = Integer.parseInt(st.nextToken());
  120. + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
  121. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
  122. + }
  123. + }
  124. + activeChar.broadcastUserInfo();
  125. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  126. + }
  127. + }
  128. +
  129. + else if (itemId == Config.AIO_ITEM3)
  130. + {
  131. + if (activeChar.isInOlympiadMode())
  132. + {
  133. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  134. + return;
  135. + }
  136. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  137. + activeChar.sendMessage("You can only use this item in peace zone..");
  138. + return;
  139. + }
  140. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  141. + {
  142. + if (activeChar.isAio())
  143. + {
  144. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  145. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS3));
  146. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS3 + " day of AIO.");
  147. + }
  148. + else
  149. + {
  150. + activeChar.setAio(true);
  151. + activeChar.setEndTime("aio", Config.AIO_DIAS3);
  152. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS3 + " day.");
  153. + }
  154. +
  155. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  156. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  157. +
  158. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  159. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  160. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
  161. + activeChar.rewardAioSkills();
  162. + if (Config.ALLOW_AIO_ITEM)
  163. + {
  164. + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
  165. + while (st.hasMoreElements())
  166. + {
  167. + int item_id = Integer.parseInt(st.nextToken());
  168. + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
  169. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
  170. + }
  171. + }
  172. + activeChar.broadcastUserInfo();
  173. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  174. + }
  175. + }
  176. + }
  177. + @Override
  178. + public int[] getItemIds()
  179. + {
  180. + return ITEM_IDS;
  181. + }
  182. + }
  183.  
  184. Index: com/l2jfrozen/gameserver/handler/itemhandlers.java;
  185. +import com.l2jfrozen.gameserver.handler.itemhandlers.AioItem;
  186. import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSoulShot;
  187. _datatable = new TreeMap<>();
  188. +registerItemHandler(new AioItem());
  189.  
  190.  
  191.  
  192. Index: com/l2jfrozen/Config.java;
  193.  
  194. public static boolean ANNOUNCE_WEDDING;
  195. + public static int AIO_ITEM;
  196. + public static int AIO_DIAS;
  197. + public static int AIO_ITEM2;
  198. + public static int AIO_DIAS2;
  199. + public static int AIO_ITEM3;
  200. + public static int AIO_DIAS3;
  201.  
  202.  
  203. VIP_DAYS_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoinDays3", "3"));
  204. + ALLOW_AIO_ITEM = Boolean.parseBoolean(otherSettings.getProperty("EnableDualAIO", "True"));
  205. + AIO_ITEMID = otherSettings.getProperty("ItemIdAio", "9209,9210");
  206. + AIO_ITEM = Integer.parseInt(otherSettings.getProperty("AioCoin", "10"));
  207. + AIO_DIAS = Integer.parseInt(otherSettings.getProperty("AioDays", "10"));
  208. + AIO_ITEM2 = Integer.parseInt(otherSettings.getProperty("AioCoin2", "10"));
  209. + AIO_DIAS2 = Integer.parseInt(otherSettings.getProperty("AioDays2", "10"));
  210. + AIO_ITEM3 = Integer.parseInt(otherSettings.getProperty("AioCoin3", "10"));
  211. + AIO_DIAS3 = Integer.parseInt(otherSettings.getProperty("AioDays3", "10"));
  212.  
  213. Index: gameserver/config/head/other.properties;
  214.  
  215. GMShowCritAnnouncerName = False
  216.  
  217. +#=============================================================
  218. +# AIO Item 1
  219. +#=============================================================
  220. +EnableDualAIO = True
  221. +ItemIdAio = 6580
  222. +
  223. +AioCoin = 6392
  224. +AioDays = 1
  225. +#=============================================================
  226. +# AIO Item 2
  227. +#=============================================================
  228. +AioCoin2 = 6393
  229. +AioDays2 = 5
  230. +#=============================================================
  231. +# AIO Item 3
  232. +#=============================================================
  233. +AioCoin3 = 5556
  234. +AioDays3 = 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement