Advertisement
Guest User

Donate Manager (L2JFrozen)

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