Advertisement
Guest User

Untitled

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