Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2017
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.22 KB | None | 0 0
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jfrozen.gameserver.model.actor.instance;
  16.  
  17. import java.sql.Connection;
  18. import java.sql.PreparedStatement;
  19. import java.sql.SQLException;
  20. import java.util.StringTokenizer;
  21.  
  22. import com.l2jfrozen.Config;
  23. import com.l2jfrozen.gameserver.ai.CtrlIntention;
  24. import com.l2jfrozen.gameserver.cache.HtmCache;
  25. import com.l2jfrozen.gameserver.custom.DonateAudit;
  26. import com.l2jfrozen.gameserver.datatables.CharNameTable;
  27. import com.l2jfrozen.gameserver.datatables.SkillTable;
  28. import com.l2jfrozen.gameserver.model.Inventory;
  29. import com.l2jfrozen.gameserver.model.L2Augmentation;
  30. import com.l2jfrozen.gameserver.model.L2Skill;
  31. import com.l2jfrozen.gameserver.model.L2World;
  32. import com.l2jfrozen.gameserver.model.multisell.L2Multisell;
  33. import com.l2jfrozen.gameserver.network.SystemMessageId;
  34. import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
  35. import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate;
  36. import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
  37. import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
  38. import com.l2jfrozen.gameserver.network.serverpackets.LeaveWorld;
  39. import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
  40. import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  41. import com.l2jfrozen.gameserver.network.serverpackets.PartySmallWindowAll;
  42. import com.l2jfrozen.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
  43. import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
  44. import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  45. import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
  46. import com.l2jfrozen.gameserver.templates.L2EtcItemType;
  47. import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  48. import com.l2jfrozen.gameserver.util.Util;
  49. import com.l2jfrozen.util.database.L2DatabaseFactory;
  50.  
  51. /**
  52. * @author gevorakoC
  53. */
  54. @SuppressWarnings("unused")
  55. public class L2DonateShopInstance extends L2FolkInstance
  56. {
  57. public L2DonateShopInstance(int objectId, L2NpcTemplate template)
  58. {
  59. super(objectId, template);
  60. }
  61.  
  62. // Config Donate Shop
  63. private static int itemid = 1704;
  64. private static int[] clanSkills =
  65. {
  66. 370,
  67. 371,
  68. 372,
  69. 373,
  70. 374,
  71. 375,
  72. 376,
  73. 377,
  74. 378,
  75. 379,
  76. 380,
  77. 381,
  78. 382,
  79. 383,
  80. 384,
  81. 385,
  82. 386,
  83. 387,
  84. 388,
  85. 389,
  86. 390,
  87. 391
  88. };
  89. @Override
  90. public void onBypassFeedback(L2PcInstance player, String command)
  91. {
  92. StringTokenizer st = new StringTokenizer(command, " ");
  93. String actualCommand = st.nextToken(); // Get actual command
  94.  
  95. switch (command)
  96. {
  97. case "clan":
  98. clanReward(player, 20);
  99. break;
  100. case "windows":
  101. winds(player, 7);
  102. break;
  103. case "augments":
  104. winds(player, 8);
  105. break;
  106. case "augmentpanel":
  107. winds(player, 13);
  108. break;
  109. case "passive":
  110. winds(player, 14);
  111. break;
  112. case "passive2":
  113. winds(player, 15);
  114. break;
  115. case "page2":
  116. winds(player, 9);
  117. break;
  118. case "page3":
  119. winds(player, 10);
  120. break;
  121. case "page4":
  122. winds(player, 11);
  123. break;
  124. case "page5":
  125. winds(player, 12);
  126. break;
  127. case "chars":
  128. winds(player, 5);
  129. break;
  130. case "noblesse":
  131. noblesse(player, 5);
  132. break;
  133. case "donate":
  134. showEnchantSkillList(player, player.getClassId());
  135. break;
  136. case "donatewin":
  137. winds(player, 2);
  138. break;
  139. case "sexwin":
  140. winds(player, 4);
  141. break;
  142. case "noblessewin":
  143. winds(player, 1);
  144. break;
  145. case "clanwin":
  146. winds(player, 3);
  147. break;
  148. case "herowin":
  149. winds(player, 6);
  150. break;
  151. case "sex":
  152. sex(player, 10);
  153. break;
  154. case "sethero":
  155. hero(player, 50, 0);
  156. break;
  157. case "sethero1":
  158. hero(player, 5, 1);
  159. break;
  160. case "sethero7":
  161. hero(player, 25, 30);
  162. break;
  163. case "weapon":
  164. enchantw(player);
  165. break;
  166. case "armor":
  167. enchanta(player);
  168. break;
  169. case "jewel":
  170. enchantj(player);
  171. break;
  172. case "rhand":
  173. Enchant(player, 16, 8, Inventory.PAPERDOLL_RHAND);
  174. break;
  175. case "lhand":
  176. Enchant(player, 16, 8, Inventory.PAPERDOLL_LHAND);
  177. break;
  178. case "rear":
  179. Enchant(player, 16, 3, Inventory.PAPERDOLL_REAR);
  180. break;
  181. case "lear":
  182. Enchant(player, 16, 3, Inventory.PAPERDOLL_LEAR);
  183. break;
  184. case "rf":
  185. Enchant(player, 16, 3, Inventory.PAPERDOLL_RFINGER);
  186. break;
  187. case "lf":
  188. Enchant(player, 16, 3, Inventory.PAPERDOLL_LFINGER);
  189. break;
  190. case "neck":
  191. Enchant(player, 16, 3, Inventory.PAPERDOLL_NECK);
  192. break;
  193. case "head":
  194. Enchant(player, 16, 3, Inventory.PAPERDOLL_HEAD);
  195. break;
  196. case "feet":
  197. Enchant(player, 16, 3, Inventory.PAPERDOLL_FEET);
  198. break;
  199. case "gloves":
  200. Enchant(player, 16, 3, Inventory.PAPERDOLL_GLOVES);
  201. break;
  202. case "chest":
  203. Enchant(player, 16, 3, Inventory.PAPERDOLL_CHEST);
  204. break;
  205. case "legs":
  206. Enchant(player, 16, 3, Inventory.PAPERDOLL_LEGS);
  207. break;
  208. case "tattoo":
  209. Enchant(player, 16, 3, Inventory.PAPERDOLL_UNDER);
  210. break;
  211. }
  212. if (command.startsWith("addaugment"))
  213. {
  214. StringTokenizer sts = new StringTokenizer(command);
  215. sts.nextToken();
  216. try
  217. {
  218. String type = sts.nextToken();
  219. switch (type)
  220. {
  221. case "DuelMight":
  222. augments(player, 10, 1062406807, 3134, 10);
  223. break;
  224. case "Might":
  225. augments(player, 10, 1062079106, 3132, 10);
  226. break;
  227. case "Shield":
  228. augments(player, 10, 968884225, 3135, 10);
  229. break;
  230. case "MagicBarrier":
  231. augments(player, 10, 956760065, 3136, 10);
  232. break;
  233. case "Empower":
  234. augments(player, 10, 1061423766, 3133, 10);
  235. break;
  236. case "BattleRoar":
  237. augments(player, 10, 968228865, 3125, 10);
  238. break;
  239. case "Agility":
  240. augments(player, 10, 1060444351, 3139, 10);
  241. break;
  242. case "Heal":
  243. augments(player, 10, 1061361888, 3123, 10);
  244. break;
  245. case "CelestialShield":
  246. augments(player, 10, 974454785, 3158, 1);
  247. break;
  248. case "Guidance":
  249. augments(player, 10, 1061034178, 3140, 10);
  250. break;
  251. case "Focus":
  252. augments(player, 10, 1067523168, 3141, 10);
  253. break;
  254. case "WildMagic":
  255. augments(player, 10, 1067850844, 3142, 10);
  256. break;
  257. case "ReflectDamage":
  258. augments(player, 10, 1067588698, 3204, 3);
  259. break;
  260. case "Stone":
  261. augments(player, 10, 1060640984, 3169, 10);
  262. break;
  263. case "HealEmpower":
  264. augments(player, 10, 1061230760, 3138, 10);
  265. break;
  266. case "ShadowFlare":
  267. augments(player, 10, 1063520931, 3171, 10);
  268. break;
  269. case "AuraFlare":
  270. augments(player, 10, 1063455338, 3172, 10);
  271. break;
  272. case "Prominence":
  273. augments(player, 10, 1063327898, 3165, 10);
  274. break;
  275. case "HydroBlast":
  276. augments(player, 10, 1063590051, 3167, 10);
  277. break;
  278. case "SolarFlare":
  279. augments(player, 10, 1061158912, 3177, 10);
  280. break;
  281. case "ManaBurn":
  282. augments(player, 10, 956825600, 3154, 10);
  283. break;
  284. case "Refresh":
  285. augments(player, 10, 997392384, 3202, 3);
  286. break;
  287. case "Hurricane":
  288. augments(player, 10, 1064108032, 3168, 10);
  289. break;
  290. case "SpellRefresh":
  291. augments(player, 10, 1068302336, 3200, 3);
  292. break;
  293. case "SkillRefresh":
  294. augments(player, 10, 1068040192, 3199, 3);
  295. break;
  296. case "Stun":
  297. augments(player, 10, 969867264, 3189, 10);
  298. break;
  299. case "Prayer":
  300. augments(player, 10, 991297536, 3126, 10);
  301. break;
  302. case "Cheer":
  303. augments(player, 10, 979828736, 3131, 10);
  304. break;
  305. case "BlessedSoul":
  306. augments(player, 10, 991690752, 3128, 10);
  307. break;
  308. case "BlessedBody":
  309. augments(player, 10, 991625216, 3124, 10);
  310. break;
  311. case "DuelMightp":
  312. augments(player, 10, 1067260101, 3243, 10);
  313. break;
  314. case "Mightp":
  315. augments(player, 10, 1067125363, 3240, 10);
  316. break;
  317. case "Shieldp":
  318. augments(player, 10, 1067194549, 3244, 10);
  319. break;
  320. case "MagicBarrierp":
  321. augments(player, 10, 962068481, 3245, 10);
  322. break;
  323. case "Empowerp":
  324. augments(player, 10, 1066994296, 3241, 10);
  325. break;
  326. case "Agilityp":
  327. augments(player, 10, 965279745, 3247, 10);
  328. break;
  329. case "Guidancep":
  330. augments(player, 10, 1070537767, 3248, 10);
  331. break;
  332. case "Focusp":
  333. augments(player, 10, 1070406728, 3249, 10);
  334. break;
  335. case "WildMagicp":
  336. augments(player, 10, 1070599653, 3250, 10);
  337. break;
  338. case "ReflectDamagep":
  339. augments(player, 10, 1070472227, 3259, 3);
  340. break;
  341. case "HealEmpowerp":
  342. augments(player, 10, 1066866909, 3246, 10);
  343. break;
  344. case "Prayerp":
  345. augments(player, 10, 1066932422, 3238, 10);
  346. break;
  347. }
  348. }
  349. catch (Exception e)
  350. {
  351. player.sendMessage("Usage : Bar>");
  352. }
  353. }
  354. else if (command.startsWith("name"))
  355. {
  356. try
  357. {
  358. String commands[] = command.split(" ");
  359. name(player, 10, commands);
  360. }
  361. catch (StringIndexOutOfBoundsException e)
  362. {
  363. // Case of empty character name
  364. player.sendMessage("Usage: enter box your name");
  365. }
  366. }
  367. if (actualCommand.equalsIgnoreCase("Multisell"))
  368. {
  369. if (st.countTokens() < 1)
  370. return;
  371. L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(st.nextToken()), player, false, getCastle().getTaxRate());
  372. }
  373. }
  374.  
  375. @Override
  376. public void onAction(L2PcInstance player)
  377. {
  378. player.setLastFolkNPC(this);
  379. if (this != player.getTarget())
  380. {
  381. player.setTarget(this);
  382.  
  383. player.sendPacket(new MyTargetSelected(getObjectId(), 0));
  384.  
  385. player.sendPacket(new ValidateLocation(this));
  386. }
  387. else if (!canInteract(player))
  388. {
  389. player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
  390. }
  391. else
  392. {
  393. showClanWindow(player);
  394. }
  395. player.sendPacket(ActionFailed.STATIC_PACKET);
  396. }
  397.  
  398. public void showClanWindow(L2PcInstance activeChar)
  399. {
  400. NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  401. StringBuilder tb = new StringBuilder("");
  402.  
  403. tb.append("<html><head><title>L2 Donate Shop</title></head><body>");
  404. tb.append("<center>");
  405. tb.append("<table width=300 height=20 bgcolor=000000 border=0 cellspacing=0 cellpadding=0>");
  406. tb.append("<tr>");
  407. tb.append("<td align=center><font color=\"FF6600\">Hello," + activeChar.getName() + " Here You can Buy with Donate Coin.</font></td>");
  408. tb.append("</tr></table>");
  409. tb.append("<img src=\"L2UI.SquareGray\" width=\"300\" height=\"1\"><br>");
  410. tb.append("<table width=300 align=center>");
  411. tb.append("<tr>");
  412. tb.append("<td align=center><img src=\"icon.skill0371\" width=32 height=32></td>");
  413. tb.append("<td align=center><button value=\"Full Clan\" action=\"bypass -h npc_" + getObjectId() + "_clanwin\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  414. tb.append("<td align=center><button value=\"Augment Skills\" action=\"bypass -h npc_" + getObjectId() + "_augmentpanel\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  415. tb.append("<td align=center><img src=\"icon.skill3123\" width=32 height=32></td>");
  416. tb.append("</tr>");
  417. tb.append("<tr></tr>");
  418. tb.append("<tr>");
  419. tb.append("<td align=center><img src=\"icon.weapon_draconic_bow_i01\" width=32 height=32></td>");
  420. tb.append("<td align=center><button value=\"Enchant Item\" action=\"bypass -h npc_" + getObjectId() + "_windows\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  421. tb.append("<td align=center><button value=\"Change Sex\" action=\"bypass -h npc_" + getObjectId() + "_sexwin\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  422. tb.append("<td align=center><img src=\"icon.skill1297\" width=32 height=32></td>");
  423. tb.append("</tr>");
  424. tb.append("<tr></tr>");
  425. tb.append("<tr>");
  426. tb.append("<td align=center><img src=\"icon.etc_permit_card_i00\" width=32 height=32></td>");
  427. tb.append("<td align=center><button value=\"Change Name\" action=\"bypass -h npc_" + getObjectId() + "_chars\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  428. tb.append("<td align=center><button value=\"Noblesse Status\" action=\"bypass -h npc_" + getObjectId() + "_noblessewin\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  429. tb.append("<td align=center><img src=\"icon.skill1323\" width=32 height=32></td>");
  430. tb.append("</tr>");
  431. tb.append("<tr></tr>");
  432. tb.append("<tr>");
  433. tb.append("<td align=center><img src=\"icon.skill1405\" width=32 height=32></td>");
  434. tb.append("<td align=center><button value=\"Skill Enchanter\" action=\"bypass -h npc_" + getObjectId() + "_donatewin\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  435. tb.append("<td align=center><button value=\"Hero Status\" action=\"bypass -h npc_" + getObjectId() + "_herowin\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"></td>");
  436. tb.append("<td align=center><img src=\"icon.skill1374\" width=32 height=32></td>");
  437. tb.append("</tr>");
  438. tb.append("</table>");
  439. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
  440. tb.append("<button value=\"Donate Shop\" action=\"bypass -h npc_" + getObjectId() + "_multisell 94203\" width=\"95\" height=\"24\" back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\"><br>");
  441. tb.append("</center>");
  442. tb.append("<table width=300>");
  443. tb.append("<tr>");
  444. tb.append("<td><center><font color=\"0088ff\">WebSite:</font> <font color=\"a9a9a2\">L2.com</font></center></td>");
  445. tb.append("</tr>");
  446. tb.append("</table>");
  447. tb.append("</body></html>");
  448.  
  449. nhm.setHtml(tb.toString());
  450. activeChar.sendPacket(nhm);
  451. }
  452.  
  453. public static void augments(L2PcInstance activeChar, int ammount, int attributes, int idaugment, int levelaugment)
  454. {
  455. L2ItemInstance rhand = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
  456. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  457. {
  458. if (rhand == null)
  459. {
  460. activeChar.sendMessage(activeChar.getName() + " have to equip a weapon.");
  461. return;
  462. }
  463. else if (rhand.getItem().getCrystalType() == 0 || rhand.getItem().getCrystalType() == 1 || rhand.getItem().getCrystalType() == 2)
  464. {
  465. activeChar.sendMessage("You can't augment under " + rhand.getItem().getCrystalType() + " Grade Weapon!");
  466. return;
  467. }
  468. else if (rhand.isHeroItem())
  469. {
  470. activeChar.sendMessage("You Cannot be add Augment On " + rhand.getItemName() + " !");
  471. return;
  472. }
  473.  
  474. if (!rhand.isAugmented())
  475. {
  476. activeChar.sendMessage("Successfully To Add " + SkillTable.getInstance().getInfo(idaugment, levelaugment).getName() + ".");
  477. augmentweapondatabase(activeChar, attributes, idaugment, levelaugment);
  478.  
  479. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated " + SkillTable.getInstance().getInfo(idaugment, levelaugment).getName() + " Stuck " + rhand.getItemName() + ".", "Donate Coins:" + ammount);
  480. }
  481. else
  482. {
  483. activeChar.sendMessage("You Have Augment on weapon!");
  484. return;
  485. }
  486.  
  487. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  488. return;
  489.  
  490. }
  491. else
  492. {
  493. activeChar.sendMessage("You do not have enough Donate Star.");
  494. }
  495. }
  496.  
  497. public static void augmentweapondatabase(L2PcInstance player, int attributes, int id, int level)
  498. {
  499. L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
  500. L2Augmentation augmentation = new L2Augmentation(item, attributes, id, level, true);
  501. augmentation.applyBoni(player);
  502. item.setAugmentation(augmentation);
  503.  
  504. try (
  505. Connection con = L2DatabaseFactory.getInstance().getConnection())
  506. {
  507. PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
  508. statement.setInt(1, item.getObjectId());
  509. statement.setInt(2, attributes);
  510. statement.setInt(3, id);
  511. statement.setInt(4, level);
  512. InventoryUpdate iu = new InventoryUpdate();
  513. player.sendPacket(iu);
  514. statement.execute();
  515. statement.close();
  516. }
  517. catch (SQLException e)
  518. {
  519. System.out.println(e);
  520. }
  521. }
  522.  
  523. public static void clanReward(L2PcInstance activeChar, int ammount)
  524. {
  525. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  526. {
  527. if (activeChar.isClanLeader() && activeChar.getClan().getLevel() == 8)
  528. {
  529. activeChar.sendMessage("You are the leader and you have clan lvl 8.");
  530. return;
  531. }
  532.  
  533. if (!activeChar.isClanLeader())
  534. {
  535. activeChar.sendMessage("You are not the leader of your Clan.");
  536. return;
  537. }
  538.  
  539. if (activeChar.isClanLeader() && activeChar.getClan().getLevel() < 8)
  540. {
  541. activeChar.getClan().changeLevel(8);
  542. activeChar.getClan().setReputationScore(10000, true);
  543. activeChar.getSkills();
  544. activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  545. activeChar.getClan().broadcastClanStatus();
  546. activeChar.sendMessage("Your Buy clan level 8 and full clan skills was successful.");
  547. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated Clan level 8 and full clan skills", "Donate Coins:" + ammount);
  548. }
  549. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  550. return;
  551. }
  552. else
  553. {
  554. activeChar.sendMessage("You do not have enough Donate Star.");
  555. }
  556. }
  557.  
  558. public static void noblesse(L2PcInstance activeChar, int ammount)
  559. {
  560. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  561. {
  562. if (activeChar.isNoble())
  563. {
  564. activeChar.sendMessage("You Are Already A Noblesse!.");
  565. return;
  566. }
  567.  
  568. if (!activeChar.isNoble())
  569. {
  570. activeChar.setNoble(true);
  571. activeChar.broadcastUserInfo();
  572. activeChar.getInventory().addItem("Tiara", 7694, 1, activeChar, null);
  573. activeChar.sendMessage("You Are Now a Noble,You Are Granted With Noblesse Status , And Noblesse Skills.");
  574. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated Noblesse Status", "Donate Coins:" + ammount);
  575. }
  576. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  577. return;
  578. }
  579. else
  580. {
  581. activeChar.sendMessage("You do not have enough Donate Star.");
  582. }
  583. }
  584.  
  585. @SuppressWarnings({
  586. "null"
  587. })
  588. public static void hero(final L2PcInstance activeChar, int ammount,int heroTime )
  589.  
  590. {
  591. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  592. {
  593. if(activeChar.isHero())
  594. {
  595. activeChar.sendMessage("You Are Already A Hero!");
  596. return;
  597. }
  598. activeChar.setHero(true);
  599. activeChar.sendMessage("You Are Now a Donate Hero,You Are Granted With Hero Status , Skills ,Aura.");
  600. activeChar.broadcastUserInfo();
  601.  
  602. String days = null;
  603.  
  604. String INSERT_DATA = "REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)";
  605.  
  606.  
  607.  
  608. Connection con = null;
  609. try
  610. {
  611. if (activeChar == null)
  612. return;
  613.  
  614. con = L2DatabaseFactory.getInstance().getConnection(false);
  615. PreparedStatement stmt = con.prepareStatement(INSERT_DATA);
  616.  
  617. stmt.setInt(1, activeChar.getObjectId());
  618. stmt.setString(2, activeChar.getName());
  619. stmt.setInt(3, 1);
  620. stmt.setInt(4, activeChar.isNoble() ? 1 : 0);
  621. stmt.setInt(5, activeChar.isDonator() ? 1 : 0);
  622. stmt.setLong(6, heroTime == 0 ? 0 : System.currentTimeMillis() + heroTime);
  623. stmt.execute();
  624. stmt.close();
  625. stmt = null;
  626. }
  627. catch (final Exception e)
  628. {
  629. if (Config.ENABLE_ALL_EXCEPTIONS)
  630. e.printStackTrace();
  631.  
  632. LOGGER.error("Error: could not update database: ", e);
  633. }
  634.  
  635. switch(heroTime)
  636. {
  637. case 0:
  638. days = " 4ever";
  639. break;
  640. case 1:
  641. days = " Days";
  642. break;
  643. case 30:
  644. days = " Days";
  645. break;
  646. }
  647. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated Hero for " + heroTime + days + " Status", "Donate Coins:" + ammount);
  648.  
  649. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  650. return;
  651. }
  652. else
  653. {
  654. activeChar.sendMessage("You do not have enough Donate Star.");
  655. }
  656. }
  657.  
  658. /*
  659. * public static void donatestatus(L2PcInstance activeChar,int ammount) { if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount) { if(activeChar.isdonator()) { activeChar.sendMessage("You Are Already A Donate Status!."); return; } if(!activeChar.isdonator()) {
  660. * activeChar.setdonator(true); activeChar.updateNameTitleColor(); try (Connection connection = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  661. * statement.setString(1,activeChar.getName()); ResultSet rset = statement.executeQuery(); int objId = 0; if (rset.next()) { objId = rset.getInt(1); } rset.close(); statement.close(); if (objId == 0) { connection.close(); return; } statement = connection.prepareStatement(
  662. * "UPDATE characters SET donator=1 WHERE obj_id=?"); statement.setInt(1, objId); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { System.out.println("could not set donator stats of char:"+ e); } activeChar.sendMessage("You Are Now a Have Donate Status.");
  663. * activeChar.broadcastUserInfo(); DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]","Donated Donate Status","Donate Coins:"+ammount); } if (!activeChar.destroyItemByItemId("Donate Coin",itemid, ammount, activeChar, false)) return; } else {
  664. * activeChar.sendMessage("You do not have enough Donate Coin."); } }
  665. */
  666.  
  667. public void enchantj(L2PcInstance activeChar)
  668. {
  669. // jewels
  670. L2ItemInstance rear = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR);
  671. L2ItemInstance lear = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR);
  672. L2ItemInstance rfinger = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
  673. L2ItemInstance lfinger = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
  674. L2ItemInstance neck = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
  675.  
  676. NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  677. StringBuilder tb = new StringBuilder("");
  678.  
  679. tb.append("<html><head><title>L2 Donate Shop</title></head><body>");
  680. tb.append("<center><font color=\"FF0000\">Donate Shop</font><br>");
  681. tb.append("<center>Enchant Jewel's Part +16 Will Cost <font color=\"FF6600\">3 Donate Coin</font>.<br></center>");
  682. tb.append("<center>");
  683. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
  684. tb.append("<br>");
  685. if (rear != null)
  686. {
  687. tb.append("<button value=\"" + rear.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_rear\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  688. }
  689. if (lear != null)
  690. {
  691. tb.append("<button value=\"" + lear.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_lear\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  692. }
  693. if (rfinger != null)
  694. {
  695. tb.append("<button value=\"" + rfinger.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_rf\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  696. }
  697. if (lfinger != null)
  698. {
  699. tb.append("<button value=\"" + lfinger.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_lf\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  700. }
  701. if (neck != null)
  702. {
  703. tb.append("<button value=\"" + neck.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_neck\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  704. }
  705. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
  706. tb.append("</center>");
  707. tb.append("</body></html>");
  708.  
  709. nhm.setHtml(tb.toString());
  710. activeChar.sendPacket(nhm);
  711. }
  712.  
  713. public void enchanta(L2PcInstance activeChar)
  714. {
  715. // armors
  716. L2ItemInstance head = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
  717. L2ItemInstance chest = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
  718. L2ItemInstance legs = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
  719. L2ItemInstance feet = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
  720. L2ItemInstance gloves = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
  721. L2ItemInstance tattoo = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER);
  722. NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  723. StringBuilder tb = new StringBuilder("");
  724.  
  725. tb.append("<html><head><title>L2 Donate Shop</title></head><body>");
  726. tb.append("<center><font color=\"FF0000\">Donate Shop</font><br>");
  727. tb.append("<center>Enchant Armor Part +16 Will Cost <font color=\"FF6600\">3 Donate Coin</font>.<br></center>");
  728. tb.append("<center>");
  729. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
  730. tb.append("<br>");
  731. if (head != null)
  732. {
  733. tb.append("<button value=\"" + head.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_head\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  734. }
  735. if (chest != null)
  736. {
  737. tb.append("<button value=\"" + chest.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_chest\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  738. }
  739. if (legs != null)
  740. {
  741. tb.append("<button value=\"" + legs.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_legs\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  742. }
  743. if (feet != null)
  744. {
  745. tb.append("<button value=\"" + feet.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_feet\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  746. }
  747. if (gloves != null)
  748. {
  749. tb.append("<button value=\"" + gloves.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_gloves\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  750. }
  751. if (tattoo != null)
  752. {
  753. tb.append("<button value=\"" + tattoo.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_tattoo\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  754. }
  755. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
  756. tb.append("</center>");
  757. tb.append("</body></html>");
  758.  
  759. nhm.setHtml(tb.toString());
  760. activeChar.sendPacket(nhm);
  761. }
  762.  
  763. public void enchantw(L2PcInstance activeChar)
  764. {
  765. L2ItemInstance rhand = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
  766. L2ItemInstance lhand = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
  767.  
  768. NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  769. StringBuilder tb = new StringBuilder("");
  770.  
  771. tb.append("<html><head><title>L2 Donate Shop</title></head><body>");
  772. tb.append("<center><font color=\"FF0000\">Donate Shop</font><br>");
  773. tb.append("<center>Enchant Weapon +16 Will Cost <font color=\"FF6600\">8 Donate Coin</font>.<br></center>");
  774. tb.append("<center>");
  775. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
  776. tb.append("<br>");
  777. if (rhand != null)
  778. {
  779. tb.append("<button value=\"" + rhand.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_rhand\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  780. }
  781. if (lhand != null && lhand.getItem().getItemType() != L2EtcItemType.ARROW)
  782. {
  783. tb.append("<button value=\"" + lhand.getItemName() + "\" action=\"bypass -h npc_" + getObjectId() + "_lhand\" width=204 height=20 back=\"L2UI_CH3.refinegrade3_21\" fore=\"L2UI_CH3.refinegrade3_21\">");
  784. }
  785.  
  786. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
  787. tb.append("</center>");
  788. tb.append("</body></html>");
  789.  
  790. nhm.setHtml(tb.toString());
  791. activeChar.sendPacket(nhm);
  792. }
  793.  
  794. public static void sex(L2PcInstance activeChar, int ammount)
  795. {
  796. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  797. {
  798. if (activeChar.getClassId().getId() == activeChar.getBaseClass())
  799. {
  800. activeChar.getAppearance().setSex(activeChar.getAppearance().getSex() ? false : true);
  801. activeChar.broadcastUserInfo();
  802. L2PcInstance.setSexDB(activeChar, 1);
  803. activeChar.decayMe();
  804. activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
  805. activeChar.sendMessage("Congratulations! Your Sex has been changed succesfully. You will now be disconnected for Update Sex. Please login again!");
  806. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated Change Sex", "Donate Coins:" + ammount);
  807. try
  808. {
  809. Thread.sleep(3000L);
  810. }
  811. catch (Exception e)
  812. {
  813. }
  814. activeChar.deleteMe();
  815. activeChar.sendPacket(LeaveWorld.STATIC_PACKET);
  816.  
  817. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  818. return;
  819. }
  820. else
  821. {
  822. activeChar.sendMessage("In Order To Get Sex You Need To Be On Main Class");
  823. return;
  824. }
  825. }
  826. else
  827. {
  828. activeChar.sendMessage("You do not have enough Donate Star.");
  829. }
  830. }
  831.  
  832. private void winds(L2PcInstance player, int count)
  833. {
  834. L2ItemInstance rhand = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
  835. NpcHtmlMessage html = new NpcHtmlMessage(1);
  836. switch (count)
  837. {
  838. case 1:
  839. String htmContent = HtmCache.getInstance().getHtm("data/html/mods/donate/noblesse.htm");
  840. html.setHtml(htmContent);
  841. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  842. html.replace("%charname%", player.getName());
  843. player.sendPacket(html);
  844. break;
  845. case 2:
  846. String htmContent1 = HtmCache.getInstance().getHtm("data/html/mods/donate/donate.htm");
  847. html.setHtml(htmContent1);
  848. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  849. html.replace("%charname%", player.getName());
  850. player.sendPacket(html);
  851. break;
  852. case 3:
  853. String htmContent2 = HtmCache.getInstance().getHtm("data/html/mods/donate/clan.htm");
  854. html.setHtml(htmContent2);
  855. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  856. html.replace("%charname%", player.getName());
  857. player.sendPacket(html);
  858. break;
  859. case 4:
  860. String htmContent3 = HtmCache.getInstance().getHtm("data/html/mods/donate/sex.htm");
  861. html.setHtml(htmContent3);
  862. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  863. html.replace("%charname%", player.getName());
  864. player.sendPacket(html);
  865. break;
  866. case 5:
  867. String htmContent4 = HtmCache.getInstance().getHtm("data/html/mods/donate/name.htm");
  868. html.setHtml(htmContent4);
  869. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  870. html.replace("%charname%", player.getName());
  871. player.sendPacket(html);
  872. break;
  873. case 6:
  874. String htmContent5 = HtmCache.getInstance().getHtm("data/html/mods/donate/hero.htm");
  875. html.setHtml(htmContent5);
  876. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  877. html.replace("%charname%", player.getName());
  878. player.sendPacket(html);
  879. break;
  880. case 7:
  881. String htmContent6 = HtmCache.getInstance().getHtm("data/html/mods/donate/enchant.htm");
  882. html.setHtml(htmContent6);
  883. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  884. html.replace("%charname%", player.getName());
  885. player.sendPacket(html);
  886. break;
  887. case 8:
  888. String htmContent8 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page1.htm");
  889. html.setHtml(htmContent8);
  890. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  891. html.replace("%charname%", player.getName());
  892. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  893. {
  894. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  895. }
  896. html.replace("%level%", "None");
  897. player.sendPacket(html);
  898. break;
  899. case 9:
  900. String htmContent9 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page2.htm");
  901. html.setHtml(htmContent9);
  902. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  903. html.replace("%charname%", player.getName());
  904. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  905. {
  906. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  907. }
  908. html.replace("%level%", "None");
  909. player.sendPacket(html);
  910. break;
  911. case 10:
  912. String htmContent10 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page3.htm");
  913. html.setHtml(htmContent10);
  914. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  915. html.replace("%charname%", player.getName());
  916. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  917. {
  918. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  919. }
  920. html.replace("%level%", "None");
  921. player.sendPacket(html);
  922. break;
  923. case 11:
  924. String htmContent11 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page4.htm");
  925. html.setHtml(htmContent11);
  926. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  927. html.replace("%charname%", player.getName());
  928. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  929. {
  930. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  931. }
  932. html.replace("%level%", "None");
  933. player.sendPacket(html);
  934. break;
  935. case 12:
  936. String htmContent12 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page5.htm");
  937. html.setHtml(htmContent12);
  938. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  939. html.replace("%charname%", player.getName());
  940. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  941. {
  942. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  943. }
  944. html.replace("%level%", "None");
  945. player.sendPacket(html);
  946. break;
  947. case 13:
  948. String htmContent13 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment.htm");
  949. html.setHtml(htmContent13);
  950. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  951. html.replace("%charname%", player.getName());
  952. player.sendPacket(html);
  953. break;
  954. case 14:
  955. String htmContent14 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/passive/page1.htm");
  956. html.setHtml(htmContent14);
  957. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  958. html.replace("%charname%", player.getName());
  959. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  960. {
  961. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  962. }
  963. html.replace("%level%", "None");
  964. player.sendPacket(html);
  965. break;
  966. case 15:
  967. String htmContent15 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/passive/page2.htm");
  968. html.setHtml(htmContent15);
  969. html.replace("%objectId%", String.valueOf(this.getObjectId()));
  970. html.replace("%charname%", player.getName());
  971. if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
  972. {
  973. html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
  974. }
  975. html.replace("%level%", "None");
  976. player.sendPacket(html);
  977. break;
  978. }
  979. }
  980.  
  981. private static void name(L2PcInstance activeChar, int ammount, String val[])
  982. {
  983. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  984. {
  985. if (val.length != 2)
  986. {
  987. activeChar.sendMessage("Enter a new name or remove the space between the names.");
  988. return;
  989. }
  990. else if (val[1].length() < 1 || val[1].length() > 16)
  991. {
  992. activeChar.sendMessage("Maximum number of characters: 16");
  993. return;
  994. }
  995. else if (!Util.isAlphaNumeric(val[1]))
  996. {
  997. activeChar.sendMessage("The name must only contain alpha-numeric characters.");
  998. return;
  999. }
  1000. else if (CharNameTable.doesCharNameExist(val[1]))
  1001. {
  1002. activeChar.sendMessage("The name chosen is already in use. Choose another name.");
  1003. return;
  1004. }
  1005.  
  1006. if (activeChar.isInParty())
  1007. {
  1008. activeChar.getParty().broadcastToPartyMembers(activeChar, new PartySmallWindowDeleteAll());
  1009. for (L2PcInstance member : activeChar.getParty().getPartyMembers())
  1010. {
  1011. if (member != activeChar)
  1012. member.sendPacket(new PartySmallWindowAll(member, activeChar.getParty()));
  1013. }
  1014. }
  1015. if (activeChar.getClan() != null)
  1016. activeChar.getClan().broadcastClanStatus();
  1017.  
  1018. L2World.getInstance().removeFromAllPlayers(activeChar);
  1019. activeChar.setName(val[1]);
  1020. activeChar.store();
  1021. L2World.getInstance().addToAllPlayers(activeChar);
  1022. activeChar.sendMessage("Your name has been changed successfully.");
  1023. activeChar.broadcastUserInfo();
  1024.  
  1025. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  1026. return;
  1027. }
  1028. else
  1029. {
  1030. activeChar.sendMessage("You do not have enough Donate Star.");
  1031. }
  1032. }
  1033.  
  1034. public static void Enchant(L2PcInstance activeChar, int enchant, int ammount, int type)
  1035. {
  1036. L2ItemInstance item = activeChar.getInventory().getPaperdollItem(type);
  1037.  
  1038. if (activeChar.getInventory().getInventoryItemCount(itemid, 0) >= ammount)
  1039. {
  1040. if (item == null)
  1041. {
  1042. activeChar.sendMessage("That item doesn't exist in your inventory.");
  1043. return;
  1044. }
  1045. else if (item.getEnchantLevel() == 20)
  1046. {
  1047. activeChar.sendMessage("Your " + item.getItemName() + " is already on maximun enchant!");
  1048. return;
  1049. }
  1050. else if (item.getItem().getCrystalType() == 0 || item.getItem().getCrystalType() == 1 || item.getItem().getCrystalType() == 2)
  1051. {
  1052. activeChar.sendMessage("You can't Enchant under " + item.getItem().getCrystalType() + " Grade Weapon!");
  1053. return;
  1054. }
  1055. else if (item.isHeroItem())
  1056. {
  1057. activeChar.sendMessage("You Cannot be Enchant On " + item.getItemName() + " !");
  1058. return;
  1059. }
  1060.  
  1061. if (item.isEquipped())
  1062. {
  1063. item.setEnchantLevel(enchant);
  1064. item.updateDatabase();
  1065. activeChar.sendPacket(new ItemList(activeChar, false));
  1066. activeChar.broadcastUserInfo();
  1067. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED).addNumber(item.getEnchantLevel()).addItemName(item.getItemId()));
  1068. DonateAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Donated: " + item.getItemName() + " +" + item.getEnchantLevel(), "Donate Coins:" + ammount);
  1069. }
  1070. if (!activeChar.destroyItemByItemId("Donate Star", itemid, ammount, activeChar, false))
  1071. return;
  1072. }
  1073. else
  1074. {
  1075. activeChar.sendMessage("You do not have enough Donate Star.");
  1076. }
  1077. }
  1078. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement