Sarada-L2

Vip Coin 2 Click L2jFrozen Yo: Sarada

Dec 4th, 2020 (edited)
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. Index: com/l2jfrozen/gameserver/handler/itemhandlers/VipCoin.java;
  2.  
  3. +package com.l2jfrozen.gameserver.handler.itemhandlers;
  4. +
  5. +import java.util.Calendar;
  6. +
  7. +import com.l2jfrozen.Config;
  8. +import com.l2jfrozen.gameserver.handler.IItemHandler;
  9. +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  10. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  11. +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  12. +import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate;
  13. +
  14. +/**
  15. + *
  16. + * @author Computer Sarada
  17. + *
  18. + */
  19. +public class VipCoin implements IItemHandler
  20. +{
  21. + private static final int ITEM_IDS[] = { Config.VIP_COIN_ID1, Config.VIP_COIN_ID2, Config.VIP_COIN_ID3};
  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.VIP_COIN_ID1)
  34. + {
  35. + if (activeChar.isInOlympiadMode())
  36. + {
  37. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  38. + return;
  39. + }
  40. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  41. + {
  42. + if (activeChar.isVip())
  43. + {
  44. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  45. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID1));
  46. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID1 + " day of VIP.");
  47. + }
  48. + else
  49. + {
  50. + activeChar.setVip(true);
  51. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID1);
  52. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID1 + " day.");
  53. + }
  54. +
  55. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  56. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  57. +
  58. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  59. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  60. +
  61. + activeChar.broadcastUserInfo();
  62. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  63. + }
  64. + }
  65. +
  66. + else if (itemId == Config.VIP_COIN_ID2)
  67. + {
  68. + if (activeChar.isInOlympiadMode())
  69. + {
  70. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  71. + return;
  72. + }
  73. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  74. + {
  75. + if (activeChar.isVip())
  76. + {
  77. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  78. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID2));
  79. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID2 + " day of VIP.");
  80. + }
  81. + else
  82. + {
  83. + activeChar.setVip(true);
  84. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID2);
  85. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID2 + " day.");
  86. + }
  87. +
  88. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  89. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  90. +
  91. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  92. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  93. +
  94. + activeChar.broadcastUserInfo();
  95. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  96. + }
  97. + }
  98. +
  99. + else if (itemId == Config.VIP_COIN_ID3)
  100. + {
  101. + if (activeChar.isInOlympiadMode())
  102. + {
  103. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  104. + return;
  105. + }
  106. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  107. + {
  108. + if (activeChar.isVip())
  109. + {
  110. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  111. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID3));
  112. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID3 + " day of VIP.");
  113. + }
  114. + else
  115. + {
  116. + activeChar.setVip(true);
  117. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID3);
  118. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID3 + " day.");
  119. + }
  120. +
  121. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  122. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  123. +
  124. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  125. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  126. +
  127. + activeChar.broadcastUserInfo();
  128. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  129. + }
  130. + }
  131. + }
  132. + @Override
  133. + public int[] getItemIds()
  134. + {
  135. + return ITEM_IDS;
  136. + }
  137. + }
  138.  
  139. Index: com/l2jfrozen/gameserver/handler/ItemHandler.java;
  140.  
  141. import com.l2jfrozen.gameserver.handler.itemhandlers.SummonItems;
  142. +import com.l2jfrozen.gameserver.handler.itemhandlers.VipCoin;
  143.  
  144. _datatable = new TreeMap<>();
  145. +registerItemHandler(new VipCoin());
  146. registerItemHandler(new ScrollOfEscape());
  147.  
  148.  
  149. Index: com/l2jfrozen/Config.java;
  150.  
  151. public static boolean WEDDING_GIVE_CUPID_BOW;
  152. public static boolean ANNOUNCE_WEDDING;
  153. + public static int VIP_COIN_ID1;
  154. + public static int VIP_DAYS_ID1;
  155. + public static int VIP_COIN_ID2;
  156. + public static int VIP_DAYS_ID2;
  157. + public static int VIP_COIN_ID3;
  158. + public static int VIP_DAYS_ID3;
  159.  
  160.  
  161. ENABLE_AIO_SYSTEM = Boolean.parseBoolean(otherSettings.getProperty("EnableAioSystem", "True"));
  162. +VIP_COIN_ID1 = Integer.parseInt(otherSettings.getProperty("VipCoin", "0"));
  163. +VIP_DAYS_ID1 = Integer.parseInt(otherSettings.getProperty("VipCoinDays", "1"));
  164. +VIP_COIN_ID2 = Integer.parseInt(otherSettings.getProperty("VipCoin2", "0"));
  165. +VIP_DAYS_ID2 = Integer.parseInt(otherSettings.getProperty("VipCoinDays2", "2"));
  166. +VIP_COIN_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoin3", "0"));
  167. +VIP_DAYS_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoinDays3", "3"));
  168.  
  169.  
  170. Index: gameserver/config/head/other.properties;
  171.  
  172. # Crit announce
  173. GMShowCritAnnouncerName = False
  174.  
  175. +#=============================================================
  176. +# VIP Item 1
  177. +#=============================================================
  178. +#Item Coin 1
  179. +VipCoin = 6392
  180. +VipCoinDays = 15
  181. +
  182. +#=============================================================
  183. +# VIP Item 2
  184. +#=============================================================
  185. +#Item Coin 2
  186. +VipCoin2 = 6393
  187. +VipCoinDays2 = 30
  188. +
  189. +#=============================================================
  190. +# VIP Item 3
  191. +#=============================================================
  192. +#Item Coin 3
  193. +VipCoin3 = 5557
  194. +VipCoinDays3 = 45
  195.  
Add Comment
Please, Sign In to add comment