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>
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.
Hello guys i have make at the multisell to give the weapons +10, its works but does not appear the enchant level!!!
Maybe someone can give me the interface.u for interlude?
i want it like this
Question
l2jkain
0 answers to this question
Recommended Posts
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.