Advertisement
VANPER

Aio Buffer Item

Feb 9th, 2020
1,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 26.69 KB | None | 0 0
  1. Index: l2jban.aiobuffer;AdminSetAio.java
  2. ===================================================================
  3. --- l2jban.aiobuffer;AdminSetAio.java   (revision 84)
  4. +++ l2jban.aiobuffer;AdminSetAio.java   (working copy)
  5.  
  6. +/*
  7. + * This program is free software: you can redistribute it and/or modify it under
  8. + * the terms of the GNU General Public License as published by the Free Software
  9. + * Foundation, either version 3 of the License, or (at your option) any later
  10. + * version.
  11. + *
  12. + * This program is distributed in the hope that it will be useful, but WITHOUT
  13. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. + * details.
  16. + *
  17. + * You should have received a copy of the GNU General Public License along with
  18. + * this program. If not, see <http://www.gnu.org/licenses/>.
  19. + */
  20. +package l2jban.aiobuffer;
  21. +
  22. +import java.util.StringTokenizer;
  23. +import java.util.concurrent.TimeUnit;
  24. +
  25. +import net.sf.l2j.commons.concurrent.ThreadPool;
  26. +
  27. +import net.sf.l2j.Config;
  28. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  29. +import net.sf.l2j.gameserver.model.L2Skill;
  30. +import net.sf.l2j.gameserver.model.World;
  31. +import net.sf.l2j.gameserver.model.actor.Player;
  32. +import net.sf.l2j.gameserver.network.clientpackets.Say2;
  33. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  34. +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  35. +import l2jban.aiobuffer.AioTaskManager;
  36. +
  37. +/**
  38. + * @author jBan
  39. + */
  40. +public class AdminSetAio implements IAdminCommandHandler
  41. +{
  42. +   private static String[] _adminCommands = new String[]
  43. +   {
  44. +       "admin_setaio",
  45. +       "admin_removeaio"
  46. +   };
  47. +  
  48. +   @Override
  49. +   public boolean useAdminCommand(String command, Player activeChar)
  50. +   {
  51. +       StringTokenizer st = new StringTokenizer(command);
  52. +       st.nextToken();
  53. +       String player = "";
  54. +       int time = 1;
  55. +       Player target = null;
  56. +       if (st.hasMoreTokens())
  57. +       {
  58. +           player = st.nextToken();
  59. +           target = World.getInstance().getPlayer(player);
  60. +           if (st.hasMoreTokens())
  61. +           {
  62. +               try
  63. +               {
  64. +                   time = Integer.parseInt(st.nextToken());
  65. +               }
  66. +               catch (NumberFormatException nfe)
  67. +               {
  68. +                   activeChar.sendMessage("Invalid number format used: " + nfe);
  69. +                   return false;
  70. +               }
  71. +           }
  72. +       }
  73. +       else if (activeChar.getTarget() != null && activeChar.getTarget() instanceof Player)
  74. +           target = (Player) activeChar.getTarget();
  75. +      
  76. +       if (command.startsWith("admin_setaio"))
  77. +       {
  78. +           if (target == null && player.equals(""))
  79. +           {
  80. +               activeChar.sendMessage("Usage: //setaio <char_name> [duration_days]");
  81. +               return false;
  82. +           }
  83. +           if (target != null)
  84. +           {
  85. +               AdminSetAio.doAio(target, activeChar, time);
  86. +               activeChar.sendMessage(target.getName() + " Comando /aio Liberado! ");
  87. +               activeChar.sendMessage(target.getName() + " got AIO status for " + time + " day(s).");
  88. +           }
  89. +       }
  90. +       else if (command.startsWith("admin_removeaio"))
  91. +       {
  92. +           if (target == null && player.equals(""))
  93. +           {
  94. +               activeChar.sendMessage("Usage: //removeaio <char_name>");
  95. +               return false;
  96. +           }
  97. +           if (target != null)
  98. +           {
  99. +               if (target.isAio())
  100. +               {
  101. +                   AdminSetAio.removeAio(target, activeChar);
  102. +                   activeChar.sendMessage("Removed the AIO status from " + target.getName() + ".");
  103. +               }
  104. +               activeChar.sendMessage(target.getName() + " haven't AIO status.");
  105. +           }
  106. +       }
  107. +       return true;
  108. +   }
  109. +  
  110. +   public static void doAio(Player target, Player player, int time)
  111. +   {
  112. +       target.getStat().addExp(target.getStat().getExpForLevel(81));
  113. +       target.broadcastPacket(new SocialAction(target, 3));
  114. +       target.setAio(true);
  115. +      
  116. +       AioTaskManager.getInstance().add(target);
  117. +       long remainingTime = target.getMemos().getLong("aioEndTime", 0);
  118. +       if (remainingTime > 0)
  119. +       {
  120. +           target.getMemos().set("aioEndTime", remainingTime + TimeUnit.DAYS.toMillis(time));
  121. +           target.sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "AIO Manager", "Dear " + player.getName() + ", your AIO status has been extended by " + time + " day(s)."));
  122. +       }
  123. +       else
  124. +       {
  125. +           target.getMemos().set("aioEndTime", System.currentTimeMillis() + TimeUnit.DAYS.toMillis(time));
  126. +           target.sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "AIO Manager", "Dear " + player.getName() + ", you got AIO Status for " + time + " day(s)."));
  127. +          
  128. +           for (L2Skill skill : target.getSkills().values())
  129. +               target.removeSkill(skill.getId(), true);
  130. +          
  131. +           if (Config.AIO_ITEM_ID != 0)
  132. +           {
  133. +               target.addItem("Add", Config.AIO_ITEM_ID, 1, target, true);
  134. +               target.getInventory().equipItemAndRecord(target.getInventory().getItemByItemId(Config.AIO_ITEM_ID));
  135. +           }
  136. +           target.addAioSkills();
  137. +           target.broadcastUserInfo();
  138. +       }
  139. +   }
  140. +  
  141. +   public static void removeAio(Player target, Player player)
  142. +   {
  143. +       AioTaskManager.getInstance().remove(target);
  144. +       target.getMemos().set("aioEndTime", 0);
  145. +       target.setAio(false);
  146. +       for (L2Skill skill : target.getSkills().values())
  147. +           target.removeSkill(skill.getId(), true);
  148. +      
  149. +       if (Config.AIO_ITEM_ID != 0)
  150. +           target.destroyItemByItemId("Destroy", Config.AIO_ITEM_ID, 1, target, true);
  151. +      
  152. +       target.sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "AIO Manager", "Dear " + player.getName() + ", Your AIO period is over. You will be disconected in 3 seconds."));
  153. +       target.broadcastPacket(new SocialAction(target, 13));
  154. +       target.sendSkillList();
  155. +       target.broadcastUserInfo();
  156. +       ThreadPool.schedule(() -> target.logout(false), 3000);
  157. +   }
  158. +  
  159. +   @Override
  160. +   public String[] getAdminCommandList()
  161. +   {
  162. +       return _adminCommands;
  163. +   }
  164. +}
  165.  
  166. Index: l2jban.aiobuffer;AioItem.java
  167. ===================================================================
  168. --- l2jban.aiobuffer;AioItem.java   (revision 84)
  169. +++ l2jban.aiobuffer;AioItem.java   (working copy)
  170.  
  171. +   /*
  172. +    * This program is free software: you can redistribute it and/or modify it under
  173. +    * the terms of the GNU General Public License as published by the Free Software
  174. +    * Foundation, either version 3 of the License, or (at your option) any later
  175. +    * version.
  176. +    *
  177. +    * This program is distributed in the hope that it will be useful, but WITHOUT
  178. +    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  179. +    * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  180. +    * details.
  181. +    *
  182. +    * You should have received a copy of the GNU General Public License along with
  183. +    * this program. If not, see <http://www.gnu.org/licenses/>.
  184. +    */
  185. +   package l2jban.aiobuffer;
  186. +  
  187. +   import net.sf.l2j.Config;
  188. +   import net.sf.l2j.gameserver.handler.IItemHandler;
  189. +   import net.sf.l2j.gameserver.model.actor.Playable;
  190. +   import net.sf.l2j.gameserver.model.actor.Player;
  191. +   import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  192. +   import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
  193. +   import net.sf.l2j.gameserver.network.SystemMessageId;
  194. +  
  195. +  
  196. +   /**
  197. +    * @author Reborn12
  198. +    */
  199. +   public class AioItem implements IItemHandler
  200. +   {
  201. +       private static final int[] ITEM_IDS = new int[]
  202. +       {
  203. +           Config.AIO_COIN_ID
  204. +       };
  205. +      
  206. +       @Override
  207. +       public void useItem(Playable playable, ItemInstance item, boolean forceUse)
  208. +       {
  209. +          
  210. +           if (Config.ENABLE_AIO_COIN)
  211. +           {
  212. +               if (!(playable instanceof Player))
  213. +                   return;
  214. +              
  215. +               Player player = (Player) playable;
  216. +               if (player.isAio())
  217. +                   player.sendMessage("Comando /aio Liberado!");
  218. +          
  219. +               else if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(player))
  220. +                   player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
  221. +               else if (player.destroyItemByItemId("aio", Config.AIO_COIN_ID, 1, null, true))
  222. +                   AdminSetAio.doAio(player, player, Config.AIO_COIN_DAYS);
  223. +               AioMenu.mainHtml(player, 0);
  224. +           }
  225. +       }
  226. +      
  227. +       public int[] getItemIds()
  228. +       {
  229. +           return ITEM_IDS;
  230. +       }
  231. +   }
  232. +  
  233.  
  234. Index: l2jban.aiobuffer;AioMenu.java
  235. ===================================================================
  236. --- l2jban.aiobuffer;AioMenu.java   (revision 84)
  237. +++ l2jban.aiobuffer;AioMenu.java   (working copy)
  238.  
  239. +   /*
  240. +   * This program is free software: you can redistribute it and/or modify it under
  241. +   * the terms of the GNU General Public License as published by the Free Software
  242. +   * Foundation, either version 3 of the License, or (at your option) any later
  243. +   * version.
  244. +   *
  245. +   * This program is distributed in the hope that it will be useful, but WITHOUT
  246. +   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  247. +   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  248. +   * details.
  249. +   *
  250. +   * You should have received a copy of the GNU General Public License along with
  251. +   * this program. If not, see <http://www.gnu.org/licenses/>.
  252. +   */
  253. +   package l2jban.aiobuffer;
  254. +  
  255. +   import java.text.SimpleDateFormat;
  256. +   import java.util.StringTokenizer;
  257. +   import java.util.concurrent.TimeUnit;
  258. +  
  259. +   import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
  260. +   import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  261. +   import net.sf.l2j.gameserver.model.actor.Player;
  262. +   import net.sf.l2j.gameserver.model.location.TeleportLocation;
  263. +   import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  264. +   import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  265. +  
  266. +   public class AioMenu implements IUserCommandHandler
  267. +   {
  268. +       private static final int[] COMMAND_IDS =
  269. +       {
  270. +           2005
  271. +       };
  272. +      
  273. +       @Override
  274. +  
  275. +       public boolean useUserCommand(int command, Player activeChar)
  276. +       {
  277. +           mainHtml(activeChar, 0);
  278. +           return true;
  279. +       }
  280. +  
  281. +      
  282. +       public static void mainHtml(Player activeChar, int time)
  283. +       {
  284. +           NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  285. +           StringBuilder html = new StringBuilder("");
  286. +           html.append("<html><head><title>AIO Menu</title></head><body><center>");
  287. +           html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  288. +           html.append("<table width=305 height=20 bgcolor=000000>");
  289. +           html.append("<tr>");
  290. +           html.append("<td align=center>Personal AIO Options</td>");
  291. +           html.append("</tr>");
  292. +           html.append("</table>");
  293. +           html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  294. +           if (activeChar.isAio())
  295. +           {
  296. +               html.append("<br><br>");
  297. +               html.append("<button value=\"Towns\" action=\"bypass -h aiopanel panelteleport\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  298. +               html.append("Allow you to move to another Town.");
  299. +               html.append("<br>");
  300. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  301. +               html.append("<table width=305 height=20 bgcolor=000000>");
  302. +               html.append("<tr>");
  303. +               html.append("<td align=center>Color Name Options</td>");
  304. +               html.append("</tr>");
  305. +               html.append("</table>");
  306. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  307. +               html.append("<br><br>");
  308. +               html.append("<a action=\"bypass -h aiopanel color Green\" <font color=\"009900\">Green</font></a>");
  309. +               html.append("<a action=\"bypass -h aiopanel color Blue\" <font color=\"3333ff\">Blue</font></a>");
  310. +               html.append("<a action=\"bypass -h aiopanel color Purple\" <font color=\"800080\">Purple</font></a>");
  311. +               html.append("<a action=\"bypass -h aiopanel color Yellow\" <font color=\"ffff00\">Yellow</font></a>");
  312. +               html.append("<a action=\"bypass -h aiopanel color Gold\" <font color=\"cca300\">Gold</font></a>");
  313. +               html.append("<br><br><br>");
  314. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  315. +               html.append("<table width=310 height=20 bgcolor=000000>");
  316. +               html.append("<tr>");
  317. +               html.append("<td align=center>Your AIO Status Period:</td>");
  318. +               html.append("</tr>");
  319. +               html.append("</table>");
  320. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  321. +               long delay = activeChar.getMemos().getLong("aioEndTime", 0);
  322. +               html.append("AIO Status ends at " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(delay) + "");
  323. +           }
  324. +           else
  325. +           {
  326. +               html.append("<br>");
  327. +               html.append("Your character Isn't AIO.");
  328. +           }
  329. +           html.append("</center>");
  330. +           html.append("</body></html>");
  331. +           nhm.setHtml(html.toString());
  332. +           activeChar.sendPacket(nhm);
  333. +           return;
  334. +       }
  335. +      
  336. +       public static void Time(Player player, int time)
  337. +       {
  338. +           player.getMemos().set("aioEndTime", System.currentTimeMillis() + TimeUnit.DAYS.toMillis(time));
  339. +       }
  340. +  
  341. +       public static void bypass(Player activeChar, String command, StringTokenizer st)
  342. +       {
  343. +           if (command.equals("panelteleport"))
  344. +           {
  345. +               NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  346. +               StringBuilder html = new StringBuilder("");
  347. +               html.append("<html><head><title>AIO Teleport Menu</title></head><body><center>");
  348. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  349. +               html.append("<table width=315 height=20 bgcolor=000000>");
  350. +               html.append("<tr>");
  351. +               html.append("<td align=center>Choose your destination</td>");
  352. +               html.append("</tr>");
  353. +               html.append("</table>");
  354. +               html.append("<img src=\"SS_l2jNetwork.lineo\" width=300 height=3>");
  355. +               if (activeChar.isAio())
  356. +               {
  357. +                   html.append("<br><br>");
  358. +                   html.append("<button value=\"Giran\" action=\"bypass -h aiopanel teleportTo 1040\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  359. +                   html.append("<button value=\"Goddard\" action=\"bypass -h aiopanel teleportTo 1039\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  360. +                   html.append("<button value=\"Rune\" action=\"bypass -h aiopanel teleportTo 1041\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  361. +                   html.append("<button value=\"Aden\" action=\"bypass -h aiopanel teleportTo 1037\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  362. +                   html.append("<button value=\"Dion\" action=\"bypass -h aiopanel teleportTo 6\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  363. +                   html.append("<button value=\"Gludio\" action=\"bypass -h aiopanel teleportTo 1099\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  364. +                   html.append("<button value=\"Gludin\" action=\"bypass -h aiopanel teleportTo 5\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  365. +                   html.append("<button value=\"Heine\" action=\"bypass -h aiopanel teleportTo 1036\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  366. +                   html.append("<button value=\"Oren\" action=\"bypass -h aiopanel teleportTo 1038\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  367. +                   html.append("<button value=\"Schuttgart\" action=\"bypass -h aiopanel teleportTo 1035\" width=122 height=23 fore=\"SS_l2jBan.bf\" back=\"SS_l2jBan.bf\">");
  368. +                   html.append("<br><br>");
  369. +               }
  370. +               else
  371. +               {
  372. +                   html.append("<br>");
  373. +                   html.append("Your character Isn't AIO.");
  374. +               }
  375. +               html.append("</center>");
  376. +               html.append("</body></html>");
  377. +               nhm.setHtml(html.toString());
  378. +               activeChar.sendPacket(nhm);
  379. +           }
  380. +           else if (command.equals("teleportTo"))
  381. +           {
  382. +               final TeleportLocation list = TeleportLocationData.getInstance().getTeleportLocation(Integer.parseInt(st.nextToken()));
  383. +               if (list != null)
  384. +               {
  385. +                   if (activeChar.reduceAdena("Teleport", list.getPrice(), activeChar, true))
  386. +                       activeChar.teleportTo(list, 0);
  387. +               }
  388. +               else
  389. +                   activeChar.sendMessage("No teleport destination. Contact with server Admin");
  390. +              
  391. +               activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  392. +           }
  393. +           else if (command.equals("color"))
  394. +              
  395. +           {
  396. +               NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  397. +               StringBuilder html = new StringBuilder("");
  398. +               String type = st.nextToken();
  399. +              
  400. +               switch (type)
  401. +               {
  402. +                   case "Green":
  403. +  
  404. +                       activeChar.getAppearance().setNameColor(0x009900);
  405. +                       activeChar.broadcastUserInfo();
  406. +                       activeChar.sendMessage("Your color name has changed!");
  407. +                       nhm.setHtml(html.toString());
  408. +                       activeChar.sendPacket(nhm);
  409. +                       break;
  410. +                   case "Blue":
  411. +  
  412. +                       activeChar.getAppearance().setNameColor(0xff7f00);
  413. +                       activeChar.broadcastUserInfo();
  414. +                       activeChar.sendMessage("Your color name has changed!");
  415. +                       nhm.setHtml(html.toString());
  416. +                       activeChar.sendPacket(nhm);
  417. +                       break;
  418. +                   case "Purple":
  419. +              
  420. +                       activeChar.getAppearance().setNameColor(0x800080);
  421. +                       activeChar.broadcastUserInfo();
  422. +                       activeChar.sendMessage("Your color name has changed!");
  423. +                       nhm.setHtml(html.toString());
  424. +                       activeChar.sendPacket(nhm);
  425. +                       break;
  426. +                   case "Yellow":
  427. +                  
  428. +                       activeChar.getAppearance().setNameColor(0x00ffff);
  429. +                       activeChar.broadcastUserInfo();
  430. +                       activeChar.sendMessage("Your color name has changed!");
  431. +                       nhm.setHtml(html.toString());
  432. +                       activeChar.sendPacket(nhm);
  433. +                       break;
  434. +                   case "Gold":
  435. +                  
  436. +                       activeChar.getAppearance().setNameColor(0x0099ff);
  437. +                       activeChar.broadcastUserInfo();
  438. +                       activeChar.sendMessage("Your color name has changed!");
  439. +                       nhm.setHtml(html.toString());
  440. +                       activeChar.sendPacket(nhm);
  441. +                       break;
  442. +               }
  443. +           }
  444. +       }
  445. +          
  446. +      
  447. +       @Override
  448. +       public int[] getUserCommandList()
  449. +       {
  450. +           return COMMAND_IDS;
  451. +       }
  452. +   }
  453. +  
  454.  
  455. Index: l2jban.aiobuffer;AioTaskManager.java
  456. ===================================================================
  457. --- l2jban.aiobuffer;AioTaskManager.java    (revision 84)
  458. +++ l2jban.aiobuffer;AioTaskManager.java    (working copy)
  459.  
  460.  
  461. +   /*
  462. +    * This program is free software: you can redistribute it and/or modify it under
  463. +    * the terms of the GNU General Public License as published by the Free Software
  464. +    * Foundation, either version 3 of the License, or (at your option) any later
  465. +    * version.
  466. +    *
  467. +    * This program is distributed in the hope that it will be useful, but WITHOUT
  468. +    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  469. +    * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  470. +    * details.
  471. +    *
  472. +    * You should have received a copy of the GNU General Public License along with
  473. +    * this program. If not, see <http://www.gnu.org/licenses/>.
  474. +    */
  475. +   package l2jban.aiobuffer;
  476. +  
  477. +   import java.util.Map;
  478. +   import java.util.concurrent.ConcurrentHashMap;
  479. +  
  480. +   import net.sf.l2j.commons.concurrent.ThreadPool;
  481. +  
  482. +   import l2jban.aiobuffer.AdminSetAio;
  483. +   import net.sf.l2j.gameserver.model.actor.Creature;
  484. +   import net.sf.l2j.gameserver.model.actor.Player;
  485. +  
  486. +   /**
  487. +    * @author jBan
  488. +    *
  489. +    */
  490. +   public final class AioTaskManager implements Runnable
  491. +   {
  492. +       private final Map<Player, Long> _players = new ConcurrentHashMap<>();
  493. +      
  494. +       protected AioTaskManager()
  495. +       {
  496. +           // Run task each 10 second.
  497. +           ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
  498. +       }
  499. +      
  500. +       public final void add(Player player)
  501. +       {
  502. +           _players.put(player, System.currentTimeMillis());
  503. +       }
  504. +      
  505. +       public final void remove(Creature player)
  506. +       {
  507. +           _players.remove(player);
  508. +       }
  509. +      
  510. +       @Override
  511. +       public final void run()
  512. +       {
  513. +           if (_players.isEmpty())
  514. +               return;
  515. +          
  516. +           for (Map.Entry<Player, Long> entry : _players.entrySet())
  517. +           {
  518. +               final Player player = entry.getKey();
  519. +              
  520. +               if (player.getMemos().getLong("aioEndTime") < System.currentTimeMillis())
  521. +               {
  522. +                   AdminSetAio.removeAio(player, player);
  523. +                   remove(player);
  524. +               }
  525. +           }
  526. +       }
  527. +      
  528. +       public static final AioTaskManager getInstance()
  529. +       {
  530. +           return SingletonHolder._instance;
  531. +       }
  532. +      
  533. +       private static class SingletonHolder
  534. +       {
  535. +           protected static final AioTaskManager _instance = new AioTaskManager();
  536. +       }
  537. +   }
  538. +  
  539.  
  540. Index: net.sf.l2j.gameserver.network.clientpackets;EnterWorld.java
  541. ===================================================================
  542. --- net.sf.l2j.gameserver.network.clientpackets;EnterWorld.java (revision 84)
  543. +++ net.sf.l2j.gameserver.network.clientpackets;EnterWorld.java (working copy)
  544.  
  545.  
  546. -       player.sendSkillList();
  547. +       player.sendSkillList();
  548.        
  549. +       if (player.getMemos().getLong("aioEndTime", 0) > 0)
  550. +           onEnterAio(player);
  551.            
  552.            
  553. -   AnnouncementData.getInstance().showAnnouncements(player, false);
  554. +   AnnouncementData.getInstance().showAnnouncements(player, false);
  555.  
  556. +       if (Config.ANNOUNCE_AIO)
  557. +           if (player.isAio())
  558. +               World.announceToOnlinePlayers("Aiox " + player.getName() + " has been logged in.");
  559.  
  560.  
  561. +   private static void onEnterAio(Player player)
  562. +   {
  563. +       long now = Calendar.getInstance().getTimeInMillis();
  564. +       long endDay = player.getMemos().getLong("aioEndTime");
  565. +      
  566. +       if (now > endDay)
  567. +           AdminSetAio.removeAio(player, player);
  568. +       else
  569. +       {
  570. +           player.setAio(true);
  571. +           player.addAioSkills();
  572. +           player.broadcastUserInfo();
  573. +           AioMenu.mainHtml(player, 0);
  574. +           sendReEnterMessageAio(player);
  575. +       }
  576. +   }
  577.    
  578. +   private static void sendReEnterMessageAio(Player player)
  579. +   {
  580. +       long delay = player.getMemos().getLong("aioEndTime", 0);
  581. +      
  582. +       player.sendMessage("Aio Buffer Ends In: " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(delay) + "");
  583. +   }
  584.  
  585. Index: net.sf.l2j.gameserver.model.actor;Player.java
  586. ===================================================================
  587. --- net.sf.l2j.gameserver.model.actor;Player.java   (revision 84)
  588. +++ net.sf.l2j.gameserver.model.actor;Player.java   (working copy)
  589.  
  590.  
  591. +   private boolean _isAio;
  592. +  
  593. +   public boolean isAio()
  594. +   {
  595. +       return _isAio;
  596. +   }
  597. +  
  598. +   public boolean setAio(boolean b)
  599. +   {
  600. +       return _isAio = b;
  601. +   }
  602. +  
  603. +   public void addAioSkills()
  604. +   {
  605. +       for (int skillid : Config.AIO_SKILLS.keySet())
  606. +       {
  607. +           final L2Skill skill = SkillTable.getInstance().getInfo(skillid, Config.AIO_SKILLS.get(skillid));
  608. +          
  609. +           if (skill != null)
  610. +               addSkill(skill, true);
  611. +       }
  612. +       sendSkillList();
  613. +   }
  614.  
  615. Index: gameserver/coinfig/player.propertis
  616. ===================================================================
  617. --- gameserver/coinfig/player.propertis (revision 84)
  618. +++ gameserver/coinfig/player.propertis (working copy)
  619. @@ -1281,6 +1281,10 @@
  620.  
  621.  
  622. +   # ================================================
  623. +   #                   Aio Settings
  624. +   # ================================================
  625. +   #Enable/Disable AIO Item.
  626. +   EnableAioCoin = True
  627. +   #Aio Coin ID
  628. +   # You should go to < Data/xml/items (your item ID) >,
  629. +   # Add in the end of the item's line ( <set name="handler" val="AioItem"/> ).
  630. +   AioCoinId = 9300
  631. +   #Aio Item Set Days.
  632. +   SetAioDays = 90
  633. +
  634. +   #Annoucer Aio Loguin
  635. +   AnnounceAioLogin = False
  636. +
  637. +   # ID of the item that will be given to AIO
  638. +   # Default: Keshanberk*Keshanberk
  639. +   # 0 to disable
  640. +   RewardAioItemId = 5706
  641. +
  642. +  
  643. +   # List of Aio Skills
  644. +   # Format : skillid,skilllvl;skillid2,skilllvl2;
  645. +   AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1243,6;1045,6;1048,6;1429,1;163,1;\
  646. +   1311,6;213,8;1007,3;1309,3;1552,3;1006,3;1308,3;1253,3;1284,3;1392,3;1393,3;214,1;\
  647. +   1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;164,3;\
  648. +   272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1353,3;1391,3;1002,3;7029,1;\
  649. +   1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1388,3;1389,3;1240,3;1413,1;\
  650. +   1086,2;1036,2;1035,4;1068,3;1356,1;1355,1;1357,1;1307,3;1410,1;1409,1;1353,1;\
  651. +   1044,3;1182,3;1191,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
  652. +   269,1;270,1;265,1;363,1;349,1;308,1;305,1;304,1;267,1;266,1;268,1;1390,3;1303,2;\
  653. +   1204,2;1268,4;395,1;396,1;1375,1;1376,1;1374,1;4551,10;4552,10;4553,10;4553,10
  654. +  
  655. +  
  656.  
  657. Index: data\xml\items/AioItem.xml
  658. ===================================================================
  659. --- data\xml\items/AioItem.xml  (revision 84)
  660. +++ data\xml\items/AioItem.xml  (working copy)
  661. @@ -1281,6 +1281,10 @@
  662.  
  663. +<?xml version="1.0" encoding="UTF-8"?>
  664. +<list>
  665. +
  666. +   <item id="9300" type="EtcItem" name="AIO Buffer">  
  667. +   <set name="material" val="PAPER" />
  668. +   <set name="price" val="10000" />
  669. +   <set name="is_stackable" val="true" />
  670. +   <set name="handler" val="AioItem"/>
  671. +   </item>
  672. +</list>
  673.  
  674. Index: net.sf.l2j.gameserver.handler;AdminCommandHandler.java
  675. ===================================================================
  676. --- net.sf.l2j.gameserver.handler;AdminCommandHandler.java  (revision 84)
  677. +++ net.sf.l2j.gameserver.handler;AdminCommandHandler.java  (working copy)
  678. @@ -1281,6 +1281,10 @@
  679.  
  680. +   import l2jban.aiobuffer.AdminSetAio;
  681.  
  682. -   registerHandler(new AdminCreateItem());
  683. +   registerHandler(new AdminCreateItem());
  684. +   registerHandler(new AdminSetAio());
  685.  
  686. Index: net.sf.l2j.gameserver.handler;ItemHandler.java
  687. ===================================================================
  688. --- net.sf.l2j.gameserver.handler;ItemHandler.java  (revision 84)
  689. +++ net.sf.l2j.gameserver.handler;ItemHandler.java  (working copy)
  690. @@ -1281,6 +1281,10 @@
  691.  
  692. +   import l2jban.aiobuffer.AioItem;
  693.  
  694. -   registerHandler(new Book());
  695. +   registerHandler(new Book());
  696. +   registerHandler(new AioItem());
  697.  
  698. Index: java/net/sf/l2j/Config.java
  699. ===================================================================
  700. --- java/net/sf/l2j/Config.java (revision 84)
  701. +++ java/net/sf/l2j/Config.java (working copy)
  702. @@ -1281,6 +1281,10 @@
  703.  
  704. +   /** L2jBan AIO Settings */
  705. +   public static Map<Integer, Integer> AIO_SKILLS;
  706. +   public static int AIO_ITEM_ID;
  707. +   public static boolean ENABLE_AIO_COIN;
  708. +   public static int AIO_COIN_ID;
  709. +   public static int AIO_COIN_DAYS;   
  710. +   public static boolean ANNOUNCE_AIO;
  711.  
  712.  
  713. +   ANNOUNCE_AIO = players.getProperty("AnnounceAioLogin", true);
  714. +   ENABLE_AIO_COIN = players.getProperty("EnableAioCoin", false);
  715. +   AIO_COIN_ID = players.getProperty("AioCoinId", 10);
  716. +   AIO_COIN_DAYS = players.getProperty("SetAioDays", 10);
  717. +   AIO_ITEM_ID = players.getProperty("RewardAioItemId", 10);
  718. +   AIO_SKILLS = new HashMap<>();
  719. +   for (String skillInfo : players.getProperty("AioSkills").split(";"))
  720. +   {
  721. +       String[] info = skillInfo.split(",");
  722. +       AIO_SKILLS.put(Integer.parseInt(info[0]), Integer.parseInt(info[1]));
  723. +   }
  724.  
  725. Index: net.sf.l2j.gameserver.model.actor.instance;Gatekeeper.java
  726. ===================================================================
  727. --- net.sf.l2j.gameserver.model.actor.instance;Gatekeeper.java  (revision 84)
  728. +++ net.sf.l2j.gameserver.model.actor.instance;Gatekeeper.java  (working copy)
  729. @@ -1281,6 +1281,10 @@
  730.  
  731.     @Override
  732.     public void showChatWindow(Player player, int val)
  733.     {
  734. +       // Generic Aio check. Send back the HTM if found and cancel current action.
  735. +       if (player.isAio()  && showPkDenyChatWindow(player, "teleporter"))
  736. +           return;
  737.        
  738.         showChatWindow(player, getHtmlPath(getNpcId(), val));
  739.     }
  740.    
  741.    
  742. Index: net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.java
  743. ===================================================================
  744. --- net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.java  (revision 84)
  745. +++ net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.java  (working copy)
  746. @@ -1281,6 +1281,10 @@
  747.  
  748. +   import l2jban.aiobuffer.AioMenu;
  749.  
  750.  
  751. +   if (_command.startsWith("aiopanel"))
  752. +   {
  753. +       String value = _command.substring(8);
  754. +       StringTokenizer st = new StringTokenizer(value);
  755. +       String command = st.nextToken();
  756. +      
  757. +       AioMenu.bypass(player, command, st);
  758. +   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement