sb.append("<table width=400>");
ItemInstance[] arr = activeChar.getInventory().getItems();
int len = arr.length;
for (int i = 0; i < len; i++)
{
ItemInstance _item = arr[i];
if ((_item == null) || (_item.getTemplate() instanceof EtcItemTemplate) || _item.getTemplate().isBelt() || _item.getTemplate().isUnderwear() || !_item.isEquipped() || _item.isHeroWeapon() || _item.getTemplate().isBracelet() || _item.getTemplate().isCloak() || (_item.getTemplate().getCrystalType() == ItemTemplate.Grade.NONE) || ((_item.getItemId() >= 7816) && (_item.getItemId() <= 7831)) || _item.isShadowItem() || _item.isCommonItem() || _item.isTemporalItem() || (_item.getEnchantLevel() >= (Config.MAX_ENCHANT + 1)))
{
continue;
}
sb.append("<tr><td><img src=icon." + _item.getTemplate().getIcon() + " width=32 height=32></td><td>");
sb.append("<font color=\"LEVEL\">" + _item.getTemplate().getName() + " " + (_item.getEnchantLevel() <= 0 ? "" : "</font><br><font color=3293F3>Enchanted to: +" + _item.getEnchantLevel()) + "</font><br1>");
sb.append("Enchant for: <font color=\"LEVEL\">" + name + "</font>");
sb.append("<img src=\"l2ui.squaregray\" width=\"170\" height=\"1\">");
sb.append("</td><td>");
sb.append("<button value=\"Enchant\" action=\"bypass _bbsechant;enchlistpage;" + _item.getObjectId() + "\" width=75 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
sb.append("</td><td>");
sb.append("<button value=\"Attribute\" action=\"bypass _bbsechant;enchlistpageAtrChus;" + _item.getObjectId() + "\" width=75 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
sb.append("</td></tr>");
}
sb.append("</table>");
String content = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "pages/enchanter.htm", activeChar);
content = content.replace("%enchanter%", sb.toString());
ShowBoard.separateAndSend(BbsUtil.htmlAll(content, activeChar), activeChar);
}
if (command.startsWith("_bbsechant;enchlistpage;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int ItemForEchantObjID = Integer.parseInt(st.nextToken());
String name = "None Name";
name = ItemHolder.getInstance().getTemplate(Config.ENCHANTER_ITEM_ID).getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemForEchantObjID);
StringBuilder sb = new StringBuilder();
sb.append("Enchant selected ingredient?<br1><table width=300>");
sb.append("<tr><td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td><td width=236><center>");
sb.append("<font color=\"LEVEL\">" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() <= 0 ? "" : "</font><br1><font color=3293F3>Enchanted to: +" + EhchantItem.getEnchantLevel()) + "</font><br1>");
sb.append("Enchant for: <font color=\"LEVEL\">" + name + "</font>");
sb.append("<img src=\"l2ui.squaregray\" width=\"236\" height=\"1\"><center></td>");
sb.append("<td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td>");
sb.append("</tr>");
sb.append("</table>");
sb.append("<br>");
sb.append("<br>");
sb.append("<table border=0 width=400><tr><td width=200>");
for (int i = 0; i < Config.ENCHANT_LEVELS.length; i++)
{
sb.append("<center><button value=\"Add +" + Config.ENCHANT_LEVELS[i] + " (Price:" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_PRICE_WPN[i] : Config.ENCHANT_PRICE_ARM[i]) + " " + name + ")\" action=\"bypass _bbsechant;enchantgo;" + Config.ENCHANT_LEVELS[i] + ";" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_PRICE_WPN[i] : Config.ENCHANT_PRICE_ARM[i]) + ";" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br1>");
}
sb.append("</td></tr></table><br1><button value=\"Back\" action=\"bypass _bbsechant;\" width=70 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
String content = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "pages/enchanter.htm", activeChar);
content = content.replace("%enchanter%", sb.toString());
ShowBoard.separateAndSend(BbsUtil.htmlAll(content, activeChar), activeChar);
}
if (command.startsWith("_bbsechant;enchlistpageAtrChus;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int ItemForEchantObjID = Integer.parseInt(st.nextToken());
String name = "None Name";
name = ItemHolder.getInstance().getTemplate(Config.ENCHANTER_ITEM_ID).getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemForEchantObjID);
StringBuilder sb = new StringBuilder();
sb.append("Enchant selected ingredient?<br><table width=300>");
sb.append("<tr><td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td><td width=236><center>");
sb.append("<font color=\"LEVEL\">" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() <= 0 ? "" : "</font><br1><font color=3293F3>Enchanted to: +" + EhchantItem.getEnchantLevel()) + "</font><br1>");
sb.append("Enchant for: <font color=\"LEVEL\">" + name + "</font>");
sb.append("<img src=\"l2ui.squaregray\" width=\"236\" height=\"1\"><center></td>");
sb.append("<td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td>");
sb.append("</tr>");
sb.append("</table>");
sb.append("<br>");
sb.append("<br>");
sb.append("<table border=0 width=400><tr><td width=200>");
sb.append("<center><img src=icon.etc_wind_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Wind \" action=\"bypass _bbsechant;enchlistpageAtr;2;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br><center><img src=icon.etc_earth_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Earth \" action=\"bypass _bbsechant;enchlistpageAtr;3;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br><center><img src=icon.etc_fire_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Fire \" action=\"bypass _bbsechant;enchlistpageAtr;0;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("</td><td width=200>");
sb.append("<center><img src=icon.etc_water_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Water \" action=\"bypass _bbsechant;enchlistpageAtr;1;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br><center><img src=icon.etc_holy_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Divine \" action=\"bypass _bbsechant;enchlistpageAtr;4;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br><center><img src=icon.etc_unholy_stone_i00 width=32 height=32></center><br>");
sb.append("<button value=\"Dark \" action=\"bypass _bbsechant;enchlistpageAtr;5;" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("</td></tr></table><br1><button value=\"Back\" action=\"bypass _bbsechant;\" width=70 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
String content = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "pages/enchanter.htm", activeChar);
content = content.replace("%enchanter%", sb.toString());
ShowBoard.separateAndSend(BbsUtil.htmlAll(content, activeChar), activeChar);
}
if (command.startsWith("_bbsechant;enchlistpageAtr;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int AtributType = Integer.parseInt(st.nextToken());
int ItemForEchantObjID = Integer.parseInt(st.nextToken());
String ElementName = "";
if (AtributType == 0)
{
ElementName = "Fire";
}
else if (AtributType == 1)
{
ElementName = "Water";
}
else if (AtributType == 2)
{
ElementName = "Wind";
}
else if (AtributType == 3)
{
ElementName = "Earth";
}
else if (AtributType == 4)
{
ElementName = "Divine";
}
else if (AtributType == 5)
{
ElementName = "Dark";
}
String name = "None Name";
name = ItemHolder.getInstance().getTemplate(Config.ENCHANTER_ITEM_ID).getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemForEchantObjID);
StringBuilder sb = new StringBuilder();
sb.append("Chosen Element: <font color=\"LEVEL\">" + ElementName + "</font><br1> Enchant selected ingredient?<br1><table width=300>");
sb.append("<tr><td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td><td width=236><center>");
sb.append("<font color=\"LEVEL\">" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() <= 0 ? "" : "</font><br1><font color=3293F3>Enchant to: +" + EhchantItem.getEnchantLevel()) + "</font><br1>");
sb.append("Enchant for: <font color=\"LEVEL\">" + name + "</font>");
sb.append("<img src=\"l2ui.squaregray\" width=\"236\" height=\"1\"><center></td>");
sb.append("<td width=32><img src=icon." + EhchantItem.getTemplate().getIcon() + " width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td>");
sb.append("</tr>");
sb.append("</table>");
sb.append("<br1>");
sb.append("<br1>");
if (!EhchantItem.getTemplate().getName().contains("PvP") && ((EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S80) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S84) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R95) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R99)))
{
sb.append("<table border=0 width=400><tr><td width=200>");
for (int i = 0; i < (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS.length : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM.length); i++)
{
sb.append("<center><button value=\"Add +" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS[i] : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM[i]) + " (Price:" + (EhchantItem.getTemplate().isWeapon() ? Config.ATTRIBUTE_PRICE_WPN[i] : Config.ATTRIBUTE_PRICE_ARM[i]) + " " + name + ")\" action=\"bypass _bbsechant;enchantgoAtr;" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS[i] : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM[i]) + ";" + AtributType + ";" + (EhchantItem.getTemplate().isWeapon() ? Config.ATTRIBUTE_PRICE_WPN[i] : Config.ATTRIBUTE_PRICE_ARM[i]) + ";" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br1>");
}
sb.append("</td></tr></table><br1>");
}
else if (EhchantItem.getTemplate().getName().contains("PvP") && Config.ENCHANT_ATT_PVP && ((EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S80) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S84) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R95) || (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.R99)))
{
sb.append("<table border=0 width=400><tr><td width=200>");
for (int i = 0; i < (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS.length : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM.length); i++)
{
sb.append("<center><button value=\"Add +" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS[i] : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM[i]) + " (Price:" + (EhchantItem.getTemplate().isWeapon() ? Config.ATTRIBUTE_PRICE_WPN[i] : Config.ATTRIBUTE_PRICE_ARM[i]) + " " + name + ")\" action=\"bypass _bbsechant;enchantgoAtr;" + (EhchantItem.getTemplate().isWeapon() ? Config.ENCHANT_ATTRIBUTE_LEVELS[i] : Config.ENCHANT_ATTRIBUTE_LEVELS_ARM[i]) + ";" + AtributType + ";" + (EhchantItem.getTemplate().isWeapon() ? Config.ATTRIBUTE_PRICE_WPN[i] : Config.ATTRIBUTE_PRICE_ARM[i]) + ";" + ItemForEchantObjID + "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">");
sb.append("<br1>");
}
sb.append("</td></tr></table><br1>");
}
else
{
sb.append("<table border=0 width=400><tr><td width=200>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<center><font color=\"LEVEL\">Enchant is impossible!</font></center>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("</td></tr></table><br>");
}
sb.append("<button value=\"Back\" action=\"bypass _bbsechant;\" width=70 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
String content = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "pages/enchanter.htm", activeChar);
content = content.replace("%enchanter%", sb.toString());
ShowBoard.separateAndSend(BbsUtil.htmlAll(content, activeChar), activeChar);
}
if (command.startsWith("_bbsechant;enchantgo;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int EchantVal = Integer.parseInt(st.nextToken());
int EchantPrice = Integer.parseInt(st.nextToken());
int EchantObjID = Integer.parseInt(st.nextToken());
ItemTemplate item = ItemHolder.getInstance().getTemplate(Config.ENCHANTER_ITEM_ID);
ItemInstance pay = activeChar.getInventory().getItemByItemId(item.getItemId());
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(EchantObjID);
if ((pay != null) && (pay.getCount() >= EchantPrice))
{
activeChar.getInventory().destroyItem(pay, EchantPrice);
if (EhchantItem.isEquipped())
{
activeChar.getInventory().unEquipItemInBodySlot(EhchantItem.getEquipSlot());
}
EhchantItem.setEnchantLevel(EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo();
activeChar.sendMessage("" + EhchantItem.getTemplate().getName() + " was enchanted to " + EchantVal + ". Thanks.");
onBypassCommand(activeChar, "_bbsechant;");
}
else
{
activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
}
}
if (command.startsWith("_bbsechant;enchantgoAtr;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int EchantVal = Integer.parseInt(st.nextToken());
int AtrType = Integer.parseInt(st.nextToken());
Element el = Element.getElementById(AtrType);
int EchantPrice = Integer.parseInt(st.nextToken());
int EchantObjID = Integer.parseInt(st.nextToken());
ItemTemplate item = ItemHolder.getInstance().getTemplate(Config.ENCHANTER_ITEM_ID);
ItemInstance pay = activeChar.getInventory().getItemByItemId(item.getItemId());
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(EchantObjID);
if (EhchantItem.isWeapon())
{
if ((pay != null) && (pay.getCount() >= EchantPrice))
{
activeChar.getInventory().destroyItem(pay, EchantPrice);
if (EhchantItem.isEquipped())
{
activeChar.getInventory().unEquipItemInBodySlot(EhchantItem.getEquipSlot());
}
EhchantItem.setAttributeElement(el, EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo();
activeChar.sendMessage("" + EhchantItem.getTemplate().getName() + " was enchanted to " + EchantVal + ". Thanks.");
onBypassCommand(activeChar, "_bbsechant;");
}
else
{
activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
}
}
else if (EhchantItem.isArmor())
{
if (!canEnchantArmorAttribute(AtrType, EhchantItem))
{
activeChar.sendMessage("attribute reservation by region?");
onBypassCommand(activeChar, "_bbsechant;");
return;
}
if ((pay != null) && (pay.getCount() >= EchantPrice))
{
activeChar.getInventory().destroyItem(pay, EchantPrice);
if (EhchantItem.isEquipped())
{
activeChar.getInventory().unEquipItemInBodySlot(EhchantItem.getEquipSlot());
}
EhchantItem.setAttributeElement(el, EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo();
activeChar.sendMessage("" + EhchantItem.getTemplate().getName() + " was enchanted to " + EchantVal + ". Thanks.");
onBypassCommand(activeChar, "_bbsechant;");
}
}
}
}