20.10.2020 | 08:41
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум L2edit.Ru » Lineage 2 » Мануалы » Enchant Menu for custom servers
Enchant Menu for custom servers
ОвощДата: Четверг, 08.04.2010, 12:16 | Сообщение # 1
Овощ
Группа: Администратор
Сообщений: 2491
Награды: 162
Репутация: 5547
Статус: Offline

Code
============================================
@@ L2PcInstance.java
============================================
+    public void showEnchantHtml()
+    {
+  TextBuilder text = new TextBuilder();
+  text.append("<html>");
+  text.append("<body>");  
+  text.append("<title>Enchant Menu</title>");
+  text.append("<center>");
+  text.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
+  text.append("</center>");
+  text.append("<br><br>");
+  text.append("<table width=\"85%\"><tr><td>Hello, "+getName()+", You can choose your item to enchant!</td></tr></table><br>");
+  text.append("<table>");
+  text.append("<tr>");
+  text.append("<td><button value=\"\" action=\"\" width=32 height=32 back=\"icon.NOIMAGE\" fore=\"icon.NOIMAGE\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_headItem\" width=32 height=32 back=\"icon.armor_leather_helmet_i00\" fore=\"icon.armor_leather_helmet_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"\" width=32 height=32 back=\"icon.NOIMAGE\" fore=\"icon.NOIMAGE\"></td>");
+  text.append("<td><button value=\"\" action=\"\" width=32 height=32 back=\"icon.NOIMAGE\" fore=\"icon.NOIMAGE\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_neck\" width=32 height=32 back=\"icon.accessary_another_worlds_necklace_i00\" fore=\"icon.accessary_another_worlds_necklace_i00\"></td>");
+  text.append("</tr>");
+  text.append("<tr>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_rhand\" width=32 height=32 back=\"Icon.weapon_sword_of_priest_i00\" fore=\"Icon.weapon_sword_of_priest_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_chestItem\" width=32 height=32 back=\"Icon.armor_t89_ul_i00\" fore=\"Icon.armor_t89_ul_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_lhand\" width=32 height=32 back=\"Icon.shield_doom_shield_i00\" fore=\"Icon.shield_doom_shield_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_rfinger\" width=32 height=32 back=\"Icon.accessary_another_worlds_earing_i00\" fore=\"Icon.accessary_another_worlds_earing_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_lfinger\" width=32 height=32 back=\"Icon.accessary_another_worlds_earing_i00\" fore=\"Icon.accessary_another_worlds_earing_i00\"></td>");
+  text.append("</tr>");
+  text.append("<tr>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_rhand\" width=32 height=32 back=\"Icon.armor_t89_g_i00\" fore=\"Icon.armor_t89_g_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_chestItem\" width=32 height=32 back=\"Icon.armor_t89_l_i00\" fore=\"Icon.armor_t89_l_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_lhand\" width=32 height=32 back=\"Icon.armor_t89_b_i00\" fore=\"Icon.armor_t89_b_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_rfinger\" width=32 height=32 back=\"Icon.accessary_another_worlds_ring_i00\" fore=\"Icon.accessary_another_worlds_ring_i00\"></td>");
+  text.append("<td><button value=\"\" action=\"bypass -h enchant_lfinger\" width=32 height=32 back=\"Icon.accessary_another_worlds_ring_i00\" fore=\"Icon.accessary_another_worlds_ring_i00\"></td>");
+  text.append("</tr>");
+  text.append("</table>");
+  text.append("<center><img src=\"L2UI.SquareWhite\" width=\"280\" height=\"1\"></center><br>");
+  text.append("<table width=\"85%\"><tr><td>Thanks xAddytzu</td></tr></table>");
+  text.append("</body>");
+  text.append("</html>");
+  NpcHtmlMessage html = new NpcHtmlMessage(1);
+  html.setHtml(text.toString());
+  sendPacket(html);
+    }

============================================
@@ RequestBypassToServer.java
============================================

+   else if (_command.startsWith("enchant_"))
+   {
+    SystemMessage sm;
+    int maxEnchantLevelw = 0;
+    int maxEnchantLevela = 0;
+    int maxEnchantLevelj = 0;
+    maxEnchantLevelw = Config.ENCHANT_MAX_WEAPON;
+    maxEnchantLevela = Config.ENCHANT_MAX_ARMOR;
+    maxEnchantLevelj = Config.ENCHANT_MAX_JEWELRY;
+    Inventory inv = activeChar.getInventory();
+    L2ItemInstance rhand = inv.getPaperdollItem(Inventory.PAPERDOLL_RHAND);
+    L2ItemInstance lhand = inv.getPaperdollItem(Inventory.PAPERDOLL_LHAND);
+    L2ItemInstance lrhand = inv.getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
+     
+    L2ItemInstance chestItem = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+    L2ItemInstance legsItem = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+    L2ItemInstance headItem = inv.getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+    L2ItemInstance glovesItem = inv.getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+    L2ItemInstance feetItem = inv.getPaperdollItem(Inventory.PAPERDOLL_FEET);
+     
+    L2ItemInstance neck = inv.getPaperdollItem(Inventory.PAPERDOLL_NECK);
+    L2ItemInstance rfinger = inv.getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
+    L2ItemInstance lfinger = inv.getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
+    L2ItemInstance rear = inv.getPaperdollItem(Inventory.PAPERDOLL_REAR);
+    L2ItemInstance lear = inv.getPaperdollItem(Inventory.PAPERDOLL_LEAR);
+     
+    if(!activeChar.validateBypass(_command))
+     return;
+
+    int endOfId = _command.indexOf('_', 5);
+    String id;
+    if (endOfId > 0)
+     id = _command.substring(4, endOfId);
+    else
+     id = _command.substring(4);
+    try
+    {
+     if (_command.substring(endOfId+1).startsWith("rhand"))
+     {
+       
+               if (rhand.getOwnerId() != activeChar.getObjectId() || (rhand.getEnchantLevel() >= maxEnchantLevelw && maxEnchantLevelw != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (rhand == null)
+       return;
+               if (rhand.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(rhand.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(rhand.getEnchantLevel());
+                sm.addItemName(rhand.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      rhand.setEnchantLevel(rhand.getEnchantLevel() + 1);
+      rhand.updateDatabase();
+       //spreeKills = 0;
+     }
+     else if (_command.substring(endOfId+1).startsWith("lhand"))
+     {
+               if (lhand.getOwnerId() != activeChar.getObjectId() || (lhand.getEnchantLevel() >= maxEnchantLevelw && maxEnchantLevelw != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (lhand == null)
+       return;
+               if (lhand.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(lhand.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(lhand.getEnchantLevel());
+                sm.addItemName(lhand.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      lhand.setEnchantLevel(lhand.getEnchantLevel() + 1);
+      lhand.updateDatabase();
+      //spreeKills = 0;
+     }
+     else if (_command.substring(endOfId+1).startsWith("lrhand"))
+     {
+               if (lrhand.getOwnerId() != activeChar.getObjectId() || (lrhand.getEnchantLevel() >= maxEnchantLevelw && maxEnchantLevelw != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (lrhand == null)
+       return;
+                if (lrhand.getEnchantLevel() == 0)
+                {
+                 sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                 sm.addItemName(lrhand.getItemId());
+                 activeChar.sendPacket(sm);
+                }
+                else
+                {
+                 sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                 sm.addNumber(lrhand.getEnchantLevel());
+                 sm.addItemName(lrhand.getItemId());
+                 activeChar.sendPacket(sm);
+                }
+       lrhand.setEnchantLevel(lrhand.getEnchantLevel() + 1);
+       lrhand.updateDatabase();
+       //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("chestItem"))
+     {
+               if (chestItem.getOwnerId() != activeChar.getObjectId() || (chestItem.getEnchantLevel() >= maxEnchantLevela && maxEnchantLevela != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (chestItem == null)
+       return;
+                if (chestItem.getEnchantLevel() == 0)
+                {
+                 sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                 sm.addItemName(chestItem.getItemId());
+                 activeChar.sendPacket(sm);
+                }
+                else
+                {
+                 sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                 sm.addNumber(chestItem.getEnchantLevel());
+                 sm.addItemName(chestItem.getItemId());
+                 activeChar.sendPacket(sm);
+                }
+       chestItem.setEnchantLevel(chestItem.getEnchantLevel() + 1);
+       chestItem.updateDatabase();
+       //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("legsItem"))
+     {
+               if (legsItem.getOwnerId() != activeChar.getObjectId() || (legsItem.getEnchantLevel() >= maxEnchantLevela && maxEnchantLevela != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (legsItem == null)
+       return;
+               if (legsItem.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(legsItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(legsItem.getEnchantLevel());
+                sm.addItemName(legsItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      legsItem.setEnchantLevel(legsItem.getEnchantLevel() + 1);
+      legsItem.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("headItem"))
+     {
+               if (headItem.getOwnerId() != activeChar.getObjectId() || (headItem.getEnchantLevel() >= maxEnchantLevela && maxEnchantLevela != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (headItem == null)
+       return;
+                if (headItem.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(headItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(headItem.getEnchantLevel());
+                sm.addItemName(headItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      headItem.setEnchantLevel(headItem.getEnchantLevel() + 1);
+      headItem.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("glovesItem"))
+     {
+               if (glovesItem.getOwnerId() != activeChar.getObjectId() || (glovesItem.getEnchantLevel() >= maxEnchantLevela && maxEnchantLevela != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (glovesItem == null)
+       return;
+               if (glovesItem.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(glovesItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(glovesItem.getEnchantLevel());
+                sm.addItemName(glovesItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      glovesItem.setEnchantLevel(glovesItem.getEnchantLevel() + 1);
+      glovesItem.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("feetItem"))
+     {
+               if (feetItem.getOwnerId() != activeChar.getObjectId() || (feetItem.getEnchantLevel() >= maxEnchantLevela && maxEnchantLevela != 0))
+               {
+                activeChar.sendPacket(new


Вёрстка макетов и создание клан сайтов на uCoz, STRESS - в ICQ
Хлеба и зрелищ

загрузка наград ...
 
ОвощДата: Четверг, 08.04.2010, 12:16 | Сообщение # 2
Овощ
Группа: Администратор
Сообщений: 2491
Награды: 162
Репутация: 5547
Статус: Offline
Code
SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (feetItem == null)
+       return;
+                if (feetItem.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(feetItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(feetItem.getEnchantLevel());
+                sm.addItemName(feetItem.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      feetItem.setEnchantLevel(feetItem.getEnchantLevel() + 1);
+      feetItem.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("neck"))
+     {
+               if (neck.getOwnerId() != activeChar.getObjectId() || (neck.getEnchantLevel() >= maxEnchantLevelj && maxEnchantLevelj != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (neck == null)
+       return;
+                if (neck.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(neck.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(neck.getEnchantLevel());
+                sm.addItemName(neck.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      neck.setEnchantLevel(neck.getEnchantLevel() + 1);
+      neck.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("rfinger"))
+     {
+               if (rfinger.getOwnerId() != activeChar.getObjectId() || (rfinger.getEnchantLevel() >= maxEnchantLevelj && maxEnchantLevelj != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (rfinger == null)
+       return;
+               if (rfinger.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(rfinger.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(rfinger.getEnchantLevel());
+       sm.addItemName(rfinger.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      rfinger.setEnchantLevel(rfinger.getEnchantLevel() + 1);
+      rfinger.updateDatabase();
+      //spreeKills = 0;
+     }
+     else if (_command.substring(endOfId+1).startsWith("lfinger"))
+     {
+               if (lfinger.getOwnerId() != activeChar.getObjectId() || (lfinger.getEnchantLevel() >= maxEnchantLevelj && maxEnchantLevelj != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (lfinger == null)
+       return;
+               if (lfinger.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(lfinger.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(lfinger.getEnchantLevel());
+                sm.addItemName(lfinger.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      lfinger.setEnchantLevel(lfinger.getEnchantLevel() + 1);
+      lfinger.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("rear"))
+     {
+               if (rear.getOwnerId() != activeChar.getObjectId() || (rear.getEnchantLevel() >= maxEnchantLevelj && maxEnchantLevelj != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (rear == null)
+       return;
+               if (rear.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(rear.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(rear.getEnchantLevel());
+                sm.addItemName(rear.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      rear.setEnchantLevel(rear.getEnchantLevel() + 1);
+      rear.updateDatabase();
+      //spreeKills = 0;
+       
+     }
+     else if (_command.substring(endOfId+1).startsWith("lear"))
+     {
+               if (lear.getOwnerId() != activeChar.getObjectId() || (lear.getEnchantLevel() >= maxEnchantLevelw && maxEnchantLevelw != 0))
+               {
+                activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+                return;
+               }
+      if (lear == null)
+       return;
+               if (lear.getEnchantLevel() == 0)
+               {
+                sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+                sm.addItemName(lear.getItemId());
+                activeChar.sendPacket(sm);
+               }
+               else
+               {
+                sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
+                sm.addNumber(lear.getEnchantLevel());
+                sm.addItemName(lear.getItemId());
+                activeChar.sendPacket(sm);
+               }
+      lear.setEnchantLevel(lear.getEnchantLevel() + 1);
+      lear.updateDatabase();
+      //spreeKills = 0;
+     }
+     activeChar.sendPacket(new ActionFailed());
+    }
+    catch (NumberFormatException nfe) {}
+   }


Вёрстка макетов и создание клан сайтов на uCoz, STRESS - в ICQ
Хлеба и зрелищ

загрузка наград ...
 
ОвощДата: Четверг, 08.04.2010, 12:16 | Сообщение # 3
Овощ
Группа: Администратор
Сообщений: 2491
Награды: 162
Репутация: 5547
Статус: Offline
всё не влезло, поэтому разбил на 2 сообщения

Вёрстка макетов и создание клан сайтов на uCoz, STRESS - в ICQ
Хлеба и зрелищ

загрузка наград ...
 
Форум L2edit.Ru » Lineage 2 » Мануалы » Enchant Menu for custom servers
  • Страница 1 из 1
  • 1
Поиск: