criss28282

Untitled

Jun 15th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.11 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package l2r.gameserver.communitybbs.Managers;
  20.  
  21. import java.io.File;
  22. import java.util.List;
  23. import java.util.StringTokenizer;
  24.  
  25. import l2r.gameserver.GameTimeController;
  26. import l2r.gameserver.ThreadPoolManager;
  27. import l2r.gameserver.cache.HtmCache;
  28. import l2r.gameserver.communitybbs.BoardsManager;
  29. import l2r.gameserver.data.sql.CharNameTable;
  30. import l2r.gameserver.data.sql.ClanTable;
  31. import l2r.gameserver.data.xml.impl.HennaData;
  32. import l2r.gameserver.data.xml.impl.ItemData;
  33. import l2r.gameserver.data.xml.impl.MultisellData;
  34. import l2r.gameserver.enums.CtrlIntention;
  35. import l2r.gameserver.enums.ZoneIdType;
  36. import l2r.gameserver.instancemanager.SiegeManager;
  37. import l2r.gameserver.instancemanager.TownManager;
  38. import l2r.gameserver.model.Elementals;
  39. import l2r.gameserver.model.actor.instance.L2PcInstance;
  40. import l2r.gameserver.model.entity.olympiad.OlympiadManager;
  41. import l2r.gameserver.model.itemcontainer.Inventory;
  42. import l2r.gameserver.model.items.L2Henna;
  43. import l2r.gameserver.model.items.instance.L2ItemInstance;
  44. import l2r.gameserver.network.SystemMessageId;
  45. import l2r.gameserver.network.serverpackets.ActionFailed;
  46. import l2r.gameserver.network.serverpackets.ExBuyList;
  47. import l2r.gameserver.network.serverpackets.ExBuySellList;
  48. import l2r.gameserver.network.serverpackets.ExShowVariationCancelWindow;
  49. import l2r.gameserver.network.serverpackets.ExShowVariationMakeWindow;
  50. import l2r.gameserver.network.serverpackets.HennaEquipList;
  51. import l2r.gameserver.network.serverpackets.HennaRemoveList;
  52. import l2r.gameserver.network.serverpackets.InventoryUpdate;
  53. import l2r.gameserver.network.serverpackets.MagicSkillUse;
  54. import l2r.gameserver.network.serverpackets.PartySmallWindowAll;
  55. import l2r.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
  56. import l2r.gameserver.network.serverpackets.SetupGauge;
  57. import l2r.gameserver.network.serverpackets.ShowBoard;
  58. import l2r.gameserver.network.serverpackets.WareHouseDepositList;
  59. import l2r.gameserver.util.Broadcast;
  60. import l2r.gameserver.util.Util;
  61.  
  62. import gr.sr.configsEngine.configs.impl.CommunityServicesConfigs;
  63. import gr.sr.configsEngine.configs.impl.IndividualVoteSystemConfigs;
  64. import gr.sr.interf.SunriseEvents;
  65. import gr.sr.javaBuffer.AutoBuff;
  66. import gr.sr.javaBuffer.BufferPacketCategories;
  67. import gr.sr.javaBuffer.BufferPacketSender;
  68. import gr.sr.javaBuffer.JavaBufferBypass;
  69. import gr.sr.javaBuffer.PlayerMethods;
  70. import gr.sr.javaBuffer.buffCommunity.dynamicHtmls.GenerateHtmls;
  71. import gr.sr.javaBuffer.runnable.BuffDeleter;
  72. import gr.sr.main.Conditions;
  73. import gr.sr.main.TopListsLoader;
  74. import gr.sr.securityEngine.SecurityActions;
  75. import gr.sr.securityEngine.SecurityType;
  76. import gr.sr.voteEngine.old.VoteHandler;
  77.  
  78. /**
  79. * @author L2jSunrise Team
  80. * @Website www.l2jsunrise.com
  81. */
  82. public class ServicesBBSManager extends BaseBBSManager
  83. {
  84. public String _servicesBBSCommand = CommunityServicesConfigs.BYPASS_COMMAND;
  85.  
  86. @Override
  87. public void cbByPass(String command, L2PcInstance activeChar)
  88. {
  89. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_ALLOW)
  90. {
  91. activeChar.sendMessage("This function is disabled by admin.");
  92. return;
  93. }
  94.  
  95. String path = "data/html/CommunityBoard/services/";
  96. String filepath = "";
  97. String content = "";
  98.  
  99. if (command.equals(_servicesBBSCommand + ""))
  100. {
  101. BoardsManager.getInstance().addBypass(activeChar, "Service Command", command);
  102. filepath = path + "main.htm";
  103. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), filepath);
  104. separateAndSend(content, activeChar);
  105. }
  106. else if (command.startsWith(_servicesBBSCommand + ";gatekeeper"))
  107. {
  108. BoardsManager.getInstance().addBypass(activeChar, "Service Gatekeeper", command);
  109. StringTokenizer st = new StringTokenizer(command, ";");
  110. st.nextToken();
  111. st.nextToken();
  112. String file = st.nextToken();
  113. path = "data/html/CommunityBoard/services/gatekeeper/";
  114. sendHtm(activeChar, filepath, path, file, command);
  115. }
  116. else if (command.startsWith(_servicesBBSCommand + ";"))
  117. {
  118. StringTokenizer st = new StringTokenizer(command, ";");
  119. st.nextToken();
  120. String file = st.nextToken();
  121. sendHtm(activeChar, filepath, path, file, command);
  122. }
  123. else if (command.startsWith(_servicesBBSCommand + "_sendMultisell"))
  124. {
  125. BoardsManager.getInstance().addBypass(activeChar, "Service Multisell", command);
  126. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_SHOP_ALLOW)
  127. {
  128. activeChar.sendMessage("This function is disabled by admin.");
  129. return;
  130. }
  131.  
  132. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_SHOP_NONPEACE && !activeChar.isInsideZone(ZoneIdType.PEACE))
  133. {
  134. activeChar.sendMessage("You cannot use this function outside peace zone.");
  135. }
  136. else
  137. {
  138. try
  139. {
  140. String multisell = commandSeperator(command);
  141. int multi = Integer.valueOf(multisell);
  142.  
  143. switch (multi)
  144. {
  145. case 90525:
  146. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/symbolMaker.htm");
  147. break;
  148. case 90526:
  149. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/warehouse.htm");
  150. break;
  151. case 90539:
  152. case 90540:
  153. case 90541:
  154. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop.htm");
  155. break;
  156. default:
  157. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/gmshop.htm");
  158. break;
  159. }
  160.  
  161. if ((multi == 90527) || (multi == 90528) || (multi == 90529) || (multi == 90530) || (multi == 90531) || (multi == 90532) || (multi == 90533) || (multi == 90534) || (multi == 90535) || (multi == 90536) || (multi == 90537) || (multi == 90538))
  162. {
  163. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/blacksmith.htm");
  164. }
  165.  
  166. separateAndSend(content, activeChar);
  167.  
  168. if (CommunityServicesConfigs.MULTISELL_LIST.contains(multi))
  169. {
  170. activeChar.setIsUsingAioMultisell(true);
  171. MultisellData.getInstance().separateAndSend(multi, activeChar, null, false);
  172. }
  173. else
  174. {
  175. SecurityActions.startSecurity(activeChar, SecurityType.COMMUNITY_SYSTEM);
  176. }
  177. }
  178. catch (Exception e)
  179. {
  180. SecurityActions.startSecurity(activeChar, SecurityType.COMMUNITY_SYSTEM);
  181. }
  182. }
  183. }
  184. else if (command.startsWith(_servicesBBSCommand + "_CommunitySell"))
  185. {
  186. BoardsManager.getInstance().addBypass(activeChar, "Service Sell", command);
  187. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/gmshop.htm");
  188. separateAndSend(content, activeChar);
  189.  
  190. activeChar.setIsUsingAioMultisell(true);
  191. activeChar.sendPacket(new ExBuyList(activeChar));
  192. activeChar.sendPacket(new ExBuySellList(activeChar, 0, true));
  193. }
  194. else if (command.startsWith(_servicesBBSCommand + "_teleport"))
  195. {
  196. BoardsManager.getInstance().addBypass(activeChar, "Service Teleport", command);
  197. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/gatekeeper/main_gk.htm");
  198. separateAndSend(content, activeChar);
  199.  
  200. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_TP_ALLOW)
  201. {
  202. activeChar.sendMessage("This function is disabled by admin.");
  203. return;
  204. }
  205.  
  206. if (activeChar.isJailed() || activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || SunriseEvents.isInEvent(activeChar) || OlympiadManager.getInstance().isRegistered(activeChar))
  207. {
  208. activeChar.sendMessage("Cannot use at the moment.");
  209. return;
  210. }
  211.  
  212. try
  213. {
  214. String tp = commandSeperator(command);
  215. Integer[] c = new Integer[3];
  216. c[0] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[0];
  217. c[1] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[1];
  218. c[2] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[2];
  219. boolean onlyForNobless = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[3] == 1;
  220. int itemIdToGet = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[4];
  221. int price = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[5];
  222.  
  223. if (!CommunityServicesConfigs.ALLOW_TELEPORT_DURING_SIEGE)
  224. {
  225. if (SiegeManager.getInstance().getSiege(c[0], c[1], c[2]) != null)
  226. {
  227. activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
  228. return;
  229. }
  230. else if (TownManager.townHasCastleInSiege(c[0], c[1]) && activeChar.isInsideZone(ZoneIdType.TOWN))
  231. {
  232. activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
  233. return;
  234. }
  235. }
  236.  
  237. if (Conditions.checkPlayerItemCount(activeChar, itemIdToGet, price))
  238. {
  239. if (onlyForNobless && !activeChar.isNoble() && !activeChar.isGM())
  240. {
  241. activeChar.sendMessage("Only noble chars can teleport there.");
  242. return;
  243. }
  244.  
  245. if (activeChar.isTransformed())
  246. {
  247. if ((activeChar.getTransformationId() == 9) || (activeChar.getTransformationId() == 8))
  248. {
  249. activeChar.untransform();
  250. }
  251. }
  252.  
  253. if (activeChar.isInsideZone(ZoneIdType.PEACE) || activeChar.isGM())
  254. {
  255. activeChar.setInstanceId(0);
  256. activeChar.teleToLocation(c[0], c[1], c[2]);
  257. }
  258. else
  259. {
  260. activeChar.abortCast();
  261. activeChar.abortAttack();
  262. activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  263. activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  264. activeChar.setTarget(activeChar);
  265. activeChar.disableAllSkills();
  266. Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, 1050, 1, 30000, 0), 810000);
  267. activeChar.sendPacket(new SetupGauge(SetupGauge.BLUE, 30000));
  268. activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(activeChar, c[0], c[1], c[2]), 30000));
  269. activeChar.forceIsCasting(10 + GameTimeController.getInstance().getGameTicks() + (30000 / GameTimeController.MILLIS_IN_TICK));
  270. }
  271.  
  272. activeChar.destroyItemByItemId("Community Teleport", itemIdToGet, price, activeChar, true);
  273. }
  274. }
  275. catch (Exception e)
  276. {
  277. SecurityActions.startSecurity(activeChar, SecurityType.COMMUNITY_SYSTEM);
  278. }
  279. }
  280. else if (command.startsWith(_servicesBBSCommand + "_drawSymbol"))
  281. {
  282. BoardsManager.getInstance().addBypass(activeChar, "Service Symbol Add", command);
  283. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/symbolMaker.htm");
  284. separateAndSend(content, activeChar);
  285.  
  286. List<L2Henna> tato = HennaData.getInstance().getHennaList(activeChar.getClassId());
  287. activeChar.sendPacket(new HennaEquipList(activeChar, tato));
  288. }
  289. else if (command.startsWith(_servicesBBSCommand + "_removeSymbol"))
  290. {
  291. BoardsManager.getInstance().addBypass(activeChar, "Service Symbol Remove", command);
  292. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/symbolMaker.htm");
  293. separateAndSend(content, activeChar);
  294.  
  295. boolean hasHennas = false;
  296. for (int i = 1; i <= 3; i++)
  297. {
  298. L2Henna henna = activeChar.getHennaEx().getHenna(i);
  299. if (henna != null)
  300. {
  301. hasHennas = true;
  302. }
  303. }
  304.  
  305. if (hasHennas)
  306. {
  307. activeChar.sendPacket(new HennaRemoveList(activeChar));
  308. }
  309. else
  310. {
  311. activeChar.sendMessage("You do not have dyes.");
  312. }
  313. }
  314. else if (command.startsWith(_servicesBBSCommand + "_addAugment"))
  315. {
  316. BoardsManager.getInstance().addBypass(activeChar, "Service Augment Add", command);
  317. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/blacksmith.htm");
  318. separateAndSend(content, activeChar);
  319.  
  320. activeChar.sendPacket(new ExShowVariationMakeWindow());
  321. }
  322. else if (command.startsWith(_servicesBBSCommand + "_delAugment"))
  323. {
  324. BoardsManager.getInstance().addBypass(activeChar, "Service Augment Remove", command);
  325. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/blacksmith.htm");
  326. separateAndSend(content, activeChar);
  327.  
  328. activeChar.sendPacket(new ExShowVariationCancelWindow());
  329. }
  330. else if (command.toLowerCase().startsWith(_servicesBBSCommand + "_pwithdraw"))
  331. {
  332. BoardsManager.getInstance().addBypass(activeChar, "Service Private Wh Withdraw", command);
  333. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/warehouse.htm");
  334. separateAndSend(content, activeChar);
  335.  
  336. GenerateHtmls.showPWithdrawWindow(activeChar, null, (byte) 0);
  337. }
  338. else if (command.toLowerCase().startsWith(_servicesBBSCommand + "_cwithdraw"))
  339. {
  340. BoardsManager.getInstance().addBypass(activeChar, "Service Clan Wh Withdraw", command);
  341. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/warehouse.htm");
  342. separateAndSend(content, activeChar);
  343.  
  344. GenerateHtmls.showCWithdrawWindow(activeChar, null, (byte) 0);
  345. }
  346. else if (command.startsWith(_servicesBBSCommand + "_ndeposit"))
  347. {
  348. BoardsManager.getInstance().addBypass(activeChar, "Service Private Wh Deposit", command);
  349. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/warehouse.htm");
  350. separateAndSend(content, activeChar);
  351.  
  352. activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  353. activeChar.setActiveWarehouse(activeChar.getWarehouse());
  354. if (activeChar.getWarehouse().getSize() == activeChar.getWareHouseLimit())
  355. {
  356. activeChar.sendPacket(SystemMessageId.WAREHOUSE_FULL);
  357. return;
  358. }
  359. activeChar.setIsUsingAioWh(true);
  360. activeChar.tempInventoryDisable();
  361. activeChar.sendPacket(new WareHouseDepositList(activeChar, WareHouseDepositList.PRIVATE));
  362. }
  363. else if (command.startsWith(_servicesBBSCommand + "_clandeposit"))
  364. {
  365. BoardsManager.getInstance().addBypass(activeChar, "Service Clan Wh Deposit", command);
  366. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/warehouse.htm");
  367. separateAndSend(content, activeChar);
  368.  
  369. if (activeChar.getClan() == null)
  370. {
  371. activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER);
  372. return;
  373. }
  374.  
  375. activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  376. activeChar.setActiveWarehouse(activeChar.getClan().getWarehouse());
  377. if (activeChar.getClan().getLevel() == 0)
  378. {
  379. activeChar.sendPacket(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE);
  380. return;
  381. }
  382.  
  383. activeChar.setIsUsingAioWh(true);
  384. activeChar.setActiveWarehouse(activeChar.getClan().getWarehouse());
  385. activeChar.tempInventoryDisable();
  386. activeChar.sendPacket(new WareHouseDepositList(activeChar, WareHouseDepositList.CLAN));
  387. }
  388. else if (command.startsWith(_servicesBBSCommand + "_washPK"))
  389. {
  390. BoardsManager.getInstance().addBypass(activeChar, "Service Clean Pk", command);
  391. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop_decreasePK.htm");
  392. content = activeChar.getPkKills() > 0 ? content.replaceAll("%replace%", buttons(activeChar)) : content.replaceAll("%replace%", "<table width=750 height=20><tr><td align=center>You dont have PK Points to wash.</td></tr></table>");
  393. separateAndSend(content, activeChar);
  394. }
  395. else if (command.startsWith(_servicesBBSCommand + "_deletePK"))
  396. {
  397. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop_decreasePK.htm");
  398. content = content.replaceAll("%replace%", buttons(activeChar));
  399. separateAndSend(content, activeChar);
  400.  
  401. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_ALLOW)
  402. {
  403. activeChar.sendMessage("This function is disabled by admin.");
  404. return;
  405. }
  406.  
  407. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_NONPEACE && !activeChar.isInsideZone(ZoneIdType.PEACE))
  408. {
  409. activeChar.sendMessage("You cannot use this function outside peace zone.");
  410. }
  411. else
  412. {
  413. int i = Integer.parseInt(commandSeperator(command));
  414. if (Conditions.checkPlayerItemCount(activeChar, CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_PRICE * i))
  415. {
  416. int kills = activeChar.getPkKills();
  417. if ((kills - i) >= 0)
  418. {
  419. activeChar.setPkKills(kills - i);
  420. activeChar.broadcastUserInfo();
  421. activeChar.sendMessage(i + " PK points removed.");
  422. activeChar.destroyItemByItemId("Community Decrease PK", CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_PRICE * i, activeChar, true);
  423. }
  424. }
  425. }
  426. }
  427. else if (command.startsWith(_servicesBBSCommand + "_vote"))
  428. {
  429. if (command.startsWith(_servicesBBSCommand + "_vote_main"))
  430. {
  431. BoardsManager.getInstance().addBypass(activeChar, "Service Vote Main", command);
  432. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/vote.htm");
  433. content = content.replaceAll("%voteBanners%", getVoteBanners(activeChar));
  434. separateAndSend(content, activeChar);
  435. return;
  436. }
  437.  
  438. if (command.contains(" "))
  439. {
  440. final String[] subCommand = command.split(" ");
  441. String site = subCommand[1];
  442.  
  443. BoardsManager.getInstance().addBypass(activeChar, "Service Vote " + site, command);
  444. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/vote.htm");
  445. content = content.replaceAll("%voteBanners%", getVoteBanners(activeChar));
  446. separateAndSend(content, activeChar);
  447.  
  448. if (!VoteHandler.voteChecks(activeChar, site))
  449. {
  450. return;
  451. }
  452.  
  453. VoteHandler.preActivateVoting(activeChar, site);
  454. }
  455. }
  456. else if (command.startsWith(_servicesBBSCommand + "_atrEnchant"))
  457. {
  458. BoardsManager.getInstance().addBypass(activeChar, "Service Attribute Enchant", command);
  459.  
  460. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_MANAGER_ALLOW)
  461. {
  462. activeChar.sendMessage("This function is disabled by admin.");
  463. return;
  464. }
  465.  
  466. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_MANAGER_NONPEACE && !activeChar.isInsideZone(ZoneIdType.PEACE))
  467. {
  468. activeChar.sendMessage("You cannot use this function outside peace zone.");
  469. return;
  470. }
  471.  
  472. int currency = CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_MANAGER_ID;
  473. String currencyName = ItemData.getInstance().getTemplate(currency).getName();
  474. int weaponPrice = CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_MANAGER_PRICE_WEAPON;
  475. int armorPrice = CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_MANAGER_PRICE_ARMOR;
  476. int elementWeaponValue = CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_LVL_FOR_WEAPON;
  477. int elementArmorValue = CommunityServicesConfigs.COMMUNITY_SERVICES_ATTRIBUTE_LVL_FOR_ARMOR;
  478.  
  479. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop_atrEnchant.htm");
  480. content = content.replaceAll("%currency%", ItemData.getInstance().getTemplate(currency).getName());
  481.  
  482. content = content.replaceAll("%weaponCurrency%", String.valueOf(weaponPrice) + " " + currencyName);
  483. content = content.replaceAll("%armorCurrency%", String.valueOf(armorPrice) + " " + currencyName);
  484.  
  485. content = content.replaceAll("%armorAttValue%", String.valueOf(elementArmorValue));
  486. content = content.replaceAll("%weaponAttValue%", String.valueOf(elementWeaponValue));
  487.  
  488. if (command.startsWith(_servicesBBSCommand + "_atrEnchantHtml"))
  489. {
  490. separateAndSend(content, activeChar);
  491. return;
  492. }
  493.  
  494. final String[] subCommand = command.split(" ");
  495. String loc = subCommand[1];
  496. int armorType = 0;
  497.  
  498. switch (loc)
  499. {
  500. case "head":
  501. armorType = Inventory.PAPERDOLL_HEAD;
  502. break;
  503. case "chest":
  504. armorType = Inventory.PAPERDOLL_CHEST;
  505. break;
  506. case "gloves":
  507. armorType = Inventory.PAPERDOLL_GLOVES;
  508. break;
  509. case "feet":
  510. armorType = Inventory.PAPERDOLL_FEET;
  511. break;
  512. case "legs":
  513. armorType = Inventory.PAPERDOLL_LEGS;
  514. break;
  515. case "weapon":
  516. armorType = Inventory.PAPERDOLL_RHAND;
  517. break;
  518. default:
  519. separateAndSend(content, activeChar);
  520. activeChar.sendMessage("You cannot enchant items that are not equipped.");
  521. return;
  522. }
  523.  
  524. String type = subCommand[2];
  525. int typeId = 0;
  526. switch (type)
  527. {
  528. case "Fire":
  529. typeId = 0;
  530. break;
  531. case "Water":
  532. typeId = 1;
  533. break;
  534. case "Wind":
  535. typeId = 2;
  536. break;
  537. case "Earth":
  538. typeId = 3;
  539. break;
  540. case "Holy":
  541. typeId = 4;
  542. break;
  543. case "Dark":
  544. typeId = 5;
  545. break;
  546. default:
  547. separateAndSend(content, activeChar);
  548. activeChar.sendMessage("You cannot enchant the item. Wrong element.");
  549. return;
  550. }
  551.  
  552. if (Conditions.checkPlayerItemCount(activeChar, currency, loc.equals("weapon") ? weaponPrice : armorPrice))
  553. {
  554. L2ItemInstance parmorInstance = activeChar.getInventory().getPaperdollItem(armorType);
  555. if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType))
  556. {
  557. byte elementtoAdd = (byte) typeId;
  558. byte opositeElement = Elementals.getOppositeElement(elementtoAdd);
  559. Elementals oldElement = parmorInstance.getElemental(elementtoAdd);
  560.  
  561. switch (parmorInstance.getItem().getCrystalType())
  562. {
  563. case NONE:
  564. case A:
  565. case B:
  566. case C:
  567. case D:
  568. activeChar.sendMessage("Invalid item grade.");
  569. return;
  570. default:
  571. break;
  572. }
  573.  
  574. if ((parmorInstance.isWeapon() && (parmorInstance.getElementals() != null)) || (parmorInstance.isArmor() && (oldElement != null) && (parmorInstance.getElementals() != null) && (parmorInstance.getElementals().length >= 3)))
  575. {
  576. separateAndSend(content, activeChar);
  577. activeChar.sendPacket(SystemMessageId.ANOTHER_ELEMENTAL_POWER_ALREADY_ADDED);
  578. return;
  579. }
  580.  
  581. if (parmorInstance.isWeapon())
  582. {
  583. if ((oldElement != null) && (oldElement.getValue() >= elementWeaponValue))
  584. {
  585. separateAndSend(content, activeChar);
  586. activeChar.sendMessage("You cannot add same attribute to item!");
  587. return;
  588. }
  589.  
  590. if (parmorInstance.getElementals() != null)
  591. {
  592. for (Elementals elm : parmorInstance.getElementals())
  593. {
  594. if (parmorInstance.isEquipped())
  595. {
  596. parmorInstance.getElemental(elm.getElement()).removeBonus(activeChar);
  597. }
  598. parmorInstance.clearElementAttr(elm.getElement());
  599. }
  600. }
  601. }
  602. else if (parmorInstance.isArmor())
  603. {
  604. if (parmorInstance.getElementals() != null)
  605. {
  606. for (Elementals elm : parmorInstance.getElementals())
  607. {
  608. if (elm.getElement() == opositeElement)
  609. {
  610. separateAndSend(content, activeChar);
  611. activeChar.sendMessage("You cannot add opposite attribute to item!");
  612. return;
  613. }
  614. if ((elm.getElement() == elementtoAdd) && (elm.getValue() >= elementArmorValue))
  615. {
  616. separateAndSend(content, activeChar);
  617. activeChar.sendMessage("You cannot add same attribute to item!");
  618. return;
  619. }
  620. }
  621. }
  622. }
  623.  
  624. activeChar.destroyItemByItemId("Community Attribute Manager", currency, parmorInstance.isWeapon() ? weaponPrice : armorPrice, activeChar, true);
  625. activeChar.getInventory().unEquipItemInSlot(armorType);
  626. parmorInstance.setElementAttr(elementtoAdd, parmorInstance.isWeapon() ? elementWeaponValue : elementArmorValue);
  627. activeChar.getInventory().equipItem(parmorInstance);
  628. activeChar.sendMessage("Successfully added " + subCommand[2] + " attribute to your item.");
  629.  
  630. final InventoryUpdate iu = new InventoryUpdate();
  631. iu.addModifiedItem(parmorInstance);
  632. activeChar.sendInventoryUpdate(iu);
  633. }
  634. else
  635. {
  636. activeChar.sendMessage("You cannot attribute items that are not equipped!");
  637. }
  638. }
  639. separateAndSend(content, activeChar);
  640. }
  641. else if (command.startsWith(_servicesBBSCommand + "_changename"))
  642. {
  643. BoardsManager.getInstance().addBypass(activeChar, "Service Name Change", command);
  644. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop.htm");
  645. separateAndSend(content, activeChar);
  646.  
  647. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_ALLOW)
  648. {
  649. activeChar.sendMessage("This function is disabled by admin.");
  650. return;
  651. }
  652.  
  653. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_NONPEACE && !activeChar.isInsideZone(ZoneIdType.PEACE))
  654. {
  655. activeChar.sendMessage("You cannot use this function outside peace zone.");
  656. }
  657. else
  658. {
  659. try
  660. {
  661. String val = commandSeperator(command);
  662. if (!Util.isAlphaNumeric(val))
  663. {
  664. activeChar.sendMessage("Invalid character name.");
  665. return;
  666. }
  667.  
  668. if (Conditions.checkPlayerItemCount(activeChar, CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_PRICE))
  669. {
  670. if (CharNameTable.getInstance().getIdByName(val) > 0)
  671. {
  672. activeChar.sendMessage("Warning, name " + val + " already exists.");
  673. return;
  674. }
  675.  
  676. activeChar.destroyItemByItemId("Community Name Change", CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_NAME_CHANGE_PRICE, activeChar, true);
  677. activeChar.setName(val);
  678. activeChar.getAppearance().setVisibleName(val);
  679. activeChar.store();
  680. activeChar.sendMessage("Your name has been changed to " + val);
  681. activeChar.broadcastUserInfo();
  682.  
  683. if (activeChar.isInParty())
  684. {
  685. // Delete party window for other party members
  686. activeChar.getParty().broadcastToPartyMembers(activeChar, new PartySmallWindowDeleteAll());
  687. for (L2PcInstance member : activeChar.getParty().getMembers())
  688. {
  689. // And re-add
  690. if (member != activeChar)
  691. {
  692. member.sendPacket(new PartySmallWindowAll(member, activeChar.getParty()));
  693. }
  694. }
  695. }
  696.  
  697. if (activeChar.getClan() != null)
  698. {
  699. activeChar.getClan().broadcastClanStatus();
  700. }
  701. }
  702. }
  703. catch (StringIndexOutOfBoundsException e)
  704. {
  705. activeChar.sendMessage("Player name box cannot be empty.");
  706. }
  707. }
  708. }
  709. // Change clan name
  710. else if (command.startsWith(_servicesBBSCommand + "_changeclanname"))
  711. {
  712. BoardsManager.getInstance().addBypass(activeChar, "Service Clan Name Change", command);
  713. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/exclusiveShop.htm");
  714. separateAndSend(content, activeChar);
  715.  
  716. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_ALLOW)
  717. {
  718. activeChar.sendMessage("This function is disabled by admin.");
  719. return;
  720. }
  721.  
  722. if (!CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_NONPEACE && !activeChar.isInsideZone(ZoneIdType.PEACE))
  723. {
  724. activeChar.sendMessage("You cannot use this function outside peace zone.");
  725. }
  726. else
  727. {
  728. try
  729. {
  730. String val = commandSeperator(command);
  731. if ((activeChar.getClan() == null) || !activeChar.isClanLeader())
  732. {
  733. activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
  734. return;
  735. }
  736.  
  737. if (!Util.isAlphaNumeric(val))
  738. {
  739. activeChar.sendPacket(SystemMessageId.CLAN_NAME_INCORRECT);
  740. return;
  741. }
  742.  
  743. if (Conditions.checkPlayerItemCount(activeChar, CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_PRICE))
  744. {
  745. if (ClanTable.getInstance().getClanByName(val) != null)
  746. {
  747. activeChar.sendMessage("Warning, clan name " + val + " already exists.");
  748. return;
  749. }
  750.  
  751. activeChar.destroyItemByItemId("Community Clan Name Change", CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_ID, CommunityServicesConfigs.COMMUNITY_SERVICES_CLAN_NAME_CHANGE_PRICE, activeChar, true);
  752. activeChar.getClan().setName(val);
  753. activeChar.getClan().updateClanNameInDB();
  754. activeChar.sendMessage("Your clan name has been changed to " + val);
  755. activeChar.broadcastUserInfo();
  756.  
  757. if (activeChar.isInParty())
  758. {
  759. // Delete party window for other party members
  760. activeChar.getParty().broadcastToPartyMembers(activeChar, new PartySmallWindowDeleteAll());
  761. for (L2PcInstance member : activeChar.getParty().getMembers())
  762. {
  763. // And re-add
  764. if (member != activeChar)
  765. {
  766. member.sendPacket(new PartySmallWindowAll(member, activeChar.getParty()));
  767. }
  768. }
  769. }
  770.  
  771. if (activeChar.getClan() != null)
  772. {
  773. activeChar.getClan().broadcastClanStatus();
  774. }
  775. }
  776. }
  777. catch (StringIndexOutOfBoundsException e)
  778. {
  779. activeChar.sendMessage("Clan name box cannot be empty.");
  780. }
  781. }
  782. }
  783. else if (command.startsWith(_servicesBBSCommand + "_buffer"))
  784. {
  785. BoardsManager.getInstance().addBypass(activeChar, "Service Buffer", command);
  786. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/buffer/main.htm");
  787. separateAndSend(content, activeChar);
  788. }
  789. else if (command.startsWith(_servicesBBSCommand + "_functions_buffer"))
  790. {
  791. final String[] subCommand = command.split("_");
  792.  
  793. if (((activeChar.isInCombat() || (activeChar.getPvpFlag() != 0)) && !activeChar.isInsideZone(ZoneIdType.PEACE)) || activeChar.isJailed() || activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || SunriseEvents.isInEvent(activeChar) || OlympiadManager.getInstance().isRegistered(activeChar))
  794. {
  795. activeChar.sendMessage("Cannot use at the moment.");
  796. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/buffer/main.htm");
  797. separateAndSend(content, activeChar);
  798. return;
  799. }
  800.  
  801. // Page navigation, html command how to starts
  802. if (subCommand[4].startsWith("page"))
  803. {
  804. if (subCommand[5].isEmpty() || (subCommand[5] == null))
  805. {
  806. return;
  807. }
  808.  
  809. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/buffer/" + subCommand[5]);
  810. separateAndSend(content, activeChar);
  811. }
  812. // Method to remove all players buffs
  813. else if (subCommand[4].startsWith("removebuff"))
  814. {
  815. activeChar.stopAllEffects();
  816. BufferPacketSender.sendPacket(activeChar, "functions.htm", BufferPacketCategories.COMMUNITY, 1);
  817. }
  818. // Method to restore HP/MP/CP
  819. else if (subCommand[4].startsWith("healme"))
  820. {
  821. BoardsManager.getInstance().addBypass(activeChar, "Service Buffer Heal", command);
  822. if ((activeChar.getPvpFlag() != 0) && !activeChar.isInsideZone(ZoneIdType.PEACE))
  823. {
  824. activeChar.sendMessage("Cannot use this feature here with flag.");
  825. BufferPacketSender.sendPacket(activeChar, "functions.htm", BufferPacketCategories.COMMUNITY, 1);
  826. return;
  827. }
  828.  
  829. activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
  830. activeChar.setCurrentCp(activeChar.getMaxCp());
  831. BufferPacketSender.sendPacket(activeChar, "functions.htm", BufferPacketCategories.COMMUNITY, 1);
  832. }
  833. // Method to give auto buffs depends on class
  834. else if (subCommand[4].startsWith("autobuff"))
  835. {
  836. BoardsManager.getInstance().addBypass(activeChar, "Service Buffer Auto Buff", command);
  837. if ((activeChar.getPvpFlag() != 0) && !activeChar.isInsideZone(ZoneIdType.PEACE))
  838. {
  839. activeChar.sendMessage("Cannot use this feature here with flag.");
  840. BufferPacketSender.sendPacket(activeChar, "functions.htm", BufferPacketCategories.COMMUNITY, 1);
  841. return;
  842. }
  843.  
  844. AutoBuff.autoBuff(activeChar);
  845. BufferPacketSender.sendPacket(activeChar, "functions.htm", BufferPacketCategories.COMMUNITY, 1);
  846. }
  847. // Send buffs from profile to player or party or pet
  848. else if (subCommand[4].startsWith("bufffor"))
  849. {
  850. if (subCommand[4].startsWith("buffforpet"))
  851. {
  852. JavaBufferBypass.callPetBuffCommand(activeChar, subCommand[5]);
  853. }
  854. else if (subCommand[4].startsWith("buffforparty"))
  855. {
  856. JavaBufferBypass.callPartyBuffCommand(activeChar, subCommand[5]);
  857. }
  858. else if (subCommand[4].startsWith("buffforme"))
  859. {
  860. JavaBufferBypass.callSelfBuffCommand(activeChar, subCommand[5]);
  861. }
  862.  
  863. BufferPacketSender.sendPacket(activeChar, "main.htm", BufferPacketCategories.COMMUNITY, 1);
  864. }
  865. // Method to give single buffs
  866. else if (subCommand[4].startsWith("buff"))
  867. {
  868. JavaBufferBypass.callBuffCommand(activeChar, subCommand[5], subCommand[4], 1);
  869. }
  870. // Scheme create new profile
  871. else if (subCommand[4].startsWith("saveProfile"))
  872. {
  873. try
  874. {
  875. JavaBufferBypass.callSaveProfile(activeChar, subCommand[5], 1);
  876. }
  877. catch (Exception e)
  878. {
  879. activeChar.sendMessage("Please specify a valid profile name.");
  880. BufferPacketSender.sendPacket(activeChar, "newSchemeProfile.htm", BufferPacketCategories.COMMUNITY, 1);
  881. return;
  882. }
  883. }
  884. else if (subCommand[4].startsWith("showAvaliable"))
  885. {
  886. JavaBufferBypass.callAvailableCommand(activeChar, subCommand[4], subCommand[5], 1);
  887. }
  888. else if (subCommand[4].startsWith("add"))
  889. {
  890. JavaBufferBypass.callAddCommand(activeChar, subCommand[4], subCommand[5], subCommand[6], 1);
  891. }
  892. // Method to delete player's selected profile
  893. else if (subCommand[4].startsWith("deleteProfile"))
  894. {
  895. PlayerMethods.delProfile(subCommand[5], activeChar);
  896. BufferPacketSender.sendPacket(activeChar, "main.htm", BufferPacketCategories.COMMUNITY, 1);
  897. }
  898. else if (subCommand[4].startsWith("showBuffsToDelete"))
  899. {
  900. GenerateHtmls.showBuffsToDelete(activeChar, subCommand[5], "removeBuffs");
  901. }
  902. else if (subCommand[4].startsWith("removeBuffs"))
  903. {
  904. ThreadPoolManager.getInstance().executeGeneral(new BuffDeleter(activeChar, subCommand[5], Integer.parseInt(subCommand[6]), 1));
  905. }
  906. else if (subCommand[4].startsWith("showProfiles"))
  907. {
  908. GenerateHtmls.showSchemeToEdit(activeChar, subCommand[5]);
  909. }
  910. }
  911. else
  912. {
  913. separateAndSend("<html><body><br><br><center>Command : " + command + " needs core development</center><br><br></body></html>", activeChar);
  914. }
  915. }
  916.  
  917. private String buttons(L2PcInstance activeChar)
  918. {
  919. String add = "";
  920. final int[] PKS =
  921. {
  922. 1,
  923. 2,
  924. 5,
  925. 10,
  926. 25,
  927. 50,
  928. 100,
  929. 250,
  930. 500,
  931. 1000
  932. };
  933.  
  934. for (int pk : PKS)
  935. {
  936. if (activeChar.getPkKills() <= pk)
  937. {
  938. break;
  939. }
  940. add += getPkButton(pk);
  941. }
  942.  
  943. if (activeChar.getPkKills() != 0)
  944. {
  945. add += getPkButton(activeChar.getPkKills());
  946. }
  947.  
  948. return add;
  949. }
  950.  
  951. private String getPkButton(int i)
  952. {
  953. return "<table width=750 height=20><tr><td align=center><button value=\"for " + i + " PK - " + (CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_PRICE * i) + " " + ItemData.getInstance().getTemplate(CommunityServicesConfigs.COMMUNITY_SERVICES_WASH_PK_ID).getName() + " \" action=\"bypass " + _servicesBBSCommand + "_deletePK " + i + "\" width=280 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>";
  954. }
  955.  
  956. private String commandSeperator(String command)
  957. {
  958. StringTokenizer st = new StringTokenizer(command, " ");
  959. st.nextToken();
  960. String dat = st.nextToken();
  961. return dat;
  962. }
  963.  
  964. private class Teleport implements Runnable
  965. {
  966. L2PcInstance _activeChar;
  967. private final int _x, _y, _z;
  968.  
  969. Teleport(L2PcInstance activeChar, int x, int y, int z)
  970. {
  971. _activeChar = activeChar;
  972. _x = x;
  973. _y = y;
  974. _z = z;
  975. }
  976.  
  977. @Override
  978. public void run()
  979. {
  980. _activeChar.setInstanceId(0);
  981. _activeChar.teleToLocation(_x, _y, _z, true);
  982. _activeChar.setIsCastingNow(false);
  983. _activeChar.enableAllSkills();
  984. }
  985. }
  986.  
  987. private void sendHtm(L2PcInstance activeChar, String filepath, String path, String file, String command)
  988. {
  989. String content = "";
  990. filepath = path + file + ".htm";
  991. File filecom = new File(filepath);
  992.  
  993. if (!filecom.exists())
  994. {
  995. content = "<html><body><br><br><center>The command " + command + " points to file(" + filepath + ") that NOT exists.</center></body></html>";
  996. separateAndSend(content, activeChar);
  997. return;
  998. }
  999.  
  1000. content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), filepath);
  1001. if (content.isEmpty())
  1002. {
  1003. content = "<html><body><br><br><center>Content Empty: The command " + command + " points to an invalid or empty html file(" + filepath + ").</center></body></html>";
  1004. }
  1005.  
  1006. separateAndSend(content, activeChar);
  1007. }
  1008.  
  1009. @Override
  1010. protected void separateAndSend(String html, L2PcInstance acha)
  1011. {
  1012. html = html.replace("\t", "");
  1013. html = html.replace("%command%", _servicesBBSCommand);
  1014. if (html.length() < 8180)
  1015. {
  1016. acha.sendPacket(new ShowBoard(html, "101"));
  1017. acha.sendPacket(new ShowBoard(null, "102"));
  1018. acha.sendPacket(new ShowBoard(null, "103"));
  1019. }
  1020. else if (html.length() < (8180 * 2))
  1021. {
  1022. acha.sendPacket(new ShowBoard(html.substring(0, 8180), "101"));
  1023. acha.sendPacket(new ShowBoard(html.substring(8180, html.length()), "102"));
  1024. acha.sendPacket(new ShowBoard(null, "103"));
  1025. }
  1026. else if (html.length() < (8180 * 3))
  1027. {
  1028. acha.sendPacket(new ShowBoard(html.substring(0, 8180), "101"));
  1029. acha.sendPacket(new ShowBoard(html.substring(8180, 8180 * 2), "102"));
  1030. acha.sendPacket(new ShowBoard(html.substring(8180 * 2, html.length()), "103"));
  1031. }
  1032. }
  1033.  
  1034. public static String getVoteBanners(L2PcInstance activeChar)
  1035. {
  1036. String voteBanners = "";
  1037.  
  1038. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_HOPZONE)
  1039. {
  1040. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_orcish_talisman_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in Hopzone</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "HopZone") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote HopZone\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1041. }
  1042. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_TOPZONE)
  1043. {
  1044. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_barka_badge_officer_i02\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in Topzone</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "TopZone") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote TopZone\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1045. }
  1046. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_TOPCO)
  1047. {
  1048. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_jewel_white_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in Top.co</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "L2TopCo") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote L2TopCo\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1049. }
  1050. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_NETWORK)
  1051. {
  1052. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_Symbol_of_dawn_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in L2NetWork</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "L2NetWork") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote L2NetWork\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1053. }
  1054. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_GAMEBYTES)
  1055. {
  1056. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_nutrients_of_cupid_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in Gamebytes</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "GameBytes") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote GameBytes\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1057. }
  1058. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_TOPGS00)
  1059. {
  1060. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.etc_badge_gold_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in TopGs200</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "TopGs200") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote TopGs200\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1061. }
  1062. if (IndividualVoteSystemConfigs.VOTE_MANAGER_ALLOW_TOPSERVERS200)
  1063. {
  1064. voteBanners += "<tr><td width=540 height=58 align=center valign=top>" + "<table border=0 width=540 height=38 cellspacing=4 cellpadding=3 bgcolor=232836>" + "<tr><td width=40 align=right valign=top>" + "<img src=\"icon.energy_condenser_i00\" width=32 height=32>" + "</td><td width=520 align=left valign=top>" + "<font color=\"a22020\">Vote in TopServer200</font><br1> <font color=c1b33a>Info:</font> You can vote " + VoteHandler.getWhenCanVote(activeChar, "TopServers200") + "" + "</td><td width=80 height=39 align=right>" + "<table border=0 cellspacing=0 cellpadding=0 width=80>" + "<tr>" + "<td width=40 align=right valign=center>" + "Vote</td>" + "<td width=40 align=right valign=center>" + "<button value=\"\" action=\"bypass " + CommunityServicesConfigs.BYPASS_COMMAND + "_vote TopServers200\" width=32 height=32 back=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red_Down\" fore=\"L2UI_ct1.MiniMap_DF_PlusBtn_Red\">" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</td>" + "</tr>";
  1065. }
  1066. if (IndividualVoteSystemConfigs.ENABLE_TRIES)
  1067. {
  1068. if (Integer.parseInt(activeChar.getVar("vote_tries", "9999")) == 9999)
  1069. {
  1070. activeChar.setVar("vote_tries", String.valueOf(IndividualVoteSystemConfigs.TRIES_AMOUNT));
  1071. }
  1072. voteBanners += "<tr><td width=540 align=center valign=top><br>Tries: <font color=AE9977>" + activeChar.getVar("vote_tries", "0") + "</font></td></tr>";
  1073. }
  1074. return voteBanners;
  1075. }
  1076.  
  1077. @Override
  1078. public void parsewrite(String url, String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  1079. {
  1080.  
  1081. }
  1082.  
  1083. public static ServicesBBSManager getInstance()
  1084. {
  1085. return SingletonHolder._instance;
  1086. }
  1087.  
  1088. private static class SingletonHolder
  1089. {
  1090. protected static final ServicesBBSManager _instance = new ServicesBBSManager();
  1091. }
  1092. }
Advertisement
Add Comment
Please, Sign In to add comment