Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2jFrozen_DataPack
- Index: data/html/itemEnchanter/empty_list.htm
- ===================================================================
- --- data/html/itemEnchanter/empty_list.htm (revision 0)
- +++ data/html/itemEnchanter/empty_list.htm (working copy)
- @@ -0,0 +1,5 @@
- +<html>
- + <body>
- + <font color="LEVEL">You don't have any item to enchant!</font><br><br>
- + </body>
- +</html>
- Index: data/html/itemEnchanter/template.htm
- ===================================================================
- --- data/html/itemEnchanter/template.htm (revision 0)
- +++ data/html/itemEnchanter/template.htm (working copy)
- @@ -0,0 +1,12 @@
- +<html>
- + <body>
- + <center>
- + <img src="Sek.cbui371" width=280 height=1>
- + <table width=286 height=26 bgcolor=000000>
- + <tr><td align="center"><font color="LEVEL">Item Enchanter</font></td></tr>
- + </table>
- + <img src="Sek.cbui371" width=280 height=1>
- + %list%
- + </center>
- + </body>
- +</html>
- Index: sql/customs/added_custom_npc.sql
- ===================================================================
- --- sql/customs/added_custom_npc.sql (revision 1004)
- +++ sql/customs/added_custom_npc.sql (working copy)
- @@ -33,5 +33,8 @@
- INSERT INTO `custom_npc` VALUES
- (54, 21654, 'Necromancer of Destruction', 1, 'Equip Manager', 1, 'Monster.vale_master_20_bi', 14.50, 48.00, 80, 'male', 'L2Merchant', 40, 4608, 1896, 67.15, 3.09, 40, 43, 30, 21, 20, 10, 8042, 913, 1863, 587, 1182, 477, 278, 150, 333, 0, 0, 0, 77, 154, 'fire_clan', 300, 0, 0, 'LAST_HIT');
- +INSERT INTO `custom_npc` VALUES
- +(56, 30026, 'Mario', 1, 'Item Enchanter', 1, 'NPC.a_fighterguild_master_Mhuman', 8.00, 23.50, 70, 'male', 'L2ItemEnchanter', 40, 3862, 1493, 11.85, 2.78, 40, 43, 30, 21, 20, 10, 0, 0, 1314, 470, 780, 382, 278, 0, 333, 0, 0, 0, 55, 132, null, 0, 1, 0, 'LAST_HIT');
- +
- insert into custom_npc values
- (50020, 30298, 'Augmenter', 1, 'L2Frozen', 1, 'NPC.a_smith_MDwarf', 7.00, 16.50, 70, 'male', 'L2Trainer', 40, 3862, 1493, 11.85, 2.78, 40, 43, 30, 21, 20, 10, 0, 0, 1314, 470, 780, 382, 278, 0, 333, 89, 0, 0, 55, 132, '', 0, 1, 0, 'LAST_HIT');
- \ No newline at end of file
- Index: data/html/itemEnchanter/long_list.htm
- ===================================================================
- --- data/html/itemEnchanter/long_list.htm (revision 0)
- +++ data/html/itemEnchanter/long_list.htm (working copy)
- @@ -0,0 +1,5 @@
- +<html>
- + <body>
- + <font color="LEVEL">Your item list is too long!</font><br><br>
- + </body>
- +</html>
- Index: data/html/itemEnchanter/start.htm
- ===================================================================
- --- data/html/itemEnchanter/start.htm (revision 0)
- +++ data/html/itemEnchanter/start.htm (working copy)
- @@ -0,0 +1,19 @@
- +<html>
- + <body>
- + <center>
- + <img src="Sek.cbui371" width=280 height=1>
- + <table width=286 height=26 bgcolor=000000>
- + <tr><td align="center"><font color="LEVEL">Item Enchanter</font></td></tr>
- + </table>
- + <img src="Sek.cbui371" width=280 height=1>
- + <br><br>
- + <button value="Weapon" action="bypass -h npc_%objectId%_enchant_weapon" width=100 height=15 back="sek.cbui94" fore="sek.cbui92">
- + <br>
- + <button value="Armor" action="bypass -h npc_%objectId%_enchant_armor" width=100 height=15 back="sek.cbui94" fore="sek.cbui92">
- + <br>
- + <button value="Reset Weapon" action="bypass -h npc_%objectId%_reset_weapon" width=100 height=15 back="sek.cbui94" fore="sek.cbui92">
- + <br>
- + <button value="Reset Armor" action="bypass -h npc_%objectId%_reset_armor" width=100 height=15 back="sek.cbui94" fore="sek.cbui92">
- + </center>
- + </body>
- +</html>
- Index: data/html/itemEnchanter/disabled.htm
- ===================================================================
- --- data/html/itemEnchanter/disabled.htm (revision 0)
- +++ data/html/itemEnchanter/disabled.htm (working copy)
- @@ -0,0 +1,5 @@
- +<html>
- + <body>
- + <font color="LEVEL">This feature is currently disabled.</font><br><br>
- + </body>
- +</html>
- #P L2jFrozen_GameServer
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- --- head-src/com/l2jfrozen/Config.java (revision 1004)
- +++ head-src/com/l2jfrozen/Config.java (working copy)
- @@ -2399,6 +2399,21 @@
- public static String PVP1_CUSTOM_MESSAGE;
- public static String PVP2_CUSTOM_MESSAGE;
- +/*--------------------< Npc Enchant Items >------------------------*/
- + public static boolean npcEnchantItemsEnabled;
- + public static int weaponEnchantLevel;
- + public static int armorEnchantLevel;
- + public static int IngredientID;
- + public static int InAmountWeapon;
- + public static int InAmountArmor;
- + public static int augmentItemChance;
- + public static String nonEnchantableItems;
- + public static List<Integer> nonEnchantableItemList;
- +
- + public static boolean modifyItemEnchant;
- + public static FastMap<Integer, Integer> modifyItemEnchantList;
- +/*--------------------< Npc Enchant Items >------------------------*/
- +
- //============================================================
- public static void loadL2JFrozenConfig()
- {
- @@ -2517,6 +2532,47 @@
- FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
- PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
- PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
- +
- + /*---------------------------------------------< Npc Enchant Items >-------------------------------------------------*/
- + npcEnchantItemsEnabled = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableNpcEnchantItems", "False"));
- + weaponEnchantLevel = Integer.parseInt(L2JFrozenSettings.getProperty("WeaponEnchantLevel", "20"));
- + armorEnchantLevel = Integer.parseInt(L2JFrozenSettings.getProperty("ArmorEnchantLevel", "16"));
- + IngredientID = Integer.parseInt(L2JFrozenSettings.getProperty("IngredientID", "57"));
- + InAmountWeapon = Integer.parseInt(L2JFrozenSettings.getProperty("IngredientAmountWeapon", "15000"));
- + InAmountArmor = Integer.parseInt(L2JFrozenSettings.getProperty("IngredientAmountArmor", "10000"));
- + augmentItemChance = Integer.parseInt(L2JFrozenSettings.getProperty("AugmentItemChance", "30"));
- + nonEnchantableItems = L2JFrozenSettings.getProperty("NonEnchantableItemList", "0");
- + nonEnchantableItemList = new ArrayList<Integer>();
- + for(String itemId : nonEnchantableItems.split(","))
- + nonEnchantableItemList.add(Integer.parseInt(itemId));
- +
- + modifyItemEnchant = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ModifyItemEnchant", "false"));
- + if(modifyItemEnchant)
- + {
- + modifyItemEnchantList = new FastMap<Integer, Integer>();
- + String[] propertySplit = L2JFrozenSettings.getProperty("ModifyItemEnchantList", "").split(";");
- + for(String item : propertySplit)
- + {
- + String[] itemEnchantSplit = item.split(",");
- + if(itemEnchantSplit.length != 2)
- + {
- + System.out.println("invalid config property -> ModifyItemEnchantList \"" + item + "\"");
- + }
- + else
- + {
- + try
- + {
- + modifyItemEnchantList.put(Integer.parseInt(itemEnchantSplit[0]), Integer.parseInt(itemEnchantSplit[1]));
- + }
- + catch(NumberFormatException nfe)
- + {
- + if(Config.ENABLE_ALL_EXCEPTIONS)
- + nfe.printStackTrace();
- + }
- + }
- + }
- + }
- + /*---------------------------------------------< Npc Enchant Items >-------------------------------------------------*/
- }
- catch(Exception e)
- {
- Index: config/functions/l2jfrozen.properties
- ===================================================================
- --- config/functions/l2jfrozen.properties (revision 1004)
- +++ config/functions/l2jfrozen.properties (working copy)
- @@ -280,4 +280,33 @@
- ProtectorSkillLevel = 13
- ProtectorSkillTime = 600
- # Npc Protector Message
- -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- \ No newline at end of file
- +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- +
- +# -------------------------------------------
- +# Npc Enchant Items -
- +# -------------------------------------------
- +# Npc Id = 56
- +# Enable Enchant Items NPC. Default: False
- +EnableNpcEnchantItems = False
- +
- +# Level of Weapon and Armor enchantment.
- +WeaponEnchantLevel = 20
- +ArmorEnchantLevel = 16
- +
- +# Price ID
- +IngredientID = 6393
- +
- +# Price Weapon Count
- +IngredientAmountWeapon = 50
- +
- +# Price Armor Count
- +IngredientAmountArmor = 10
- +
- +# Chance to augment item automatically on enchantment process.
- +AugmentItemChance = 30
- +
- +# List of Items that cannot be enchanted.
- +NonEnchantableItemList = 0
- +
- +ModifyItemEnchant = True
- +ModifyItemEnchantList = 0,0;
- Index: head-src/com/l2jfrozen/gameserver/model/PcInventory.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/PcInventory.java (revision 1004)
- +++ head-src/com/l2jfrozen/gameserver/model/PcInventory.java (working copy)
- @@ -25,6 +25,7 @@
- import javolution.util.FastList;
- +import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.model.TradeList.TradeItem;
- import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance.ItemLocation;
- @@ -843,4 +844,84 @@
- }
- + public L2ItemInstance[] getWeaponsList(boolean positive)
- + {
- + FastList<L2ItemInstance> list = FastList.newInstance();
- + if(positive)
- + {
- + for (L2ItemInstance item : _items)
- + {
- + if ((item != null) && (item.isEnchantable()) && item.isWeapon())
- + {
- + int enchantLevel = Config.weaponEnchantLevel;
- + if (Config.modifyItemEnchant)
- + {
- + if (Config.modifyItemEnchantList.containsKey(item.getItemId()))
- + {
- + enchantLevel = Config.modifyItemEnchantList.get(item.getItemId());
- + }
- + }
- +
- + if(item.getEnchantLevel() < enchantLevel)
- + list.add(item);
- + }
- + }
- + }
- + else
- + {
- + for (L2ItemInstance item : _items)
- + {
- + if ((item != null) && (item.isEnchantable()) && item.isWeapon())
- + {
- + if(item.getEnchantLevel() != 0)
- + list.add(item);
- + }
- + }
- + }
- +
- + L2ItemInstance[] result = list.toArray(new L2ItemInstance[list.size()]);
- + FastList.recycle(list);
- + return result;
- + }
- +
- + public L2ItemInstance[] getArmorsList(boolean positive)
- + {
- + FastList<L2ItemInstance> list = FastList.newInstance();
- + if(positive)
- + {
- + for (L2ItemInstance item : _items)
- + {
- + if ((item != null) && (item.isEnchantable()) && item.isArmor())
- + {
- + int enchantLevel = Config.armorEnchantLevel;
- + if (Config.modifyItemEnchant)
- + {
- + if (Config.modifyItemEnchantList.containsKey(item.getItemId()))
- + {
- + enchantLevel = Config.modifyItemEnchantList.get(item.getItemId());
- + }
- + }
- +
- + if(item.getEnchantLevel() < enchantLevel)
- + {
- + list.add(item);
- + }
- + }
- + }
- + }
- + else
- + {
- + for (L2ItemInstance item : _items)
- + {
- + if ((item != null) && (item.isEnchantable()) && item.isArmor())
- + {
- + if(item.getEnchantLevel() != 0)
- + list.add(item);
- + }
- + }
- + }
- + L2ItemInstance[] result = list.toArray(new L2ItemInstance[list.size()]);
- + FastList.recycle(list);
- + return result;
- + }
- }
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemEnchanterInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemEnchanterInstance.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemEnchanterInstance.java (working copy)
- @@ -0,0 +1,380 @@
- +/*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package com.l2jfrozen.gameserver.model.actor.instance;
- +
- +import java.util.StringTokenizer;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.ai.CtrlIntention;
- +import com.l2jfrozen.gameserver.datatables.sql.IconTable;
- +import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
- +import com.l2jfrozen.gameserver.datatables.xml.AugmentationData;
- +import com.l2jfrozen.gameserver.network.SystemMessageId;
- +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
- +import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
- +import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
- +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
- +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
- +import com.l2jfrozen.util.random.Rnd;
- +
- +public class L2ItemEnchanterInstance extends L2FolkInstance
- +{
- + boolean flip = true;
- + String IngredientName = ItemTable.getInstance().getTemplate(Config.IngredientID).getName();
- +
- + /**
- + * @param objectId the object id
- + * @param template the template
- + */
- + public L2ItemEnchanterInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + /* (non-Javadoc)
- + * @see com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance#onAction(com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance)
- + */
- + @Override
- + public void onAction(L2PcInstance player)
- + {
- + if (!canTarget(player))
- + return;
- +
- + // Check if the L2PcInstance already target the L2NpcInstance
- + if (this != player.getTarget())
- + {
- + // Set the target of the L2PcInstance player
- + player.setTarget(this);
- +
- + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
- + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
- + player.sendPacket(my);
- + my = null;
- +
- + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
- + player.sendPacket(new ValidateLocation(this));
- + }
- + else
- + {
- + // Calculate the distance between the L2PcInstance and the L2NpcInstance
- + if (!canInteract(player))
- + {
- + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT
- + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
- + }
- + else
- + {
- + showChatWindow(player);
- + }
- + }
- +
- + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
- + player.sendPacket(new ActionFailed());
- + }
- +
- + @Override
- + public void showChatWindow(L2PcInstance player)
- + {
- + String filename = "data/html/itemEnchanter/disabled.htm";
- +
- + if (Config.npcEnchantItemsEnabled)
- + {
- + filename = "data/html/itemEnchanter/start.htm";
- + }
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + player.sendPacket(html);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + String filename = "data/html/itemEnchanter/template.htm";
- +
- + StringTokenizer st = new StringTokenizer(command, " ");
- + String actualCommand = st.nextToken();
- +
- + if (actualCommand.equalsIgnoreCase("enchant_weapon"))
- + {
- + L2ItemInstance[] weapon = player.getInventory().getWeaponsList(true);
- + final int size = weapon.length;
- + String text = "";
- + String bgcolor = "";
- +
- + if (size == 0)
- + {
- + filename = "data/html/itemEnchanter/empty_list.htm";
- + }
- + else if (size > 15)
- + {
- + filename = "data/html/itemEnchanter/long_list.htm";
- + }
- +
- + for (int i = 0; i != size; i++)
- + {
- + flip = !flip;
- + final int itemId = weapon[i].getItem().getItemId();
- + String name = weapon[i].getItemName();
- + String Action = "Item " + String.valueOf(weapon[i].getObjectId());
- + bgcolor = "";
- +
- + int enchantLevel = Config.weaponEnchantLevel;
- + if (Config.modifyItemEnchant)
- + {
- + if (Config.modifyItemEnchantList.containsKey(weapon[i].getItemId()))
- + {
- + enchantLevel = Config.modifyItemEnchantList.get(weapon[i].getItemId());
- + }
- + }
- +
- + if (flip == true)
- + {
- + bgcolor = "bgcolor=000000";
- + }
- +
- + text += "<table " + bgcolor + "><tr><td width=40><button action=\"bypass -h npc_" + getObjectId() + "_" + Action + "\" width=32 height=32 back=" + IconTable.getIcon(itemId) + " fore=" + IconTable.getIcon(itemId) + "></td><td width=220><table width=300><tr><td><font color=799BB0>+" + enchantLevel + " " + name + "</font></td><td></td></tr><tr><td><font color=B09B79> " + Config.InAmountWeapon + " " + IngredientName + "</font></td></tr></table></td></tr></table>";
- + }
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- +
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%list%", String.valueOf(text));
- + player.sendPacket(html);
- + }
- + if (actualCommand.equalsIgnoreCase("reset_weapon"))
- + {
- + L2ItemInstance[] weapon = player.getInventory().getWeaponsList(false);
- + final int size = weapon.length;
- + String text = "";
- + String bgcolor = "";
- +
- + if (size == 0)
- + {
- + filename = "data/html/itemEnchanter/empty_list.htm";
- + }
- + else if (size > 15)
- + {
- + filename = "data/html/itemEnchanter/long_list.htm";
- + }
- +
- + for (int i = 0; i != size; i++)
- + {
- + flip = !flip;
- + final int itemId = weapon[i].getItem().getItemId();
- + final int enchantLevel = weapon[i].getEnchantLevel();
- + String name = weapon[i].getItemName();
- + String Action = "Reset " + String.valueOf(weapon[i].getObjectId());
- + bgcolor = "";
- +
- +
- + if (flip == true)
- + {
- + bgcolor = "bgcolor=000000";
- + }
- +
- + text += "<table " + bgcolor + "><tr><td width=40><button action=\"bypass -h npc_" + getObjectId() + "_" + Action + "\" width=32 height=32 back=" + IconTable.getIcon(itemId) + " fore=" + IconTable.getIcon(itemId) + "></td><td width=220><table width=300><tr><td><font color=799BB0>+" + enchantLevel + " " + name + "</font></td><td></td></tr></table></td></tr></table>";
- + }
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- +
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%list%", String.valueOf(text));
- + player.sendPacket(html);
- + }
- + if (actualCommand.equalsIgnoreCase("enchant_armor"))
- + {
- + L2ItemInstance[] armor = player.getInventory().getArmorsList(true);
- + final int size = armor.length;
- + String text = "";
- + String bgcolor = "";
- +
- + if (size == 0)
- + {
- + filename = "data/html/itemEnchanter/empty_list.htm";
- + }
- + else if (size > 15)
- + {
- + filename = "data/html/itemEnchanter/long_list.htm";
- + }
- +
- + for (int i = 0; i != size; i++)
- + {
- + flip = !flip;
- + int itemId = armor[i].getItem().getItemId();
- + String name = armor[i].getItemName();
- + String Action = "Item " + String.valueOf(armor[i].getObjectId());
- + bgcolor = "";
- +
- + int enchantLevel = Config.armorEnchantLevel;
- + if (Config.modifyItemEnchant)
- + {
- + if (Config.modifyItemEnchantList.containsKey(armor[i].getItemId()))
- + {
- + enchantLevel = Config.modifyItemEnchantList.get(armor[i].getItemId());
- + }
- + }
- +
- + if (flip == true)
- + {
- + bgcolor = "bgcolor=000000";
- + }
- +
- + text += "<table " + bgcolor + "><tr><td width=40><button action=\"bypass -h npc_" + getObjectId() + "_" + Action + "\" width=32 height=32 back=" + IconTable.getIcon(itemId) + " fore=" + IconTable.getIcon(itemId) + "></td><td width=220><table width=300><tr><td><font color=799BB0>+" + enchantLevel + " " + name + "</font></td><td></td></tr><tr><td><font color=B09B79> " + Config.InAmountArmor + " " + IngredientName + "</font></td></tr></table></td></tr></table>";
- + }
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- +
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%list%", String.valueOf(text));
- + player.sendPacket(html);
- + }
- + if (actualCommand.equalsIgnoreCase("reset_armor"))
- + {
- + L2ItemInstance[] armor = player.getInventory().getArmorsList(false);
- + final int size = armor.length;
- + String text = "";
- + String bgcolor = "";
- +
- + if (size == 0)
- + {
- + filename = "data/html/itemEnchanter/empty_list.htm";
- + }
- + else if (size > 15)
- + {
- + filename = "data/html/itemEnchanter/long_list.htm";
- + }
- +
- + for (int i = 0; i != size; i++)
- + {
- + flip = !flip;
- + final int itemId = armor[i].getItem().getItemId();
- + final int enchantLevel = armor[i].getEnchantLevel();
- + String name = armor[i].getItemName();
- + String Action = "Reset " + String.valueOf(armor[i].getObjectId());
- + bgcolor = "";
- +
- + if (flip == true)
- + {
- + bgcolor = "bgcolor=000000";
- + }
- +
- + text += "<table " + bgcolor + "><tr><td width=40><button action=\"bypass -h npc_" + getObjectId() + "_" + Action + "\" width=32 height=32 back=" + IconTable.getIcon(itemId) + " fore=" + IconTable.getIcon(itemId) + "></td><td width=220><table width=300><tr><td><font color=799BB0>+" + enchantLevel + " " + name + "</font></td><td></td></tr></table></td></tr></table>";
- + }
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- +
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%list%", String.valueOf(text));
- + player.sendPacket(html);
- + }
- +
- + if (actualCommand.equalsIgnoreCase("Item"))
- + {
- + String bbx = st.nextToken();
- + int itemId = Integer.valueOf(bbx);
- + int itemCount = 0;
- +
- + int enchantLevel = Config.weaponEnchantLevel;
- + int amount = Config.InAmountWeapon;
- +
- + L2ItemInstance item = player.getInventory().getItemByObjectId(itemId);
- + if (item == null)
- + {
- + player.sendMessage("That item doesn't exist in your inventory.");
- + return;
- + }
- +
- + if (item.isArmor())
- + {
- + enchantLevel = Config.armorEnchantLevel;
- + amount = Config.InAmountArmor;
- + }
- +
- + if (Config.modifyItemEnchant)
- + {
- + if (Config.modifyItemEnchantList.containsKey(item.getItemId()))
- + {
- + enchantLevel = Config.modifyItemEnchantList.get(item.getItemId());
- + }
- + }
- +
- + if (player.getInventory().getItemByItemId(Config.IngredientID) != null)
- + {
- + itemCount = player.getInventory().getItemByItemId(Config.IngredientID).getCount();
- + if (itemCount < amount)
- + {
- + player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
- + }
- + else
- + {
- + player.destroyItemByItemId("enchantItem", Config.IngredientID, amount, player, true);
- + item.setEnchantLevel(enchantLevel);
- + player.sendPacket(new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED).addNumber(item.getEnchantLevel()).addItemName(item.getItemId()));
- +
- + if (item.isAugmentable())
- + {
- + if (Rnd.get(100) <= Config.augmentItemChance)
- + {
- + item.setAugmentation(AugmentationData.getInstance().generateRandomAugmentation(item, Rnd.get(7, 9), Rnd.get(2, 3)));
- + player.sendPacket(new SystemMessage(SystemMessageId.THE_ITEM_WAS_SUCCESSFULLY_AUGMENTED));
- + }
- + }
- +
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(item);
- + player.sendPacket(iu);
- + player.broadcastUserInfo();
- + }
- + }
- + else
- + {
- + player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
- + }
- + }
- + if (actualCommand.equalsIgnoreCase("Reset"))
- + {
- + String bbx = st.nextToken();
- + int itemId = Integer.valueOf(bbx);
- +
- + L2ItemInstance item = player.getInventory().getItemByObjectId(itemId);
- + if (item == null)
- + {
- + player.sendMessage("That item doesn't exist in your inventory.");
- + return;
- + }
- +
- + item.setEnchantLevel(0);
- + player.sendMessage("The enchantment state of item " + item.getItemName() + " has been reverted to 0.");
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(item);
- + player.sendPacket(iu);
- + player.broadcastUserInfo();
- + }
- +
- + super.onBypassFeedback(player, command);
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemInstance.java (revision 1004)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ItemInstance.java (working copy)
- @@ -49,6 +49,8 @@
- import com.l2jfrozen.gameserver.templates.L2Armor;
- import com.l2jfrozen.gameserver.templates.L2EtcItem;
- import com.l2jfrozen.gameserver.templates.L2Item;
- +import com.l2jfrozen.gameserver.templates.L2Weapon;
- +import com.l2jfrozen.gameserver.templates.L2WeaponType;
- import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
- import com.l2jfrozen.util.CloseUtil;
- import com.l2jfrozen.util.database.L2DatabaseFactory;
- @@ -594,6 +596,75 @@
- }
- /**
- + * Returns true if item is an EtcItem
- + * @return boolean
- + */
- + public boolean isEtcItem()
- + {
- + return (_item instanceof L2EtcItem);
- + }
- +
- + /**
- + * Returns true if item is a Weapon/Shield
- + * @return boolean
- + */
- + public boolean isWeapon()
- + {
- + return (_item instanceof L2Weapon);
- + }
- +
- + /**
- + * Returns true if item is an Armor
- + * @return boolean
- + */
- + public boolean isArmor()
- + {
- + return (_item instanceof L2Armor);
- + }
- +
- + /**
- + * Returns the characteristics of the L2EtcItem
- + * @return L2EtcItem
- + */
- + public L2EtcItem getEtcItem()
- + {
- + if (_item instanceof L2EtcItem)
- + {
- + return (L2EtcItem) _item;
- + }
- +
- + return null;
- + }
- +
- + /**
- + * Returns the characteristics of the L2Weapon
- + * @return L2Weapon
- + */
- + public L2Weapon getWeaponItem()
- + {
- + if (_item instanceof L2Weapon)
- + {
- + return (L2Weapon) _item;
- + }
- +
- + return null;
- + }
- +
- + /**
- + * Returns the characteristics of the L2Armor
- + * @return L2Armor
- + */
- + public L2Armor getArmorItem()
- + {
- + if (_item instanceof L2Armor)
- + {
- + return (L2Armor) _item;
- + }
- +
- + return null;
- + }
- +
- + /**
- * Returns the quantity of crystals for crystallization.
- *
- * @return int
- @@ -604,6 +675,16 @@
- }
- /**
- + * Returns the reference grade of the item.
- + *
- + * @return int
- + */
- + public final int getItemGrade()
- + {
- + return _item.getCrystalType();
- + }
- +
- + /**
- * Returns the reference price of the item.
- *
- * @return int
- @@ -1738,4 +1819,32 @@
- return true;
- }
- + /**
- + * @return true if item can be enchanted.
- + */
- + public boolean isEnchantable()
- + {
- + if (isHeroItem() || isShadowItem() || isEtcItem() || (getItem().getItemType() == L2WeaponType.ROD))
- + return false;
- +
- + if (getItemGrade() == L2Item.CRYSTAL_NONE)
- + return false;
- +
- + if (Config.nonEnchantableItemList.contains(_itemId))
- + return false;
- +
- + // only equipped items or in inventory can be enchanted
- + if ((getLocation() != L2ItemInstance.ItemLocation.INVENTORY) && (getLocation() != L2ItemInstance.ItemLocation.PAPERDOLL))
- + return false;
- +
- + return true;
- + }
- +
- + public boolean isAugmentable()
- + {
- + if(isAugmented() || isArmor() || getItem().getItemType() == L2WeaponType.NONE)
- + return false;
- +
- + return true;
- + }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement