Jump to content
  • 0

Question

Posted

hello can some help me to add this to acis?

 

### Eclipse Workspace Patch 1.0
#P elfobitch
Index: gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java   (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java   (working copy)
@@ -244,12 +244,22 @@
       protected int _itemId;
       protected int _count;
 
+      private int _enchant = -1;
+      private int _chance = 0;
+      
       public RewardItem(int itemId, int count)
       {
          _itemId = itemId;
          _count = count;
       }
 
+      public RewardItem(int itemId, int count, int enchant, int chance)
+      {
+         this(itemId, count);
+         _enchant = enchant;
+         _chance = chance;
+      }
+      
       public int getItemId()
       {
          return _itemId;
@@ -259,6 +269,9 @@
       {
          return _count;
       }
+            
+      public int getEnchant() { return _enchant; }
+      public int getEnchantChance() { return _chance; }
    }
 
    /**
@@ -1560,7 +1573,7 @@
       }
 
       if(itemCount > 0)
-         return new RewardItem(drop.getItemId(), itemCount);
+         return new RewardItem(drop.getItemId(), itemCount, drop.getEnchant(), drop.getEnchantChance());
       else if(itemCount == 0 && Config.DEBUG)
       {
          _log.fine("Roll produced 0 items to drop...");
@@ -1845,7 +1858,7 @@
          }
 
          if(itemCount > 0)
-            return new RewardItem(drop.getItemId(), itemCount);
+            return new RewardItem(drop.getItemId(), itemCount, drop.getEnchant(), drop.getEnchantChance());
          else if(itemCount == 0 && Config.DEBUG)
          {
             _log.fine("Roll produced 0 items to drop...");
@@ -2503,6 +2516,16 @@
          // Init the dropped L2ItemInstance and add it in the world as a visible object at the position where mob was last
          ditem = ItemTable.getInstance().createItem("Loot", item.getItemId(), item.getCount(), mainDamageDealer, this);
          ditem.getDropProtection().protect(mainDamageDealer);
+            if(item.getEnchant() > 0)
+            {
+               if(ditem.getItem().getType1() == L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE
+                     || ditem.getItem().getType1() == L2Item.TYPE1_SHIELD_ARMOR)
+               {
+                  double chance = Rnd.get(1, 100);
+                  if(chance <= item.getEnchantChance())
+                     ditem.setEnchantLevel(item.getEnchant());
+               }
+            }
          ditem.dropMe(this, newX, newY, newZ);
 
          // Add drop to auto destroy item task
Index: gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java   (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java   (working copy)
@@ -247,7 +247,7 @@
             {
                statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
                {
-                     "mobId", "itemId", "min", "max", "category", "chance"
+                     "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
                }) + " FROM custom_droplist ORDER BY mobId, chance DESC");
                ResultSet dropData = statement.executeQuery();
 
@@ -270,6 +270,8 @@
                   dropDat.setMinDrop(dropData.getInt("min"));
                   dropDat.setMaxDrop(dropData.getInt("max"));
                   dropDat.setChance(dropData.getInt("chance"));
+                  dropDat.setEnchant(dropData.getInt("enchant"));
+                  dropDat.setEnchantChance(dropData.getInt("enchantChance"));
 
                   int category = dropData.getInt("category");
 
@@ -295,7 +297,7 @@
          {
             statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
             {
-                  "mobId", "itemId", "min", "max", "category", "chance"
+                  "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
             }) + " FROM droplist ORDER BY mobId, chance DESC");
             ResultSet dropData = statement.executeQuery();
             L2DropData dropDat = null;
@@ -319,6 +321,8 @@
                dropDat.setMinDrop(dropData.getInt("min"));
                dropDat.setMaxDrop(dropData.getInt("max"));
                dropDat.setChance(dropData.getInt("chance"));
+               dropDat.setEnchant(dropData.getInt("enchant"));
+               dropDat.setEnchantChance(dropData.getInt("enchantChance"));
 
                int category = dropData.getInt("category");
 
Index: gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java   (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java   (working copy)
@@ -82,6 +82,27 @@
       addDrop(npc, drop, false);
    }
 
+   public void addQuestDrop(int npcID, int itemID, int min, int max, int chance, String questID, String[] states,
+         int enchant, int enchantChance)
+   {
+      L2NpcTemplate npc = npcTable.getTemplate(npcID);
+      if (npc == null)
+      {
+         _log.info("FeanorInterface: Npc "+npcID+" is null..");
+         return;
+      }
+      L2DropData drop = new L2DropData();
+      drop.setItemId(itemID);
+      drop.setMinDrop(min);
+      drop.setMaxDrop(max);
+      drop.setEnchant(enchant);
+      drop.setEnchantChance(enchantChance);
+      drop.setChance(chance);
+      drop.setQuestID(questID);
+      drop.addStates(states);
+      addDrop(npc, drop, false);
+   }
+   
    /**
     * Adds a new Drop to an NPC
     *
@@ -106,7 +127,31 @@
 
       addDrop(npc, drop, sweep);
    }
+   
+   public void addDrop(int npcID, int itemID, int min, int max, boolean sweep, int chance,
+         int enchant, int enchantChance) throws NullPointerException
+   {
+      L2NpcTemplate npc = npcTable.getTemplate(npcID);
+      if (npc == null)
+      {
+         if (Config.DEBUG)
+         {
+            _log.warning("Npc doesnt Exist");
+         }
+         throw new NullPointerException();
+      }
+      L2DropData drop = new L2DropData();
+      drop.setItemId(itemID);
+      drop.setMinDrop(min);
+      drop.setMaxDrop(max);
+      drop.setChance(chance);
+      drop.setEnchant(enchant);
+      drop.setEnchantChance(enchantChance);
+      
+      addDrop(npc, drop, sweep);
+   }
 
+   
    /**
     * Adds a new drop to an NPC. If the drop is sweep, it adds it to the NPC's Sweep category If the drop is non-sweep,
     * it creates a new category for this drop.
Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java   (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java   (working copy)
@@ -407,7 +407,7 @@
                      e.printStackTrace();
                }
             }
-            else if(st.countTokens() == 6)
+            else if(st.countTokens() == 8)
             {
                try
                {
@@ -417,8 +417,10 @@
                   int min = Integer.parseInt(st.nextToken());
                   int max = Integer.parseInt(st.nextToken());
                   int chance = Integer.parseInt(st.nextToken());
+                  int enchant = Integer.parseInt(st.nextToken());
+                  int enchantChance = Integer.parseInt(st.nextToken());
 
-                  updateDropData(activeChar, npcId, itemId, min, max, category, chance);
+                  updateDropData(activeChar, npcId, itemId, min, max, category, chance, enchant, enchantChance);
                }
                catch(Exception e)
                {
@@ -430,7 +432,7 @@
             }
             else
             {
-               activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
+               activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance> <enchant> <enchantChance>]");
             }
 
             st = null;
@@ -440,7 +442,7 @@
             if(Config.ENABLE_ALL_EXCEPTIONS)
                e.printStackTrace();
             
-            activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
+            activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance> <enchant> <enchantChance>]");
          }
       }
       else if(command.startsWith("admin_add_drop "))
@@ -474,7 +476,7 @@
                   npcData = null;
                }
             }
-            else if(st.countTokens() == 6)
+            else if(st.countTokens() == 8)
             {
                try
                {
@@ -484,8 +486,10 @@
                   int min = Integer.parseInt(st.nextToken());
                   int max = Integer.parseInt(st.nextToken());
                   int chance = Integer.parseInt(st.nextToken());
+                  int enchant = Integer.parseInt(st.nextToken());
+                  int enchantChance = Integer.parseInt(st.nextToken());
 
-                  addDropData(activeChar, npcId, itemId, min, max, category, chance);
+                  addDropData(activeChar, npcId, itemId, min, max, category, chance, enchant, enchantChance);
                }
                catch(Exception e)
                {
@@ -497,7 +501,7 @@
             }
             else
             {
-               activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance>]");
+               activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance> <enchant> <enchantChance>]");
             }
 
             st = null;
@@ -507,7 +511,7 @@
             if(Config.ENABLE_ALL_EXCEPTIONS)
                e.printStackTrace();
             
-            activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance>]");
+            activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance> <enchant> <enchantChance>]");
          }
       }
       else if(command.startsWith("admin_del_drop "))
@@ -1323,7 +1327,7 @@
       {
          con = L2DatabaseFactory.getInstance().getConnection(false);
 
-         PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
+         PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance, enchant, enchantChance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
          ResultSet dropData = statement.executeQuery();
 
          NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
@@ -1340,9 +1344,11 @@
             replyMSG.append("<tr><td>MIN(" + dropData.getInt("min") + ")</td><td><edit var=\"min\" width=80></td></tr>");
             replyMSG.append("<tr><td>MAX(" + dropData.getInt("max") + ")</td><td><edit var=\"max\" width=80></td></tr>");
             replyMSG.append("<tr><td>CHANCE(" + dropData.getInt("chance") + ")</td><td><edit var=\"chance\" width=80></td></tr>");
+            replyMSG.append("<tr><td>ENC-VALUE(" + dropData.getInt("enchant") + ")</td><td><edit var=\"enchant\" width=80></td></tr>");
+            replyMSG.append("<tr><td>ENC-CHANCE(" + dropData.getInt("enchantChance") + ")</td><td><edit var=\"enchantChance\" width=80></td></tr>");
             replyMSG.append("</table>");
             replyMSG.append("<center>");
-            replyMSG.append("<button value=\"Save Modify\" action=\"bypass -h admin_edit_drop " + npcId + " " + itemId + " " + category + " $min $max $chance\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+            replyMSG.append("<button value=\"Save Modify\" action=\"bypass -h admin_edit_drop " + npcId + " " + itemId + " " + category + " $min $max $chance $enchant $enchantChance\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
             replyMSG.append("<br><button value=\"DropList\" action=\"bypass -h admin_show_droplist " + dropData.getInt("mobId") + "\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
             replyMSG.append("</center>");
          }
@@ -1383,9 +1389,11 @@
       replyMSG.append("<tr><td>MAX</td><td><edit var=\"max\" width=80></td></tr>");
       replyMSG.append("<tr><td>CATEGORY(sweep=-1)</td><td><edit var=\"category\" width=80></td></tr>");
       replyMSG.append("<tr><td>CHANCE(0-1000000)</td><td><edit var=\"chance\" width=80></td></tr>");
+      replyMSG.append("<tr><td>ENC-VALUE(0-65535)</td><td><edit var=\"enchant\" width=80></td></tr>");
+      replyMSG.append("<tr><td>ENC-CHANCE(0-100)</td><td><edit var=\"enchantChance\" width=80></td></tr>");
       replyMSG.append("</table>");
       replyMSG.append("<center>");
-      replyMSG.append("<button value=\"SAVE\" action=\"bypass -h admin_add_drop " + npcData.npcId + " $itemId $category $min $max $chance\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+      replyMSG.append("<button value=\"SAVE\" action=\"bypass -h admin_add_drop " + npcData.npcId + " $itemId $category $min $max $chance $enchant $enchantChance\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
       replyMSG.append("<br><button value=\"DropList\" action=\"bypass -h admin_show_droplist " + npcData.npcId + "\"  width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
       replyMSG.append("</center>");
       replyMSG.append("</body></html>");
@@ -1397,7 +1405,7 @@
       replyMSG = null;
    }
 
-   private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
+   private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance, int enchant, int enchantChance)
    {
       Connection con = null;
 
@@ -1405,13 +1413,15 @@
       {
          con = L2DatabaseFactory.getInstance().getConnection(false);
 
-         PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");
+         PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=?, enchant=?, enchantChance=? WHERE mobId=? AND itemId=? AND category=?");
          statement.setInt(1, min);
          statement.setInt(2, max);
          statement.setInt(3, chance);
          statement.setInt(4, npcId);
          statement.setInt(5, itemId);
          statement.setInt(6, category);
+         statement.setInt(7, enchant);
+         statement.setInt(8, enchantChance);
 
          statement.execute();
          statement.close();
@@ -1464,7 +1474,7 @@
       }
    }
 
-   private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
+   private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance, int enchant, int enchantChance)
    {
       Connection con = null;
 
@@ -1472,13 +1482,16 @@
       {
          con = L2DatabaseFactory.getInstance().getConnection(false);
 
-         PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance) values(?,?,?,?,?,?)");
+         PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance, enchant, enchantChance) values(?,?,?,?,?,?,?,?)");
          statement.setInt(1, npcId);
          statement.setInt(2, itemId);
          statement.setInt(3, min);
          statement.setInt(4, max);
          statement.setInt(5, category);
          statement.setInt(6, chance);
+         statement.setInt(7, enchant);
+         statement.setInt(8, enchantChance);
+         
          statement.execute();
          statement.close();
          statement = null;
@@ -1573,7 +1586,7 @@
 
          PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
          {
-               "mobId", "itemId", "min", "max", "category", "chance"
+               "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
          }) + " FROM droplist WHERE mobId=?");
          statement.setInt(1, npcId);
          ResultSet dropDataList = statement.executeQuery();
@@ -1586,6 +1599,8 @@
             dropData.setMinDrop(dropDataList.getInt("min"));
             dropData.setMaxDrop(dropDataList.getInt("max"));
             dropData.setChance(dropDataList.getInt("chance"));
+            dropData.setEnchant(dropDataList.getInt("enchant"));
+            dropData.setEnchantChance(dropDataList.getInt("enchantChance"));
 
             int category = dropDataList.getInt("category");
 
Index: gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java   (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java   (working copy)
@@ -33,6 +33,8 @@
    private int _minDrop;
    private int _maxDrop;
    private int _chance;
+   private int _dropEnchant = -1;
+   private int _enchantChance = 0;
    private String _questID = null;
    private String[] _stateID = null;
 
@@ -55,7 +57,17 @@
    {
       _itemId = itemId;
    }
-
+   
+   public void setEnchant(final int enchant)
+   {
+      _dropEnchant = enchant;
+   }
+   
+   public void setEnchantChance(final int chance)
+   {
+      _enchantChance = chance;
+   }
+   
    /**
     * Returns the minimum quantity of items dropped
     *
@@ -86,6 +98,16 @@
       return _chance;
    }
 
+   public int getEnchant()
+   {
+      return _dropEnchant;
+   }
+   
+   public int getEnchantChance()
+   {
+      return _enchantChance;
+   }
+
    /**
     * Sets the value for minimal quantity of dropped items
     *

 


ALTER TABLE `droplist` ADD `enchant` int(5) DEFAULT -1;
ALTER TABLE `droplist` ADD `enchantChance` int(3) DEFAULT 0;
ALTER TABLE `custom_droplist` ADD `enchant` int(5) DEFAULT -1;
ALTER TABLE `custom_droplist` ADD `enchantChance` int(3) DEFAULT 0;

 

2 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • 10-09-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • Had to set up a bunch of virtual numbers for a small project last month, and SMS-Activate worked fine for quick testing. For longer-term stuff, I ended up using Telxi — their service made it easy to handle voice and messaging without extra headaches. It kept things simple and reliable, which mattered a lot when I was juggling other tasks.
    • So how to build this. As a concept. Farming actions should be done by coding. Target choose AI. Avoid getting stuck.   What is AI actually needed for inside a game?.   Chatting moving and choosing Example call for custom town event. Second example come for pvp at that area. It Is amazing to have players respond.   Is there a way to run something on each players PC? Like what boting programs do? Do it. To avoid server lag.   Second. AI for monster's. To be able to feel each monster like a pvp. is what makes a game a masterpiece. Plus insulting. In real Time.   AI for npcs. It can help but is not Worth if it causes even a fragment of lag.   AI and party. Clan. Can it be smart enough to have any meaning to use it as a real player?  If yes it should be added. AI should also be used on pets.   Chatting  with allied AI. If you can explain to it to focus the healer and it does. it's becoming perfect.   It should be like a friend and an assistant.    How this should be done. Different AI for fake players Different for monsters. Why? Monsters are easy to manage. Players are not. You must add also the events rules. Example. CTF go and try to score.   How to make AI for pvp. Set rules to avoid feeding. How? Smart call for friends. Events go all in unless something is wrong. Overseer needed.  Should npc try to be a real player? No. Unless it's a custom server. Npc must try to buy or auto earn only with fixed prices. To avoid getting scammed exploited. Should they farm forever? Yes. Should they progress? Yes. Having people on farm zones makes the game alive.   Now.  What is needed.   An AI as an overseer. Check and correct the rest. An AI for the players. An AI for the monsters. Npc really optional not worth. How it should be done.   Make the training data you want. Via interface assist. And copy paste them inside the main mother model. So people can actually use and train the AI for their own unique server.   If it is possible to explain as GM char  And the AI can be asked to save it. It would be the perfect scenario. Also option to showcase to you.   So one program for the AI. And another for training. Can AI be used for low rate servers? No it will never work. Can it be used for custom server's? Yes it will be able to thrive.   If there is anything you can't understand in general.   Or if you don't understand why everything should be done exactly as explained above. I can help you with it  in absolute detail.
    • 我们的 Telegram 频道 已达到 3000 名订阅者! 感谢大家对我们项目的支持与关注! 我们即将举办一场精彩的抽奖或比赛,专为您准备! 不要错过参与的机会 — 立即订阅:https://t.me/accsforyou_shop✅ 活跃链接: 数字商品商店(网站):前往 商店 Telegram 机器人:前往 用于购买 Telegram Stars 的机器人:前往 SMM 面板:前往 – 推广您的社交媒体账户。 我们向您展示当前的 促销与特别优惠,可用于购买我们平台的产品与服务: 1. 使用优惠码 OCTOBER2025(8% 折扣)在十月期间通过我们的网站或机器人购物!首次购买还可使用优惠码 SOCNET(15% 折扣)。 2. 获得 $1 商店余额或 10–20% 折扣 —— 只需在我们网站注册后在论坛留言:“SEND ME BONUS, MY USERNAME IS...”。 3. 首次试用 SMM 面板可获得 $1 奖励 —— 只需在我们网站(支持页面)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和用于购买 Stars 的机器人中赠送 Telegram Stars!
    • 我们的 Telegram 频道 已达到 3000 名订阅者! 感谢大家对我们项目的支持与关注! 我们即将举办一场精彩的抽奖或比赛,专为您准备! 不要错过参与的机会 — 立即订阅:https://t.me/accsforyou_shop✅ 活跃链接: 数字商品商店(网站):前往 商店 Telegram 机器人:前往 用于购买 Telegram Stars 的机器人:前往 SMM 面板:前往 – 推广您的社交媒体账户。 我们向您展示当前的 促销与特别优惠,可用于购买我们平台的产品与服务: 1. 使用优惠码 OCTOBER2025(8% 折扣)在十月期间通过我们的网站或机器人购物!首次购买还可使用优惠码 SOCNET(15% 折扣)。 2. 获得 $1 商店余额或 10–20% 折扣 —— 只需在我们网站注册后在论坛留言:“SEND ME BONUS, MY USERNAME IS...”。 3. 首次试用 SMM 面板可获得 $1 奖励 —— 只需在我们网站(支持页面)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和用于购买 Stars 的机器人中赠送 Telegram Stars!
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock