Jump to content
  • 0

Droplist L2Jacis


Question

Posted
Hello somebody help me to create this good code it is loading more not to getting to aggregate in all the game monsters does anyone help?

 



### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java    (revision 121)
+++ java/net/sf/l2j/gameserver/GameServer.java    (working copy)
@@ -49,6 +49,7 @@
 import net.sf.l2j.gameserver.datatables.ClanTable;
 import net.sf.l2j.gameserver.datatables.DoorTable;
 import net.sf.l2j.gameserver.datatables.EnchantTable;
+import net.sf.l2j.gameserver.datatables.FeanorTable;
 import net.sf.l2j.gameserver.datatables.FishTable;
 import net.sf.l2j.gameserver.datatables.GmListTable;
 import net.sf.l2j.gameserver.datatables.HelperBuffTable;
@@ -193,6 +194,7 @@

+ StringUtil.printSection("Feanor Drop All Mobs");
+ FeanorTable.getInstance();
+
StringUtil.printSection("System");
 
Index: java/net/sf/l2j/gameserver/datatables/FeanorTable.java
===================================================================
@@ -0,0 +1,138 @@
--- java/net/sf/l2j/gameserver/datatables/FeanorTable.java    (revision 01)
+++ 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.model.item.DropCategory;
+import net.sf.l2j.gameserver.model.item.DropData;
+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
+{
+ private static Logger _log = Logger.getLogger(FeanorTable.class.getName());
+
+ private final Map<Integer, List<DropCategory>> _feanor = new HashMap<>();
+
+ protected FeanorTable()
+ {
+ try
+ {
+ File file = new File("./data/xml/feanor.xml");
+ Document doc = XMLDocumentFactory.getInstance().loadDocument(file);
+
+ Node n = doc.getFirstChild();
+ for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+ {
+ if ("feanor".equalsIgnoreCase(d.getNodeName()))
+ {
+ NamedNodeMap attrs = d.getAttributes();
+ int feanorId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
+
+ List<DropCategory> category;
+ if (_feanor.containsKey(feanorId))
+ category = _feanor.get(feanorId);
+ else
+ {
+ category = new ArrayList<>();
+ _feanor.put(feanorId, category);
+ }
+
+ for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
+ {
+ DropData dropDat = new DropData();
+ if ("item".equalsIgnoreCase(cd.getNodeName()))
+ {
+ attrs = cd.getAttributes();
+ int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
+ int categoryType = Integer.parseInt(attrs.getNamedItem("category").getNodeValue());
+ int minDrop = Integer.parseInt(attrs.getNamedItem("minDrop").getNodeValue());
+ int maxDrop = Integer.parseInt(attrs.getNamedItem("maxDrop").getNodeValue());
+ int chance = Integer.parseInt(attrs.getNamedItem("chance").getNodeValue());
+
+ dropDat.setItemId(id);
+ dropDat.setMinDrop(minDrop);
+ dropDat.setMaxDrop(maxDrop);
+ dropDat.setChance(chance);
+
+ if (ItemTable.getInstance().getTemplate(dropDat.getItemId()) == null)
+ {
+ _log.warning("FeanorTable: FeanorTable data for undefined item template! feanorId: " + feanorId + ", itemId: " + dropDat.getItemId());
+ continue;
+ }
+
+ boolean catExists = false;
+ for (DropCategory cat : category)
+ {
+ // if the category exists, add the drop to this category.
+ if (cat.getCategoryType() == categoryType)
+ {
+ cat.addDropData(dropDat, false);
+ catExists = true;
+ break;
+ }
+ }
+
+ // if the category doesn't exit, create it and add the drop
+ if (!catExists)
+ {
+ DropCategory cat = new DropCategory(categoryType);
+ cat.addDropData(dropDat, false);
+ category.add(cat);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ _log.warning("FeanorTable: Error while creating table: " + e);
+ }
+ _log.info("FeanorTable: Loaded " + _feanor.size() + " drops feanor.");
+ }
+
+ public List<DropCategory> getTemplate(int feanorId)
+ {
+ return _feanor.get(feanorId);
+ }
+
+ public static FeanorTable getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final FeanorTable _instance = new FeanorTable();
+ }
+}
### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/xml/feanor.xml
===================================================================
--- data/xml/feanor.xml (révision 1)
+++ data/xml/feanor.xml (révision 2)
@@ -0,564 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<list>
<group id="1"><!-- Autor Williams -->
<item id="3470" category="7" chance="30000" />>
</group>
</list>


0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...