Jump to content
  • 0

Feanor For Acis 350 In Xml By : Williams


Question

Posted (edited)

Good evening everyone, Good tried to create a Feanor to acis using drope system for NPCs but do not have much knowledge of java if one could help me thank you do not know where to post this so if I'm wrong I apologize I use google translator if the wrong word descupe me !!!


### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/xml/feanor.xml
===================================================================
--- data/xml/feanor.xml (revision 0)
+++ data/xml/feanor.xml (working copy)
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='utf-8'?>
+<list>
+   <template itemid="3470" min="5" max="10" chance="550000"/>
+</list>
\ No newline at end of file
Index: data/html/admin/server_menu.htm
===================================================================
--- data/html/admin/server_menu.htm (revision 332)
+++ data/html/admin/server_menu.htm (working copy)
@@ -11,7 +11,7 @@
    Reload
    <table width=240>
        <tr>
-           <td><combobox width=120 height=21 var="cb" list=acar;config;crest;cw;door;htm;item;multisell;npc;npcwalker;scripts;skill;teleport;zone;></td>
+           <td><combobox width=120 height=21 var="cb" list=acar;config;crest;cw;door;htm;feanor;item;multisell;npc;npcwalker;scripts;skill;teleport;zone;></td>
            <td><button value="Reload" action="bypass -h admin_reload $cb" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></td>
        </tr>
    </table><br>
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (revision 332)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (working copy)
@@ -30,6 +30,7 @@
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.datatables.SkipTable;
 import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
 import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
@@ -227,6 +228,11 @@
                    ItemTable.getInstance().reload();
                    activeChar.sendMessage("Items' templates have been reloaded.");
                }
+               else if (type.startsWith("feanor"))
+               {
+                   FeanorTable.getInstance();
+                   activeChar.sendMessage("Feanor list have been reloaded.");
+               }
                else if (type.equals("multisell"))
                {
                    MultisellData.getInstance().reload();
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java  (revision 332)
+++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
@@ -56,6 +56,7 @@
 import net.sf.l2j.gameserver.datatables.RecipeTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SkillTreeTable;
+import net.sf.l2j.gameserver.datatables.FeanorTable;
 import net.sf.l2j.gameserver.datatables.SoulCrystalsTable;
 import net.sf.l2j.gameserver.datatables.SpawnTable;
 import net.sf.l2j.gameserver.datatables.SpellbookTable;
@@ -194,6 +195,7 @@
        HennaTable.getInstance();
        HelperBuffTable.getInstance();
        CursedWeaponsManager.getInstance();
+       FeanorTable.getInstance();
       
        Util.printSection("Clans");
        ClanTable.getInstance();
Index: java/net/sf/l2j/gameserver/datatables/NpcTable.java
===================================================================
--- java/net/sf/l2j/gameserver/datatables/NpcTable.java (revision 332)
+++ java/net/sf/l2j/gameserver/datatables/NpcTable.java (working copy)
@@ -23,6 +23,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;

+import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.model.L2MinionData;
 import net.sf.l2j.gameserver.model.L2NpcAIData;
 import net.sf.l2j.gameserver.model.L2Skill;
@@ -201,6 +202,10 @@
                                                    _log.warning("Droplist data for undefined itemId: " + data.getItemId());
                                                    continue;
                                                }
+                                              
+                                               if (Config.ENABLE_FEANOR && FeanorTable.isFeanor(data.getItemId()))
+                                                   continue;
+                                              
                                                template.addDropData(dropDat, category);
                                            }
                                        }
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 332)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -374,6 +374,9 @@
    public static int GRID_NEIGHBOR_TURNON_TIME;
    public static int GRID_NEIGHBOR_TURNOFF_TIME;
   
+   /** Feanor Drop */
+   public static boolean ENABLE_FEANOR;
+  
    // --------------------------------------------------
    // Players
    // --------------------------------------------------
@@ -995,6 +998,8 @@
            GRID_NEIGHBOR_TURNON_TIME = npcs.getProperty("GridNeighborTurnOnTime", 1);
            GRID_NEIGHBOR_TURNOFF_TIME = npcs.getProperty("GridNeighborTurnOffTime", 90);
           
+           ENABLE_FEANOR = npcs.getProperty("EnableFeanorList", false);
+          
            // players
            ExProperties players = load(PLAYERS_FILE);
            STARTING_ADENA = players.getProperty("StartingAdena", 100);
Index: config/npcs.properties
===================================================================
--- config/npcs.properties  (revision 332)
+++ config/npcs.properties  (working copy)
@@ -263,4 +263,12 @@
 # The always on option allows to ignore all this and let all grids be active at all times
 GridsAlwaysOn = False
 GridNeighborTurnOnTime = 1
-GridNeighborTurnOffTime = 90
\ No newline at end of file
+GridNeighborTurnOffTime = 90
+
+#=============================================================
+#                        Feanor Settings
+#=============================================================
+
+# Enable skip all items from feanor.xml out from droplist of all monsters.
+# Default: False
+EnableFeanorList = False
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/datatables/FeanorTable.java
===================================================================
--- java/net/sf/l2j/gameserver/datatables/FeanorTable.java  (revision 0)
+++ java/net/sf/l2j/gameserver/datatables/FeanorTable.java  (working copy)
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.datatables;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.templates.StatsSet;
+import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author Williams
+ *
+ */
+public class FeanorTable
+{
+   protected static final Logger _log = Logger.getLogger(FeanorTable.class.getName());
+      
+   private static List<Feanor> _feanor;
+      
+   public static FeanorTable getInstance()
+   {
+       return SingletonHolder._instance;
+   }
+      
+   private static class SingletonHolder
+   {
+       protected static final FeanorTable _instance = new FeanorTable();
+   }
+  
+   protected FeanorTable()
+   {
+       _feanor = new ArrayList<>();
+       loadFeanor();
+   }
+  
+   public void reload()
+   {
+       _feanor.clear();
+       loadFeanor();
+   }
+      
+   private void loadFeanor()
+   {
+       try
+       {
+           File f = new File("./data/xml/feanor.xml");
+           Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
+              
+           Node n = doc.getFirstChild();
+           for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+           {
+               if (d.getNodeName().equalsIgnoreCase("template"))
+               {
+                   NamedNodeMap attrs = d.getAttributes();
+                  
+                   int itemId = Integer.valueOf(attrs.getNamedItem("itemId").getNodeValue());
+                   int min = Integer.parseInt(attrs.getNamedItem("min").getNodeValue());
+                   int max = Integer.parseInt(attrs.getNamedItem("max").getNodeValue());
+                   int chance = Integer.parseInt(attrs.getNamedItem("chance").getNodeValue());
+                  
+                   StatsSet set = new StatsSet();
+                   set.set("itemId", itemId);
+                   set.set("min", min);
+                   set.set("max", max);
+                   set.set("chance", chance);
+                  
+                   _feanor.add(new Feanor(set));
+               }
+           }  
+       }  
+       catch (Exception e)
+       {
+           _log.warning("Exception: FeanorTable loadFeanor: " + e);
+       }
+      
+       _log.info("FeanorTable: Loaded " + _feanor.size() + " item's template(s).");
+   }
+
+   public static boolean isFeanor(int itemId)
+   {
+       return _feanor.contains(itemId);
+   }
+  
+   public class Feanor
+   {
+       private int _itemId;
+       private int _chance;
+       private int _min;
+       private int _max;
+      
+       public Feanor(StatsSet set)
+       {
+           _itemId = set.getInteger("itemId");
+           _chance = set.getInteger("chance");
+           _min = set.getInteger("min");
+           _max = set.getInteger("max");
+       }
+      
+       public int getItemId()
+       {
+           return _itemId;
+       }
+      
+       public int getChance()
+       {
+           return _chance;
+       }
+      
+       public int getMax()
+       {
+           return _max;
+       }
+
+       public int getMin()
+       {
+           return _min;
+       }
+   }
+}

http://pastebin.com/2mgUAQVe

Edited by l2jkain

2 answers to this question

Recommended Posts

  • 0
Posted

Lol, just laughing out loud.

 

That piece of code does the exact inverse of original feanor system - it doesn't add items based events, it adds restriction limit. When you add a itemId on the xml, it eliminates it from spawn drop.

 

isFeanor(int) doesn't even work correctly. it's a List<Faenor> not a List<Integer>. Comparing a Feanor object with a itemId can't work. Does it simply compile ?

 

It's like a terrible mix of 2 customs.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...