Sarada-L2

Aio CLICK+Aio System C4

Jun 8th, 2021 (edited)
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.51 KB | None | 0 0
  1. diff --git a/config/CustomMods/Donate.ini b/config/CustomMods/Donate.ini
  2. new file mode 100644
  3. index 0000000..1b55fd0
  4. --- /dev/null
  5. +++ b/config/CustomMods/Donate.ini
  6. @@ -0,0 +1,51 @@
  7. +#=============================================================
  8. +# AIO System
  9. +#=============================================================
  10. +# Enable / Disable Aion System
  11. +EnableAioSystem = True
  12. +# Enable / Disable Name Color
  13. +AllowAioNameColor = True
  14. +AioNameColor = 88AA88
  15. +# Enable / Disable Title Color
  16. +AllowAioTitleColor = True
  17. +AioTitleColor = 88AA88
  18. +# List of Aio Skills
  19. +# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
  20. +AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1005,3;1243,6;1045,6;1048,6;\
  21. +1311,6;168,3;213,8;1007,3;1309,3;1552,3;1006,3;1229,15;1308,3;1253,3;1284,3;\
  22. +1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;\
  23. +272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1257,3;1353,3;1391,3;\
  24. +1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1217,33;1388,3;1389,3;1240,3;\
  25. +1086,2;1032,3;1073,2;1036,2;1035,4;1068,3;1003,3;1282,2;1356,1;1355,1;1357,33;\
  26. +1044,3;1182,3;1191,3;1033,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
  27. +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;\
  28. +1204,2;1268,4;1413,1;4699,8;4700,8;4703,8
  29. +# Aio Buffers can speak to Class Master?
  30. +AllowAioUseClassMaster = False
  31. +# Allow AIO in events?
  32. +AllowAioInEvents = False
  33. +
  34. +#Dual Aio
  35. +AllowAIOItem = True
  36. +ItemIdAio = 6580
  37. +
  38. +#=============================================================
  39. +# AIO Item 1
  40. +#=============================================================
  41. +#Item Coin 1
  42. +AioCoin = 0
  43. +AioDays = 1
  44. +
  45. +#=============================================================
  46. +# AIO Item 2
  47. +#=============================================================
  48. +#Item Coin 2
  49. +AioCoin2 = 0
  50. +AioDays2 = 5
  51. +
  52. +#=============================================================
  53. +# AIO Item 3
  54. +#=============================================================
  55. +#Item Coin 3
  56. +AioCoin3 = 0
  57. +AioDays3 = 10
  58. diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
  59. index 38ac517..973b295 100644
  60. --- a/java/net/sf/l2j/Config.java
  61. +++ b/java/net/sf/l2j/Config.java
  62. @@ -608,6 +608,22 @@
  63. public static int VIP_DAYS_ID2;
  64. public static int VIP_COIN_ID3;
  65. public static int VIP_DAYS_ID3;
  66. + public static boolean ENABLE_AIO_SYSTEM;
  67. + public static Map<Integer, Integer> AIO_SKILLS;
  68. + public static boolean ALLOW_AIO_NCOLOR;
  69. + public static int AIO_NCOLOR;
  70. + public static boolean ALLOW_AIO_TCOLOR;
  71. + public static int AIO_TCOLOR;
  72. + public static boolean ALLOW_AIO_ITEM;
  73. + public static int AIO_ITEMID;
  74. + public static int AIO_ITEM;
  75. + public static int AIO_DIAS;
  76. + public static int AIO_ITEM2;
  77. + public static int AIO_DIAS2;
  78. + public static int AIO_ITEM3;
  79. + public static int AIO_DIAS3;
  80. + public static boolean ALLOW_AIO_IN_EVENTS;
  81. + public static boolean ALLOW_AIO_USE_CM;
  82. /** Accept precise drop calculation ? */
  83. public static boolean PRECISE_DROP_CALCULATION;
  84. /** Accept multi-items drop ? */
  85. @@ -2308,6 +2324,49 @@
  86. VIP_DAYS_ID2 = Integer.parseInt(donate.getProperty("VipCoinDays2", "2"));
  87. VIP_COIN_ID3 = Integer.parseInt(donate.getProperty("VipCoin3", "5557"));
  88. VIP_DAYS_ID3 = Integer.parseInt(donate.getProperty("VipCoinDays3", "3"));
  89. + ALLOW_AIO_USE_CM = Boolean.parseBoolean(donate.getProperty("AllowAioUseClassMaster", "False"));
  90. + ALLOW_AIO_IN_EVENTS = Boolean.parseBoolean(donate.getProperty("AllowAioInEvents", "False"));
  91. + AIO_ITEM = Integer.parseInt(donate.getProperty("AioCoin", "10"));
  92. + AIO_DIAS = Integer.parseInt(donate.getProperty("AioDays", "10"));
  93. + AIO_ITEM2 = Integer.parseInt(donate.getProperty("AioCoin2", "10"));
  94. + AIO_DIAS2 = Integer.parseInt(donate.getProperty("AioDays2", "10"));
  95. + AIO_ITEM3 = Integer.parseInt(donate.getProperty("AioCoin3", "10"));
  96. + AIO_DIAS3 = Integer.parseInt(donate.getProperty("AioDays3", "10"));
  97. + /** AIO System */
  98. + ENABLE_AIO_SYSTEM = Boolean.parseBoolean(donate.getProperty("EnableAioSystem", "True"));
  99. + ALLOW_AIO_NCOLOR = Boolean.parseBoolean(donate.getProperty("AllowAioNameColor", "True"));
  100. + AIO_NCOLOR = Integer.decode("0x" + donate.getProperty("AioNameColor", "88AA88"));
  101. + ALLOW_AIO_TCOLOR = Boolean.parseBoolean(donate.getProperty("AllowAioTitleColor", "True"));
  102. + AIO_TCOLOR = Integer.decode("0x" + donate.getProperty("AioTitleColor", "88AA88"));
  103. + AIO_ITEMID = Integer.parseInt(donate.getProperty("ItemIdAio", "9945"));
  104. + ALLOW_AIO_ITEM = Boolean.parseBoolean(donate.getProperty("AllowAIOItem", "False"));
  105. + if(ENABLE_AIO_SYSTEM) //create map if system is enabled
  106. + {
  107. + String[] VipSkillsSplit = donate.getProperty("AioSkills", "").split(";");
  108. + AIO_SKILLS = new HashMap<>(VipSkillsSplit.length);
  109. + for (String skill : VipSkillsSplit)
  110. + {
  111. + String[] skillSplit = skill.split(",");
  112. + if (skillSplit.length != 2)
  113. + {
  114. + System.out.println("[AIO System]: invalid config property in players.properties -> AioSkills \"" + skill + "\"");
  115. + }
  116. + else
  117. + {
  118. + try
  119. + {
  120. + AIO_SKILLS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
  121. + }
  122. + catch (NumberFormatException nfe)
  123. + {
  124. + if (!skill.equals(""))
  125. + {
  126. + System.out.println("[AIO System]: invalid config property in players.props -> AioSkills \"" + skillSplit[0] + "\"" + skillSplit[1]);
  127. + }
  128. + }
  129. + }
  130. + }
  131. + }
  132.  
  133. // Access levels
  134. Properties accessLevelSettings = new Properties();
  135. diff --git a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  136. index 60113c2..3aaf6b7 100644
  137. --- a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  138. +++ b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  139. @@ -20,6 +20,7 @@
  140.  
  141. import net.sf.l2j.Config;
  142. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
  143. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
  144. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
  145. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBBS;
  146. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
  147. @@ -97,6 +98,7 @@
  148.  
  149. public void load()
  150. {
  151. + registerAdminCommandHandler(new AdminAio());
  152. registerAdminCommandHandler(new AdminVip());
  153. registerAdminCommandHandler(new AdminAdmin());
  154. registerAdminCommandHandler(new AdminInvul());
  155. diff --git a/java/net/sf/l2j/gameserver/handler/ItemHandler.java b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  156. index 207e629..56ce4e0 100644
  157. --- a/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  158. +++ b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  159. @@ -18,6 +18,7 @@
  160. import java.util.Map;
  161. import java.util.logging.Logger;
  162.  
  163. +import net.sf.l2j.gameserver.handler.itemhandlers.AioItem;
  164. import net.sf.l2j.gameserver.handler.itemhandlers.BeastSoulShot;
  165. import net.sf.l2j.gameserver.handler.itemhandlers.BeastSpice;
  166. import net.sf.l2j.gameserver.handler.itemhandlers.BeastSpiritShot;
  167. @@ -79,6 +80,7 @@
  168.  
  169. public void load()
  170. {
  171. + registerItemHandler(new AioItem());
  172. registerItemHandler(new VipCoin());
  173. registerItemHandler(new ScrollOfEscape());
  174. registerItemHandler(new ScrollOfResurrection());
  175. diff --git a/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java
  176. new file mode 100644
  177. index 0000000..4fd9b60
  178. --- /dev/null
  179. +++ b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java
  180. @@ -0,0 +1,225 @@
  181. +/*
  182. + * This program is free software; you can redistribute it and/or modify
  183. + * it under the terms of the GNU General Public License as published by
  184. + * the Free Software Foundation; either version 2, or (at your option)
  185. + * any later version.
  186. + *
  187. + * This program is distributed in the hope that it will be useful,
  188. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  189. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  190. + * GNU General Public License for more details.
  191. + *
  192. + * You should have received a copy of the GNU General Public License
  193. + * along with this program; if not, write to the Free Software
  194. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  195. + * 02111-1307, USA.
  196. + *
  197. + * http://www.gnu.org/copyleft/gpl.html
  198. + */
  199. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  200. +
  201. +import java.sql.Connection;
  202. +import java.sql.PreparedStatement;
  203. +import java.util.StringTokenizer;
  204. +import java.util.logging.Level;
  205. +import java.util.logging.Logger;
  206. +
  207. +import net.sf.l2j.Config;
  208. +import net.sf.l2j.L2DatabaseFactory;
  209. +import net.sf.l2j.gameserver.datatables.GmListTable;
  210. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  211. +import net.sf.l2j.gameserver.model.L2Object;
  212. +import net.sf.l2j.gameserver.model.L2World;
  213. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  214. +import net.sf.l2j.gameserver.network.clientpackets.Say2;
  215. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  216. +
  217. +
  218. +public class AdminAio implements IAdminCommandHandler
  219. +{
  220. + private static String[] _adminCommands = { "admin_setaio2", "admin_removeaio2" };
  221. + private final static Logger _log = Logger.getLogger(AdminAio.class.getName());
  222. +
  223. + @Override
  224. + public boolean useAdminCommand(String command, L2PcInstance activeChar)
  225. + {
  226. + if (command.startsWith("admin_setaio2"))
  227. + {
  228. + StringTokenizer str = new StringTokenizer(command);
  229. +
  230. + L2Object target = activeChar.getTarget();
  231. + L2PcInstance player = null;
  232. +
  233. + if (target != null && target instanceof L2PcInstance)
  234. + player = (L2PcInstance)target;
  235. + else
  236. + player = activeChar;
  237. +
  238. + try
  239. + {
  240. + str.nextToken();
  241. + String time = str.nextToken();
  242. + if (str.hasMoreTokens())
  243. + {
  244. + String playername = time;
  245. + time = str.nextToken();
  246. + player = L2World.getInstance().getPlayer(playername);
  247. + doAio(activeChar, player, playername, time);
  248. + }
  249. + else
  250. + {
  251. + String playername = player.getName();
  252. + doAio(activeChar, player, playername, time);
  253. + }
  254. + }
  255. + catch(Exception e)
  256. + {
  257. + activeChar.sendMessage("Usage: //setaio <char_name> [time](in days)");
  258. + }
  259. +
  260. + player.broadcastUserInfo();
  261. +
  262. + if(player.isAio())
  263. + return true;
  264. + }
  265. + else if(command.startsWith("admin_removeaio2"))
  266. + {
  267. + StringTokenizer str = new StringTokenizer(command);
  268. +
  269. + L2Object target = activeChar.getTarget();
  270. + L2PcInstance player = null;
  271. +
  272. + if (target instanceof L2PcInstance)
  273. + player = (L2PcInstance)target;
  274. + else
  275. + player = activeChar;
  276. +
  277. + try
  278. + {
  279. + str.nextToken();
  280. +
  281. + if (str.hasMoreTokens())
  282. + {
  283. + String playername = str.nextToken();
  284. + player = L2World.getInstance().getPlayer(playername);
  285. + removeAio(activeChar, player, playername);
  286. + }
  287. + else
  288. + {
  289. + String playername = player.getName();
  290. + removeAio(activeChar, player, playername);
  291. + }
  292. + }
  293. + catch(Exception e)
  294. + {
  295. + activeChar.sendMessage("Usage: //removeaio <char_name>");
  296. + }
  297. +
  298. + player.broadcastUserInfo();
  299. +
  300. + if(player.isAio())
  301. + return false;
  302. + }
  303. + return false;
  304. + }
  305. +
  306. + public void doAio(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time)
  307. + {
  308. + int days = Integer.parseInt(_time);
  309. +
  310. + if (_player == null)
  311. + {
  312. + activeChar.sendMessage("Character not found.");
  313. + return;
  314. + }
  315. + if (_player.isAio())
  316. + {
  317. + activeChar.sendMessage("Player " + _playername + " is already an AIO.");
  318. + return;
  319. + }
  320. +
  321. + if(days > 0)
  322. + {
  323. + _player.lostAioSkills();
  324. + _player.setAio(true);
  325. + _player.setEndTime("aio", days);
  326. + _player.sendPacket(new CreatureSay(0,Say2.HERO_VOICE,"System","Dear player, you are now an AIO, congratulations."));
  327. +
  328. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  329. + {
  330. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET aio=1, aio_end=? WHERE obj_id=?");
  331. + statement.setLong(1, _player.getAioEndTime());
  332. + statement.setInt(2, _player.getObjectId());
  333. + statement.execute();
  334. + statement.close();
  335. +
  336. + if(Config.ALLOW_AIO_NCOLOR)
  337. + _player.getAppearance().setNameColor(Config.AIO_NCOLOR);
  338. +
  339. + if(Config.ALLOW_AIO_TCOLOR)
  340. + _player.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  341. +
  342. + _player.rewardAioSkills();
  343. +
  344. + if(Config.ALLOW_AIO_ITEM)
  345. + {
  346. + _player.getInventory().addItem("", Config.AIO_ITEMID, 1, _player, null);
  347. + _player.getInventory().equipItem(_player.getInventory().getItemByItemId(Config.AIO_ITEMID));
  348. +
  349. + }
  350. + _player.broadcastUserInfo();
  351. + _player.sendSkillList();
  352. +
  353. + GmListTable.broadcastMessageToGMs("GM "+ activeChar.getName()+ " set an AIO status for player "+ _playername + " for " + _time + " day(s)");
  354. + }
  355. + catch (Exception e)
  356. + {
  357. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  358. + }
  359. + }
  360. + }
  361. +
  362. + public void removeAio(L2PcInstance activeChar, L2PcInstance _player, String _playername)
  363. + {
  364. + if (!_player.isAio())
  365. + {
  366. + activeChar.sendMessage("Player " + _playername + " is not an AIO.");
  367. + return;
  368. + }
  369. +
  370. + _player.setAio(false);
  371. + _player.setAioEndTime(0);
  372. +
  373. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  374. + {
  375. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET Aio=0, Aio_end=0 WHERE obj_id=?");
  376. + statement.setInt(1, _player.getObjectId());
  377. + statement.execute();
  378. + statement.close();
  379. +
  380. + _player.lostAioSkills();
  381. +
  382. + if(Config.ALLOW_AIO_ITEM)
  383. + {
  384. + _player.getInventory().destroyItemByItemId("", Config.AIO_ITEMID, 1, _player, null);
  385. + _player.getWarehouse().destroyItemByItemId("", Config.AIO_ITEMID, 1, _player, null);
  386. + }
  387. + _player.getAppearance().setNameColor(0xFFFF77);
  388. + _player.getAppearance().setTitleColor(0xFFFF77);
  389. + _player.broadcastUserInfo();
  390. + _player.sendSkillList();
  391. +
  392. + GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed AIO status of player "+ _playername);
  393. + }
  394. + catch (Exception e)
  395. + {
  396. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  397. + }
  398. + }
  399. +
  400. + @Override
  401. + public String[] getAdminCommandList()
  402. + {
  403. + return _adminCommands;
  404. + }
  405. +}
  406. \ No newline at end of file
  407. diff --git a/java/net/sf/l2j/gameserver/handler/itemhandlers/AioItem.java b/java/net/sf/l2j/gameserver/handler/itemhandlers/AioItem.java
  408. new file mode 100644
  409. index 0000000..87e8fc9
  410. --- /dev/null
  411. +++ b/java/net/sf/l2j/gameserver/handler/itemhandlers/AioItem.java
  412. @@ -0,0 +1,205 @@
  413. +package net.sf.l2j.gameserver.handler.itemhandlers;
  414. +
  415. +import java.util.Calendar;
  416. +
  417. +import net.sf.l2j.Config;
  418. +import net.sf.l2j.gameserver.handler.IItemHandler;
  419. +import net.sf.l2j.gameserver.model.L2Character;
  420. +import net.sf.l2j.gameserver.model.L2ItemInstance;
  421. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  422. +import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
  423. +import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
  424. +
  425. +
  426. +
  427. +/**
  428. + *
  429. + * @author Computer Sarada
  430. + *
  431. + */
  432. +public class AioItem implements IItemHandler
  433. +{
  434. + private static final int ITEM_IDS[] = { Config.AIO_ITEM, Config.AIO_ITEM2, Config.AIO_ITEM3};
  435. +
  436. + @Override
  437. + public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  438. + {
  439. + if (!(playable instanceof L2PcInstance))
  440. + return;
  441. +
  442. + L2PcInstance activeChar = (L2PcInstance)playable;
  443. +
  444. + int itemId = item.getItemId();
  445. +
  446. + if (itemId == Config.AIO_ITEM)
  447. + {
  448. + if (activeChar.isInOlympiadMode())
  449. + {
  450. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  451. + return;
  452. + }
  453. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE))
  454. + {
  455. + activeChar.sendMessage("You can only use this item in peace zone..");
  456. + return;
  457. + }
  458. + else if (activeChar.isAio())
  459. + {
  460. + activeChar.sendMessage("You Are Aio!.");
  461. + return;
  462. + }
  463. + else if (activeChar.isVip())
  464. + {
  465. + activeChar.sendMessage("You Use In Vip!.");
  466. + return;
  467. + }
  468. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  469. + {
  470. + if (activeChar.isAio())
  471. + {
  472. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  473. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS));
  474. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS + " day of AIO.");
  475. + }
  476. + else
  477. + {
  478. + activeChar.setAio(true);
  479. + activeChar.setEndTime("aio", Config.AIO_DIAS);
  480. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS + " day.");
  481. + }
  482. +
  483. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  484. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  485. +
  486. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  487. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  488. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(79));
  489. + activeChar.rewardAioSkills();
  490. + if(Config.ALLOW_AIO_ITEM)
  491. + {
  492. + activeChar.getInventory().addItem("", Config.AIO_ITEMID, 1, activeChar, null);
  493. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(Config.AIO_ITEMID));
  494. +
  495. + }
  496. +
  497. + activeChar.broadcastUserInfo();
  498. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  499. + }
  500. + }
  501. +
  502. + else if (itemId == Config.AIO_ITEM2)
  503. + {
  504. + if (activeChar.isInOlympiadMode())
  505. + {
  506. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  507. + return;
  508. + }
  509. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  510. + activeChar.sendMessage("You can only use this item in peace zone..");
  511. + return;
  512. + }
  513. + else if (activeChar.isAio())
  514. + {
  515. + activeChar.sendMessage("You Are Aio!.");
  516. + return;
  517. + }
  518. + else if (activeChar.isVip())
  519. + {
  520. + activeChar.sendMessage("You Use In Vip!.");
  521. + return;
  522. + }
  523. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  524. + {
  525. + if (activeChar.isAio())
  526. + {
  527. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  528. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS2));
  529. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS2 + " day of AIO.");
  530. + }
  531. + else
  532. + {
  533. + activeChar.setAio(true);
  534. + activeChar.setEndTime("aio", Config.AIO_DIAS2);
  535. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS2 + " day.");
  536. + }
  537. +
  538. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  539. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  540. +
  541. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  542. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  543. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(79));
  544. + activeChar.rewardAioSkills();
  545. + if(Config.ALLOW_AIO_ITEM)
  546. + {
  547. + activeChar.getInventory().addItem("", Config.AIO_ITEMID, 1, activeChar, null);
  548. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(Config.AIO_ITEMID));
  549. +
  550. + }
  551. + activeChar.broadcastUserInfo();
  552. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  553. + }
  554. + }
  555. +
  556. + else if (itemId == Config.AIO_ITEM3)
  557. + {
  558. + if (activeChar.isInOlympiadMode())
  559. + {
  560. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  561. + return;
  562. + }
  563. + else if (activeChar.isAio())
  564. + {
  565. + activeChar.sendMessage("You Are Aio!.");
  566. + return;
  567. + }
  568. + else if (activeChar.isVip())
  569. + {
  570. + activeChar.sendMessage("You Use In Vip!.");
  571. + return;
  572. + }
  573. + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  574. + activeChar.sendMessage("You can only use this item in peace zone..");
  575. + return;
  576. + }
  577. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  578. + {
  579. + if (activeChar.isAio())
  580. + {
  581. + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  582. + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS3));
  583. + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS3 + " day of AIO.");
  584. + }
  585. + else
  586. + {
  587. + activeChar.setAio(true);
  588. + activeChar.setEndTime("aio", Config.AIO_DIAS3);
  589. + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS3 + " day.");
  590. + }
  591. +
  592. + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  593. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  594. +
  595. + if(Config.ALLOW_AIO_ITEM)
  596. + {
  597. + activeChar.getInventory().addItem("", Config.AIO_ITEMID, 1, activeChar, null);
  598. + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(Config.AIO_ITEMID));
  599. +
  600. + }
  601. + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  602. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  603. + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(79));
  604. + activeChar.rewardAioSkills();
  605. +
  606. + activeChar.broadcastUserInfo();
  607. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  608. + }
  609. + }
  610. + }
  611. +
  612. + @Override
  613. + public int[] getItemIds()
  614. + {
  615. + return ITEM_IDS;
  616. + }
  617. +}
  618. diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java b/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
  619. index 55d7862..aa17768 100644
  620. --- a/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
  621. +++ b/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
  622. @@ -59,6 +59,11 @@
  623. @Override
  624. public void onBypassFeedback(L2PcInstance player, String command)
  625. {
  626. + if (player.isAio() && !Config.ALLOW_AIO_USE_CM)
  627. + {
  628. + player.sendMessage("Aio Buffers Can't Speak To Class Masters.");
  629. + return;
  630. + }
  631. if (command.startsWith("1stClass"))
  632. {
  633. showHtmlMenu(player, getObjectId(), 1);
  634. diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java b/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  635. index 62335b8..ede6cda 100644
  636. --- a/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  637. +++ b/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  638. @@ -227,8 +227,8 @@
  639. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  640.  
  641. private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,clan_privs,wantspeace,base_class,nobless,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  642. - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,aio_buffer=?,newbie_at=?,char_name=?, vip=?,vip_end=? WHERE obj_Id=?";
  643. - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, name_color, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, clan_join_expiry_time, clan_create_expiry_time, base_class, onlinetime, in_jail, jail_timer, nobless, last_recom_date, varka_ketra_ally, aio_buffer, newbie_at, vip,vip_end FROM characters WHERE obj_Id=?";
  644. + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,aio_buffer=?,newbie_at=?,char_name=?, vip=?,vip_end=?, aio=?,aio_end=? WHERE obj_Id=?";
  645. + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, name_color, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, clan_join_expiry_time, clan_create_expiry_time, base_class, onlinetime, in_jail, jail_timer, nobless, last_recom_date, varka_ketra_ally, aio_buffer, newbie_at, vip,vip_end, aio,aio_end FROM characters WHERE obj_Id=?";
  646. private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  647. private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  648. private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
  649. @@ -440,6 +440,9 @@
  650. /** VIP System */
  651. private boolean _isVip = false;
  652. private long _vip_endTime = 0;
  653. + /** AIO System */
  654. + private boolean _isAio = false;
  655. + private long _aio_endTime = 0;
  656. private ClassId _skillLearningClassId;
  657.  
  658. // Hennas
  659. @@ -6564,6 +6567,8 @@
  660. player.setNewbieAt(rset.getLong("newbie_at"));
  661. player.setVip(rset.getInt("vip") == 1 ? true : false);
  662. player.setVipEndTime(rset.getLong("vip_end"));
  663. + player.setAio(rset.getInt("aio") == 1 ? true : false);
  664. + player.setAioEndTime(rset.getLong("aio_end"));
  665.  
  666. // Set the x,y,z position of the L2PcInstance and make it invisible
  667. player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
  668. @@ -6913,6 +6918,8 @@
  669. statement.setString(++i, getName());
  670. statement.setInt(++i, isVip() ? 1 : 0);
  671. statement.setLong(++i, getVipEndTime());
  672. + statement.setInt(++i, isAio() ? 1 : 0);
  673. + statement.setLong(++i, getAioEndTime());
  674. statement.setInt(++i, getObjectId());
  675. statement.execute();
  676. }
  677. @@ -7091,8 +7098,72 @@
  678. _log.warning("Could not store char effect data: " + e);
  679. }
  680. }
  681. + /**
  682. + * Aio System Start.
  683. + * @return true, if is aio
  684. + */
  685. + public boolean isAio()
  686. + {
  687. + return _isAio;
  688. + }
  689.  
  690. /**
  691. + * Sets the aio.
  692. + * @param val the new aio
  693. + */
  694. + public void setAio(boolean val)
  695. + {
  696. + _isAio = val;
  697. +
  698. + }
  699. + /**
  700. + * Reward aio skills.
  701. + */
  702. + public void rewardAioSkills()
  703. + {
  704. + L2Skill skill;
  705. + for (final Integer skillid : Config.AIO_SKILLS.keySet())
  706. + {
  707. + final int skilllvl = Config.AIO_SKILLS.get(skillid);
  708. + skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
  709. + if (skill != null)
  710. + {
  711. + addSkill(skill, true);
  712. + }
  713. + }
  714. + sendMessage("GM give to you Aio's skills");
  715. + }
  716. +
  717. + /**
  718. + * Lost aio skills.
  719. + */
  720. + public void lostAioSkills()
  721. + {
  722. + L2Skill skill;
  723. + for (final Integer skillid : Config.AIO_SKILLS.keySet())
  724. + {
  725. + final int skilllvl = Config.AIO_SKILLS.get(skillid);
  726. + skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
  727. + removeSkill(skill);
  728. + }
  729. + }
  730. + /**
  731. + * Sets the aio end time.
  732. + * @param val the new aio end time
  733. + */
  734. + public void setAioEndTime(long val)
  735. + {
  736. + _aio_endTime = val;
  737. + }
  738. + /**
  739. + * Gets the aio end time.
  740. + * @return the aio end time
  741. + */
  742. + public long getAioEndTime()
  743. + {
  744. + return _aio_endTime;
  745. + }
  746. + /**
  747. * Return True if the L2PcInstance is on line.<BR>
  748. * <BR>
  749. * @return
  750. @@ -7128,6 +7199,8 @@
  751.  
  752. if(process.equals("vip"))
  753. _vip_endTime = end_day;
  754. + if(process.equals("aio"))
  755. + _aio_endTime = end_day;
  756. }
  757. /**
  758. * Add a skill to the L2PcInstance _skills and its Func objects to the calculator set of the L2PcInstance and save update in the character_skills table of the database.<BR>
  759. diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java b/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  760. index 8e9f755..b2cbfb7 100644
  761. --- a/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  762. +++ b/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  763. @@ -65,7 +65,11 @@
  764. String cmdParams = "";
  765.  
  766. if (commandStr.length >= 2) cmdParams = commandStr[1];
  767. -
  768. + if (player.isAio() && !Config.ALLOW_AIO_USE_CM)
  769. + {
  770. + player.sendMessage("Aio Buffers Can't Speak To Village Masters.");
  771. + return;
  772. + }
  773. if (actualCommand.equalsIgnoreCase("create_clan"))
  774. {
  775. if (cmdParams.isEmpty())
  776. diff --git a/java/net/sf/l2j/gameserver/model/eventgame/TvTEvent.java b/java/net/sf/l2j/gameserver/model/eventgame/TvTEvent.java
  777. index 264e100..e7e2060 100644
  778. --- a/java/net/sf/l2j/gameserver/model/eventgame/TvTEvent.java
  779. +++ b/java/net/sf/l2j/gameserver/model/eventgame/TvTEvent.java
  780. @@ -21,6 +21,7 @@
  781. import java.util.concurrent.ScheduledFuture;
  782. import java.util.logging.Logger;
  783.  
  784. +import net.sf.l2j.Config;
  785. import net.sf.l2j.gameserver.Announcements;
  786. import net.sf.l2j.gameserver.ThreadPoolManager;
  787. import net.sf.l2j.gameserver.datatables.DoorTable;
  788. @@ -613,7 +614,10 @@
  789. player.sendMessage("TvT Registration is not in progress.");
  790. return;
  791. }
  792. -
  793. + if (player.isAio() && !Config.ALLOW_AIO_IN_EVENTS)
  794. + {
  795. + player.sendMessage("AIO charactes are not allowed to participate in events :/");
  796. + }
  797. if (player.isFestivalParticipant())
  798. {
  799. player.sendMessage("Festival participants cannot register to the event.");
  800. diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  801. index 00f8a9d..ff5f296 100644
  802. --- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  803. +++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  804. @@ -248,6 +248,17 @@
  805. {
  806. Broadcast.gameAnnounceToOnlinePlayers("The Hero Player "+activeChar.getName()+" Is Online!");
  807. }
  808. +
  809. +
  810. + if(activeChar.isAio())
  811. + onEnterAio(activeChar);
  812. +
  813. + if(Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
  814. + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
  815. +
  816. + if(Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
  817. + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
  818. +
  819. if(activeChar.isVip())
  820. onEnterVip(activeChar);
  821.  
  822. @@ -349,6 +360,30 @@
  823. activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime());
  824. }
  825.  
  826. + private static void onEnterAio(L2PcInstance activeChar)
  827. + {
  828. + long now = Calendar.getInstance().getTimeInMillis();
  829. + long endDay = activeChar.getAioEndTime();
  830. + if(now > endDay)
  831. + {
  832. + activeChar.setAio(false);
  833. + activeChar.setAioEndTime(0);
  834. + activeChar.lostAioSkills();
  835. + if(Config.ALLOW_AIO_ITEM)
  836. + {
  837. + activeChar.getInventory().destroyItemByItemId("", Config.AIO_ITEMID, 1, activeChar, null);
  838. + activeChar.getWarehouse().destroyItemByItemId("", Config.AIO_ITEMID, 1, activeChar, null);
  839. + }
  840. + activeChar.sendPacket(new CreatureSay(0,Say2.PARTY,"System","Your AIO period ends."));
  841. + }
  842. + else
  843. + {
  844. + Date dt = new Date(endDay);
  845. + if(activeChar.isAio())
  846. + activeChar.sendMessage("Your AIO period ends at: " + dt);
  847. + }
  848. + }
  849. +
  850. private static void onEnterVip(L2PcInstance activeChar)
  851. {
  852. long now = Calendar.getInstance().getTimeInMillis();
  853.  
  854.  
  855.  
  856.  
  857. SQL E DATAPACK
  858.  
  859. <command name="admin_setaio2" val="100"/>
  860. <command name="admin_removeaio2" val="100"/>
  861.  
  862. ALTER TABLE `characters` ADD COLUMN `aio` decimal(1,0) NOT NULL DEFAULT 0 AFTER `vip_end`;
  863. ALTER TABLE `characters` ADD COLUMN `aio_end` decimal(20,0) NOT NULL DEFAULT 0 AFTER `aio`;
Add Comment
Please, Sign In to add comment