Свернуть ↑
public class EnchantBBSManager extends BaseBBSManager
{
public EnchantBBSManager()
{
}
public static EnchantBBSManager getInstance()
{
if(_Instance == null)
_Instance = new EnchantBBSManager();
return _Instance;
}
public void parsecmd(String command, L2PcInstance activeChar)
{
if(command.equals("_bbsenchant"))
{
int price = 1;
String name = "None Name";
name = ItemTable.getInstance().getTemplate(Config.ALT_CB_ ENCH_ITEM).getName();
TextBuilder sb = new TextBuilder();
sb.append("<table width=350>");
L2ItemInstance arr[] = activeChar.getInventory().getItems();
int len = arr.length;
for(int i = 0; i < len; i++)
{
L2ItemInstance _item = arr[i];
if(_item != null && !(_item.getItem() instanceof L2EtcItem) && _item.isEquipped() && !_item.isHeroItem() && _item.getItem().getCrystalType() != 0 && (_item.getItemId() < 7816 || _item.getItemId() > 7831) && !_item.isShadowItem() && !_item.isCommonItem() && !_item.isWear() && _item.getEnchantLevel() < 26)
{
sb.append((new StringBuilder()).append("<tr><td><img src=
icon. width=32 height=32></td><td>").toString());
sb.append((new StringBuilder()).append("<font color=\"LEVEL\">").append(_item.getItem().getName( )).append(" ").append(_item.getEnchantLevel() > 0 ? (new StringBuilder()).append("</font><font color=3293F3>\u0417\u0430\u0442\u043E\u0447\u0435\ u043D\u043E \u043D\u0430: +").append(_item.getEnchantLevel()).toString() : "").append("</font><br1>").toString());
sb.append((new StringBuilder()).append("\u0417\u0430\u0442\u043E\ u0447\u043A\u0430 \u0437\u0430: <font color=\"LEVEL\">").append(name).append("</font>").toString());
sb.append("<img src=\"l2ui.squaregray\" width=\"170\" height=\"1\">");
sb.append("</td><td>");
sb.append((new StringBuilder()).append("<button value=\"\u0417\u0430\u0442\u043E\u0447\u0438\u0442 \u044C\" action=\"bypass -h _bbsenchant;enchlistpage;").append(_item.getObject Id()).append("\" width=70 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">").toString());
sb.append("</td></tr>");
}
}
sb.append("</table>");
String content = HtmCache.getInstance().getHtmForce(activeChar.getH tmlPrefix(), "data/html/CommunityBoard/804.htm");
content = content.replace("%enchanter%", sb.toString());
separateAndSend(content, activeChar);
}
if(command.startsWith("_bbsenchant;enchlistpage;") )
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int ItemForEchantObjID = Integer.parseInt(st.nextToken());
int price = 0;
String name = "None Name";
name = ItemTable.getInstance().getTemplate(Config.ALT_CB_ ENCH_ITEM).getName();
L2ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemFo rEchantObjID);
if(EhchantItem.getItem().getCrystalType() == 1)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 2)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 3)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 4)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 5)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 6)
{
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
} else
if(EhchantItem.getItem().getCrystalType() == 7)
if(EhchantItem.getItem().getType2() == 0)
price = 2;
else
price = 1;
TextBuilder sb = new TextBuilder();
sb.append("\u0414\u043B\u044F \u0437\u0430\u0442\u043E\u0447\u043A\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u0430 \u0432\u0435\u0449\u044C:<br1><table width=300>");
sb.append((new StringBuilder()).append("<tr><td width=32><img src=
icon. width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td><td width=236><center>").toString());
sb.append((new StringBuilder()).append("<font color=\"LEVEL\">").append(EhchantItem.getItem().ge tName()).append(" ").append(EhchantItem.getEnchantLevel() > 0 ? (new StringBuilder()).append("</font><font color=3293F3>\u0417\u0430\u0442\u043E\u0447\u0435\ u043D\u043E \u043D\u0430: +").append(EhchantItem.getEnchantLevel()).toString () : "").append("</font><br1>").toString());
sb.append((new StringBuilder()).append("\u0417\u0430\u0442\u043E\ u0447\u043A\u0430 \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u 0438\u0442\u0441\u044F \u0437\u0430: <font color=\"LEVEL\">").append(name).append("</font>").toString());
sb.append("<img src=\"l2ui.squaregray\" width=\"236\" height=\"1\"><center></td>");
sb.append((new StringBuilder()).append("<td width=32><img src=icon. width=32 height=32> <img src=\"l2ui.squaregray\" width=\"32\" height=\"1\"></td>").toString());
sb.append("</tr>");
sb.append("</table>");
sb.append("<br1>");
sb.append("<br1>");
sb.append("<table border=0 width=400><tr><td width=200>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +5 (\u0426\u0435\u043D\u0430:").append(price * (price + 1)).append(" ").append(name).append(")\" action=\"bypass -h _bbsenchant;enchantgo;5;").append(price * (price + 1)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +6 (\u0426\u0435\u043D\u0430:").append(price * (price + 2)).append(" ").append(name).append(")\" action=\"bypass -h _bbsenchant;enchantgo;6;").append(price * (price + 2)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +7 (\u0426\u0435\u043D\u0430:").append(price * (price + 3)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;7;").append(price * (price + 3)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +8 (\u0426\u0435\u043D\u0430:").append(price * (price + 4)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;8;").append(price * (price + 4)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +9 (\u0426\u0435\u043D\u0430:").append(price * (price + 5)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;9;").append(price * (price + 5)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +10 (\u0426\u0435\u043D\u0430:").append(price * (price + 6)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;10;").append(price * (price + 6)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +11 (\u0426\u0435\u043D\u0430:").append(price * (price + 7)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;11;").append(price * (price + 7)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +12 (\u0426\u0435\u043D\u0430:").append(price * (price + 8)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;12;").append(price * (price + 8)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +13 (\u0426\u0435\u043D\u0430:").append(price * (price + 9)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;13;").append(price * (price + 9)).append(";").append(ItemForEchantObjID).append( "\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +14 (\u0426\u0435\u043D\u0430:").append(price * (price + 10)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;14;").append(price * (price + 10)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +15 (\u0426\u0435\u043D\u0430:").append(price * (price + 11)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;15;").append(price * (price + 11)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("</td><td width=200>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +16 (\u0426\u0435\u043D\u0430:").append(price * (price + 12)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;16;").append(price * (price + 12)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +17 (\u0426\u0435\u043D\u0430:").append(price * (price + 13)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;17;").append(price * (price + 13)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +18 (\u0426\u0435\u043D\u0430:").append(price * (price + 14)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;18;").append(price * (price + 14)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +19 (\u0426\u0435\u043D\u0430:").append(price * (price + 15)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;19;").append(price * (price + 15)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +20 (\u0426\u0435\u043D\u0430:").append(price * (price + 16)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;20;").append(price * (price + 16)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +21 (\u0426\u0435\u043D\u0430:").append(price * (price + 17)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;21;").append(price * (price + 17)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +22 (\u0426\u0435\u043D\u0430:").append(price * (price + 18)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;22;").append(price * (price + 18)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +23 (\u0426\u0435\u043D\u0430:").append(price * (price + 19)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;23;").append(price * (price + 19)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +24 (\u0426\u0435\u043D\u0430:").append(price * (price + 20)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;24;").append(price * (price + 20)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +25 (\u0426\u0435\u043D\u0430:").append(price * (price + 21)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;25;").append(price * (price + 21)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("<br1>");
sb.append((new StringBuilder()).append("<button value=\"\u041D\u0430 +26 (\u0426\u0435\u043D\u0430:").append(price * (price + 22)).append(" ").append(name).append(")\" action=\"bypass -h _bbsechant;enchantgo;26;").append(price * (price + 22)).append(";").append(ItemForEchantObjID).append ("\" width=200 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">").toString());
sb.append("</td></tr></table><br1><button value=\"\u041D\u0430\u0437\u0430\u0434\" action=\"bypass -h _bbsechant\" width=70 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
String content = HtmCache.getInstance().getHtmForce(activeChar.getH tmlPrefix(), "data/html/CommunityBoard/804.htm");
content = content.replace("%enchanter%", sb.toString());
separateAndSend(content, activeChar);
}
if(command.startsWith("_bbsenchant;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());
L2Item item = ItemTable.getInstance().getTemplate(Config.ALT_CB_ ENCH_ITEM);
L2ItemInstance pay = activeChar.getInventory().getItemByItemId(item.get ItemId());
L2ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(Echant ObjID);
_log.info((new StringBuilder()).append("WMZSELLER: Item: ").append(EhchantItem).append(" Val: ").append(EchantVal).append(" Price: ").append(EchantPrice).append(" Player: ").append(activeChar.getName()).append("").toStrin g());
if(activeChar.isProcessingTransaction() || activeChar.getPrivateStoreType() != 0 || activeChar.getActiveTradeList() != null)
{
activeChar.sendPacket(SystemMessage.getSystemMessa ge(SystemMessageId.CANNOT_ENCHANT_WHILE_STORE));
return;
}
if(pay != null && pay.getCount() >= (long)EchantPrice)
{
activeChar.destroyItem("Enchanting", pay, EchantPrice, activeChar, true);
EhchantItem.setEnchantLevel(EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.broadcastUserInfo();
activeChar.sendMessage((new StringBuilder()).append("").append(EhchantItem.get Item().getName()).append(" Enchant OK. New level ").append(EchantVal).append(". Thx.").toString());
parsecmd("_bbsenchant", activeChar);
} else
{
activeChar.sendPacket(SystemMessage.getSystemMessa ge(SystemMessageId.INCORRECT_ITEM_COUNT));