Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Mobius_C6_Interlude
- diff --git dist/game/config/General.ini dist/game/config/General.ini
- index 3d04989..2c9ca99 100644
- --- dist/game/config/General.ini
- +++ dist/game/config/General.ini
- @@ -700,3 +700,14 @@
- # Excluded packet list.
- # Packet names that are excluded from debugging, separated by commas.
- ExcludedPacketList = Attack, AutoAttackStart, AutoAttackStop, DeleteObject, ExAutoSoulShot, ExPacket, ExStorageMaxCount, MoveToLocation, NpcInfo, NpcSay, SkillCoolTime, SocialAction, StatusUpdate, UserInfo, ValidatePosition
- +
- +
- +#==========================================================================
- +# RANDOM CRAFT SYSTEM NPC - ID - CONSUME - REFRESH - CREATE - ITEMS
- +#==========================================================================
- +
- +RandomCraftItemId = 57
- +
- +RandomCraftConsumeRefresh = 50000
- +
- +RandromCraftConsumeCreate = 300000
- diff --git dist/game/data/RandomCraft.xml dist/game/data/RandomCraft.xml
- new file mode 100644
- index 0000000..7ab3417
- --- /dev/null
- +++ dist/game/data/RandomCraft.xml
- @@ -0,0 +1,190 @@
- +<?xml version="1.0" encoding="UTF-8"?>
- +<rewards>
- + <item id="8762" count="1" chance="20" announce="false"/>
- + <item id="8790" count="1" chance="40" announce="true"/>
- + <item id="8793" count="1" chance="40" announce="true"/>
- + <item id="8794" count="1" chance="40" announce="true"/>
- + <item id="8798" count="1" chance="40" announce="true"/>
- + <item id="8801" count="1" chance="40" announce="true"/>
- + <item id="8803" count="1" chance="40" announce="true"/>
- + <item id="8807" count="1" chance="40" announce="true"/>
- + <item id="8811" count="1" chance="40" announce="true"/>
- + <item id="8809" count="1" chance="40" announce="true"/>
- + <item id="8810" count="1" chance="40" announce="true"/>
- + <item id="8812" count="1" chance="40" announce="true"/>
- + <item id="8813" count="1" chance="40" announce="true"/>
- + <item id="8814" count="1" chance="40" announce="true"/>
- + <item id="8815" count="1" chance="40" announce="true"/>
- + <item id="8816" count="1" chance="40" announce="true"/>
- + <item id="8817" count="1" chance="40" announce="true"/>
- + <item id="8818" count="1" chance="40" announce="true"/>
- + <item id="8819" count="1" chance="40" announce="true"/>
- + <item id="8820" count="1" chance="40" announce="true"/>
- + <item id="8752" count="3" chance="58" announce="false"/>
- + <item id="8742" count="5" chance="65" announce="false"/>
- + <item id="8732" count="8" chance="75" announce="false"/>
- + <item id="7577" count="1" chance="5" announce="true"/>
- + <item id="6373" count="1" chance="8" announce="true"/>
- + <item id="6374" count="1" chance="8" announce="true"/>
- + <item id="6375" count="1" chance="8" announce="true"/>
- + <item id="6376" count="1" chance="8" announce="true"/>
- + <item id="6377" count="1" chance="8" announce="true"/>
- + <item id="6378" count="1" chance="8" announce="true"/>
- + <item id="6587" count="1" chance="5" announce="true"/>
- + <item id="6379" count="1" chance="8" announce="true"/>
- + <item id="6380" count="1" chance="8" announce="true"/>
- + <item id="6381" count="1" chance="8" announce="true"/>
- + <item id="6382" count="1" chance="8" announce="true"/>
- + <item id="6383" count="1" chance="8" announce="true"/>
- + <item id="6384" count="1" chance="8" announce="true"/>
- + <item id="6385" count="1" chance="8" announce="true"/>
- + <item id="6386" count="1" chance="8" announce="true"/>
- + <item id="2383" count="1" chance="40" announce="false"/>
- + <item id="2395" count="1" chance="40" announce="false"/>
- + <item id="2409" count="1" chance="40" announce="false"/>
- + <item id="2419" count="1" chance="40" announce="false"/>
- + <item id="5774" count="1" chance="40" announce="false"/>
- + <item id="5775" count="1" chance="40" announce="false"/>
- + <item id="5776" count="1" chance="40" announce="false"/>
- + <item id="5786" count="1" chance="40" announce="false"/>
- + <item id="5787" count="1" chance="40" announce="false"/>
- + <item id="5788" count="1" chance="40" announce="false"/>
- + <item id="365" count="1" chance="40" announce="false"/>
- + <item id="388" count="1" chance="40" announce="false"/>
- + <item id="512" count="1" chance="40" announce="false"/>
- + <item id="641" count="1" chance="40" announce="false"/>
- + <item id="2385" count="1" chance="40" announce="false"/>
- + <item id="2389" count="1" chance="40" announce="false"/>
- + <item id="2407" count="1" chance="40" announce="false"/>
- + <item id="5765" count="1" chance="40" announce="false"/>
- + <item id="5766" count="1" chance="40" announce="false"/>
- + <item id="5767" count="1" chance="40" announce="false"/>
- + <item id="5777" count="1" chance="40" announce="false"/>
- + <item id="5778" count="1" chance="40" announce="false"/>
- + <item id="5779" count="1" chance="40" announce="false"/>
- + <item id="6608" count="1" chance="5" announce="true"/>
- + <item id="6604" count="1" chance="5" announce="true"/>
- + <item id="6599" count="1" chance="5" announce="true"/>
- + <item id="6590" count="1" chance="5" announce="true"/>
- + <item id="6606" count="1" chance="5" announce="true"/>
- + <item id="6580" count="1" chance="5" announce="true"/>
- + <item id="6597" count="1" chance="5" announce="true"/>
- + <item id="6585" count="1" chance="5" announce="true"/>
- + <item id="6594" count="1" chance="5" announce="true"/>
- + <item id="6582" count="1" chance="5" announce="true"/>
- + <item id="959" count="10" chance="60" announce="false"/>
- + <item id="960" count="10" chance="60" announce="false"/>
- + <item id="6577" count="3" chance="45" announce="false"/>
- + <item id="6578" count="3" chance="45" announce="false"/>
- + <item id="961" count="1" chance="10" announce="true"/>
- + <item id="962" count="1" chance="10" announce="true"/>
- + <item id="4686" count="1" chance="70" announce="false"/>
- + <item id="4682" count="1" chance="70" announce="false"/>
- + <item id="4697" count="1" chance="70" announce="false"/>
- + <item id="4702" count="1" chance="70" announce="false"/>
- + <item id="4700" count="1" chance="70" announce="false"/>
- + <item id="4709" count="1" chance="70" announce="false"/>
- + <item id="4705" count="1" chance="70" announce="false"/>
- + <item id="6310" count="1" chance="70" announce="false"/>
- + <item id="6313" count="1" chance="70" announce="false"/>
- + <item id="6348" count="1" chance="70" announce="false"/>
- + <item id="4711" count="1" chance="70" announce="false"/>
- + <item id="2599" count="1" chance="70" announce="false"/>
- + <item id="2591" count="1" chance="70" announce="false"/>
- + <item id="2582" count="1" chance="70" announce="false"/>
- + <item id="4776" count="1" chance="70" announce="false"/>
- + <item id="4824" count="1" chance="70" announce="false"/>
- + <item id="4795" count="1" chance="70" announce="false"/>
- + <item id="4852" count="1" chance="70" announce="false"/>
- + <item id="4745" count="1" chance="70" announce="false"/>
- + <item id="4896" count="1" chance="70" announce="false"/>
- + <item id="439" count="1" chance="70" announce="false"/>
- + <item id="471" count="1" chance="70" announce="false"/>
- + <item id="2430" count="1" chance="70" announce="false"/>
- + <item id="2454" count="1" chance="70" announce="false"/>
- + <item id="356" count="1" chance="70" announce="false"/>
- + <item id="2414" count="1" chance="70" announce="false"/>
- + <item id="2438" count="1" chance="70" announce="false"/>
- + <item id="2462" count="1" chance="70" announce="false"/>
- + <item id="2497" count="1" chance="70" announce="false"/>
- + <item id="400" count="1" chance="70" announce="false"/>
- + <item id="420" count="1" chance="70" announce="false"/>
- + <item id="2436" count="1" chance="70" announce="false"/>
- + <item id="2460" count="1" chance="70" announce="false"/>
- + <item id="2415" count="1" chance="58" announce="false"/>
- +<item id="2406" count="1" chance="58" announce="false"/>
- +<item id="4718" count="1" chance="58" announce="false"/>
- +<item id="4724" count="1" chance="58" announce="false"/>
- +<item id="2624" count="1" chance="58" announce="false"/>
- +<item id="2626" count="1" chance="58" announce="false"/>
- +<item id="2621" count="1" chance="58" announce="false"/>
- +<item id="4782" count="1" chance="58" announce="false"/>
- +<item id="4830" count="1" chance="58" announce="false"/>
- +<item id="4804" count="1" chance="58" announce="false"/>
- +<item id="4856" count="1" chance="58" announce="false"/>
- +<item id="4753" count="1" chance="58" announce="false"/>
- +<item id="4897" count="1" chance="58" announce="false"/>
- +<item id="4898" count="1" chance="58" announce="false"/>
- +<item id="4899" count="1" chance="58" announce="false"/>
- +<item id="4902" count="1" chance="58" announce="false"/>
- +<item id="4901" count="1" chance="58" announce="false"/>
- +<item id="4900" count="1" chance="58" announce="false"/>
- +<item id="5716" count="1" chance="58" announce="false"/>
- +<item id="5732" count="1" chance="58" announce="false"/>
- +<item id="2390" count="1" chance="58" announce="false"/>
- +<item id="5715" count="1" chance="58" announce="false"/>
- +<item id="5731" count="1" chance="58" announce="false"/>
- +<item id="2376" count="1" chance="58" announce="false"/>
- +<item id="2379" count="1" chance="58" announce="false"/>
- +<item id="5714" count="1" chance="58" announce="false"/>
- +<item id="5730" count="1" chance="58" announce="false"/>
- +<item id="2416" count="1" chance="58" announce="false"/>
- +<item id="2403" count="1" chance="58" announce="false"/>
- +<item id="5720" count="1" chance="58" announce="false"/>
- +<item id="5736" count="1" chance="58" announce="false"/>
- +<item id="358" count="1" chance="58" announce="false"/>
- +<item id="2380" count="1" chance="58" announce="false"/>
- +<item id="5718" count="1" chance="58" announce="false"/>
- +<item id="5734" count="1" chance="58" announce="false"/>
- +<item id="2391" count="1" chance="58" announce="false"/>
- +<item id="5719" count="1" chance="58" announce="false"/>
- +<item id="5735" count="1" chance="58" announce="false"/>
- +<item id="2417" count="1" chance="58" announce="false"/>
- +<item id="2381" count="1" chance="58" announce="false"/>
- +<item id="5722" count="1" chance="58" announce="false"/>
- +<item id="5738" count="1" chance="58" announce="false"/>
- +<item id="2392" count="1" chance="58" announce="false"/>
- +<item id="5723" count="1" chance="58" announce="false"/>
- +<item id="5739" count="1" chance="58" announce="false"/>
- +<item id="2399" count="1" chance="58" announce="false"/>
- +<item id="2404" count="1" chance="58" announce="false"/>
- +<item id="5724" count="1" chance="58" announce="false"/>
- +<item id="5740" count="1" chance="58" announce="false"/>
- +<item id="2418" count="1" chance="58" announce="false"/>
- +<item id="374" count="1" chance="58" announce="false"/>
- +<item id="5771" count="1" chance="58" announce="false"/>
- +<item id="5783" count="1" chance="58" announce="false"/>
- +<item id="2408" count="1" chance="58" announce="false"/>
- +<item id="5773" count="1" chance="58" announce="false"/>
- +<item id="5785" count="1" chance="58" announce="false"/>
- +<item id="2394" count="1" chance="58" announce="false"/>
- +<item id="5772" count="1" chance="58" announce="false"/>
- +<item id="5784" count="1" chance="58" announce="false"/>
- +<item id="547" count="1" chance="58" announce="false"/>
- +<item id="2405" count="1" chance="58" announce="false"/>
- +<item id="2400" count="1" chance="58" announce="false"/>
- +<item id="5770" count="1" chance="58" announce="false"/>
- +<item id="5782" count="1" chance="58" announce="false"/>
- +<item id="2393" count="1" chance="58" announce="false"/>
- +<item id="5769" count="1" chance="58" announce="false"/>
- +<item id="5781" count="1" chance="58" announce="false"/>
- +<item id="2382" count="1" chance="58" announce="false"/>
- +<item id="5768" count="1" chance="58" announce="false"/>
- +<item id="5780" count="1" chance="58" announce="false"/>
- +<item id="6660" count="1" chance="4" announce="true"/>
- +<item id="6657" count="1" chance="4" announce="true"/>
- +<item id="6656" count="1" chance="4" announce="true"/>
- +<item id="6658" count="1" chance="4" announce="true"/>
- +<item id="6659" count="1" chance="4" announce="true"/>
- +
- +</rewards>
- \ No newline at end of file
- diff --git java/Base/Data/IconTable.java java/Base/Data/IconTable.java
- new file mode 100644
- index 0000000..03b2c05
- --- /dev/null
- +++ java/Base/Data/IconTable.java
- @@ -0,0 +1,97 @@
- +/*
- + * 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 Base.Data;
- +
- +import java.io.File;
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +
- +import Base.XML.XMLDocumentFactory;
- +
- +/**
- + * @author Tayran.JavaDev
- + */
- +public class IconTable
- +{
- + private static final Logger _log = Logger.getLogger(IconTable.class.getName());
- +
- + public static Map<Integer, String> _icons = new ConcurrentHashMap<>();
- +
- + public static final IconTable getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + protected IconTable()
- + {
- +
- + load();
- + }
- +
- + private static void load()
- + {
- + try
- + {
- + File f = new File("./data/icons.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("icon"))
- + {
- + NamedNodeMap attrs = d.getAttributes();
- +
- + int itemId = Integer.valueOf(attrs.getNamedItem("itemId").getNodeValue());
- + String iconName = attrs.getNamedItem("iconName").getNodeValue();
- +
- + if ((itemId == 0) && (itemId < 0))
- + {
- + _log.log(Level.WARNING, "Icon Table: itemId=\"" + itemId + "\" is not item ID, Ignoring it!");
- + continue;
- + }
- + _icons.put(itemId, iconName);
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Icon Table: Error loading from database: " + e.getMessage(), e);
- + }
- +
- + _log.info("Icon Table: Loaded " + _icons.size() + " icons.");
- + }
- +
- + public static String getIcon(int id)
- + {
- + if (_icons.get(id) == null)
- + {
- + return "icon.NOIMAGE";
- + }
- +
- + return _icons.get(id);
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final IconTable _instance = new IconTable();
- + }
- +}
- \ No newline at end of file
- diff --git java/Base/RandomCraft/RandomCraftItem.java java/Base/RandomCraft/RandomCraftItem.java
- new file mode 100644
- index 0000000..835bafa
- --- /dev/null
- +++ java/Base/RandomCraft/RandomCraftItem.java
- @@ -0,0 +1,50 @@
- +package Base.RandomCraft;
- +
- +import org.l2jmobius.gameserver.data.ItemTable;
- +import org.l2jmobius.gameserver.model.item.ItemTemplate;
- +
- +public class RandomCraftItem
- +{
- + private final int id;
- + private final int cantidad;
- + private final double probabilidad;
- + private final boolean announce;
- +
- + public RandomCraftItem(int id, int cantidad, double probabilidad, boolean announce)
- + {
- + this.id = id;
- + this.cantidad = cantidad;
- + this.probabilidad = probabilidad;
- + this.announce = announce;
- + }
- +
- + public int getId()
- + {
- + return id;
- + }
- +
- + public int getCantidad()
- + {
- + return cantidad;
- + }
- +
- + public double getProbabilidad()
- + {
- + return probabilidad;
- + }
- +
- + public boolean getAnnounce()
- + {
- + return announce;
- + }
- +
- + public String getIcon()
- + {
- + return getItem().getIcon(id);
- + }
- +
- + public ItemTemplate getItem()
- + {
- + return ItemTable.getInstance().getTemplate(id);
- + }
- +}
- diff --git java/Base/RandomCraft/RandomCraftXML.java java/Base/RandomCraft/RandomCraftXML.java
- new file mode 100644
- index 0000000..4e9f84b
- --- /dev/null
- +++ java/Base/RandomCraft/RandomCraftXML.java
- @@ -0,0 +1,86 @@
- +package Base.RandomCraft;
- +
- +import java.io.File;
- +import java.util.HashMap;
- +import java.util.Map;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +
- +import Base.XML.XMLDocument;
- +
- +public class RandomCraftXML extends XMLDocument
- +{
- + private final Map<Integer, RandomCraftItem> items;
- +
- + public RandomCraftXML()
- + {
- + items = new HashMap<>();
- + load();
- + }
- +
- + public void reload()
- + {
- + items.clear();
- + load();
- + }
- +
- + public static RandomCraftXML getInstance()
- + {
- + return SingletonHolder.INSTANCE;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final RandomCraftXML INSTANCE = new RandomCraftXML();
- + }
- +
- + @Override
- + protected void load()
- + {
- + loadDocument("./data/RandomCraft.xml");
- + LOG.info("RandomCraftItemData: Loaded " + items.size() + " items.");
- + }
- +
- + @Override
- + protected void parseDocument(Document doc, File file)
- + {
- + try
- + {
- + final Node root = doc.getFirstChild();
- +
- + for (Node node = root.getFirstChild(); node != null; node = node.getNextSibling())
- + {
- + if (!"item".equalsIgnoreCase(node.getNodeName()))
- + {
- + continue;
- + }
- +
- + NamedNodeMap attrs = node.getAttributes();
- + int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
- + int cantidad = Integer.parseInt(attrs.getNamedItem("count").getNodeValue());
- + double probabilidad = Double.parseDouble(attrs.getNamedItem("chance").getNodeValue());
- + boolean announce = Boolean.parseBoolean(attrs.getNamedItem("announce").getNodeValue());
- +
- + RandomCraftItem item = new RandomCraftItem(id, cantidad, probabilidad, announce);
- + items.put(id, item);
- + }
- + }
- + catch (Exception e)
- + {
- + // LOG.warning("RandomCraftItemData: Error while loading items: " + e);
- + e.printStackTrace();
- + }
- + }
- +
- + public Map<Integer, RandomCraftItem> getItems()
- + {
- + return items;
- + }
- +
- + public RandomCraftItem getItemById(int id)
- + {
- + return items.get(id);
- + }
- +}
- diff --git java/Base/XML/XMLDocument.java java/Base/XML/XMLDocument.java
- new file mode 100644
- index 0000000..756a5ee
- --- /dev/null
- +++ java/Base/XML/XMLDocument.java
- @@ -0,0 +1,119 @@
- +package Base.XML;
- +
- +import java.io.File;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import javax.xml.parsers.DocumentBuilderFactory;
- +import javax.xml.transform.OutputKeys;
- +import javax.xml.transform.Transformer;
- +import javax.xml.transform.TransformerException;
- +import javax.xml.transform.TransformerFactory;
- +import javax.xml.transform.dom.DOMSource;
- +import javax.xml.transform.stream.StreamResult;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +
- +import org.l2jmobius.gameserver.model.StatSet;
- +
- +/**
- + * An XML document, relying on a static and single DocumentBuilderFactory.
- + */
- +public abstract class XMLDocument
- +{
- + protected static final Logger LOG = Logger.getLogger(XMLDocument.class.getName());
- +
- + protected Document document;
- +
- + private static final DocumentBuilderFactory BUILDER;
- + static
- + {
- + BUILDER = DocumentBuilderFactory.newInstance();
- + BUILDER.setValidating(false);
- + BUILDER.setIgnoringComments(true);
- + }
- +
- + abstract protected void load();
- +
- + abstract protected void parseDocument(Document doc, File f);
- +
- + public void loadDocument(String filePath)
- + {
- + loadDocument(new File(filePath));
- + }
- +
- + public void writeDocument(Document doc, String fileName)
- + {
- + try
- + {
- + TransformerFactory transformerFactory = TransformerFactory.newInstance();
- + Transformer transformer = transformerFactory.newTransformer();
- + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- + transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- +
- + DOMSource source = new DOMSource(doc);
- + StreamResult result = new StreamResult(new File(fileName));
- +
- + transformer.transform(source, result);
- + LOG.info("XML file saved to " + fileName);
- + }
- + catch (TransformerException e)
- + {
- + LOG.warning("Error saving XML file: " + e.getMessage());
- + }
- + }
- +
- + /**
- + * Parse an entire directory or file if found.
- + * @param file
- + */
- + public void loadDocument(File file)
- + {
- + if (!file.exists())
- + {
- + LOG.severe("The following file or directory doesn't exist: " + file.getName());
- + return;
- + }
- +
- + if (file.isDirectory())
- + {
- + for (File f : file.listFiles())
- + {
- + loadDocument(f);
- + }
- + }
- + else if (file.isFile())
- + {
- + try
- + {
- + parseDocument(BUILDER.newDocumentBuilder().parse(file), file);
- + }
- + catch (Exception e)
- + {
- + LOG.log(Level.SEVERE, "Error loading XML file " + file.getName(), e);
- + }
- + }
- + }
- +
- + public Document getDocument()
- + {
- + return document;
- + }
- +
- + /**
- + * This method parses the content of a NamedNodeMap and feed the given StatsSet.
- + * @param attrs : The NamedNodeMap to parse.
- + * @param set : The StatsSet to feed.
- + */
- + public static void parseAndFeed(NamedNodeMap attrs, StatSet set)
- + {
- + for (int i = 0; i < attrs.getLength(); i++)
- + {
- + final Node attr = attrs.item(i);
- + set.set(attr.getNodeName(), attr.getNodeValue());
- + }
- + }
- +}
- diff --git java/Base/XML/XMLDocumentFactory.java java/Base/XML/XMLDocumentFactory.java
- new file mode 100644
- index 0000000..9594e19
- --- /dev/null
- +++ java/Base/XML/XMLDocumentFactory.java
- @@ -0,0 +1,74 @@
- +package Base.XML;
- +
- +import java.io.File;
- +
- +import javax.xml.parsers.DocumentBuilder;
- +import javax.xml.parsers.DocumentBuilderFactory;
- +
- +import org.w3c.dom.Document;
- +
- +/**
- + * @author Forsaiken
- + */
- +public final class XMLDocumentFactory
- +{
- + public static final XMLDocumentFactory getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private final DocumentBuilder _builder;
- +
- + protected XMLDocumentFactory() throws Exception
- + {
- + try
- + {
- + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- + factory.setValidating(false);
- + factory.setIgnoringComments(true);
- +
- + _builder = factory.newDocumentBuilder();
- + }
- + catch (Exception e)
- + {
- + throw new Exception("Failed initializing", e);
- + }
- + }
- +
- + public final Document loadDocument(final String filePath) throws Exception
- + {
- + return loadDocument(new File(filePath));
- + }
- +
- + public final Document loadDocument(final File file) throws Exception
- + {
- + if (!file.exists() || !file.isFile())
- + {
- + throw new Exception("File: " + file.getAbsolutePath() + " doesn't exist and/or is not a file.");
- + }
- +
- + return _builder.parse(file);
- + }
- +
- + public final Document newDocument()
- + {
- + return _builder.newDocument();
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final XMLDocumentFactory _instance;
- +
- + static
- + {
- + try
- + {
- + _instance = new XMLDocumentFactory();
- + }
- + catch (Exception e)
- + {
- + throw new ExceptionInInitializerError(e);
- + }
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/org/l2jmobius/Config.java java/org/l2jmobius/Config.java
- index 1c8442b..66735d1 100644
- --- java/org/l2jmobius/Config.java
- +++ java/org/l2jmobius/Config.java
- @@ -124,6 +124,10 @@
- public static ServerMode SERVER_MODE = ServerMode.NONE;
- public static boolean EVERYBODY_HAS_ADMIN_RIGHTS;
- +
- + public static int RANDOM_CRAFT_ITEM_ID_CONSUME;
- + public static int RANDOM_CRAFT_ITEM_CONSUME_REFRESH;
- + public static int RANDOM_CRAFT_ITEM_CONSUME_CREATE;
- public static boolean SHOW_GM_LOGIN;
- public static boolean GM_STARTUP_INVISIBLE;
- public static boolean GM_SPECIAL_EFFECT;
- @@ -1292,6 +1296,12 @@
- final PropertiesParser generalConfig = new PropertiesParser(GENERAL_CONFIG_FILE);
- SERVER_LIST_TESTSERVER = generalConfig.getBoolean("TestServer", false);
- SERVER_GMONLY = generalConfig.getBoolean("ServerGMOnly", false);
- + RANDOM_CRAFT_ITEM_ID_CONSUME = generalConfig.getInt("RandomCraftItemId", 57);
- +
- + RANDOM_CRAFT_ITEM_CONSUME_REFRESH = generalConfig.getInt("RandomCraftConsumeRefresh", 50000);
- +
- + RANDOM_CRAFT_ITEM_CONSUME_CREATE = generalConfig.getInt("RandromCraftConsumeCreate", 300000);
- +
- ALT_DEV_NO_QUESTS = generalConfig.getBoolean("AltDevNoQuests", false);
- ALT_DEV_NO_SPAWNS = generalConfig.getBoolean("AltDevNoSpawns", false);
- ALT_DEV_NO_SCRIPT = generalConfig.getBoolean("AltDevNoScript", false);
- diff --git java/org/l2jmobius/gameserver/GameServer.java java/org/l2jmobius/gameserver/GameServer.java
- index c6459e3..e2e3e26 100644
- --- java/org/l2jmobius/gameserver/GameServer.java
- +++ java/org/l2jmobius/gameserver/GameServer.java
- @@ -128,6 +128,9 @@
- import org.l2jmobius.gameserver.taskmanager.TaskManager;
- import org.l2jmobius.gameserver.ui.Gui;
- +import Base.Data.IconTable;
- +import Base.RandomCraft.RandomCraftXML;
- +
- public class GameServer
- {
- private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
- @@ -339,6 +342,10 @@
- printSection("Access Levels");
- AdminData.getInstance();
- + IconTable.getInstance();
- + printSection("RandomCraft - Terius");
- + RandomCraftXML.getInstance();
- + XMLDocumentFactory.getInstance();
- printSection("Handlers");
- ItemHandler.getInstance();
- SkillHandler.getInstance();
- diff --git java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminReload.java java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminReload.java
- index 1fbeade..36a2a98 100644
- --- java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminReload.java
- +++ java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminReload.java
- @@ -33,6 +33,8 @@
- import org.l2jmobius.gameserver.model.actor.Player;
- import org.l2jmobius.gameserver.util.BuilderUtil;
- +import Base.RandomCraft.RandomCraftXML;
- +
- /**
- * @author KidZor
- */
- @@ -110,12 +112,19 @@
- sendReloadPage(activeChar);
- BuilderUtil.sendSysMessage(activeChar, "Quests Reloaded.");
- }
- + else if (type.equals("craft"))
- + {
- + RandomCraftXML.getInstance().reload();
- + sendReloadPage(activeChar);
- + BuilderUtil.sendSysMessage(activeChar, "RandomCraftSystem Reloaded.");
- + }
- else if (type.equals("configs"))
- {
- Config.load(ServerMode.GAME);
- sendReloadPage(activeChar);
- BuilderUtil.sendSysMessage(activeChar, "Server Config Reloaded.");
- }
- +
- else if (type.equals("tradelist"))
- {
- TradeManager.getInstance();
- diff --git java/org/l2jmobius/gameserver/model/actor/Player.java java/org/l2jmobius/gameserver/model/actor/Player.java
- index 85eb611..acdedfa 100644
- --- java/org/l2jmobius/gameserver/model/actor/Player.java
- +++ java/org/l2jmobius/gameserver/model/actor/Player.java
- @@ -237,6 +237,8 @@
- import org.l2jmobius.gameserver.util.Broadcast;
- import org.l2jmobius.gameserver.util.Util;
- +import Base.RandomCraft.RandomCraftItem;
- +
- /**
- * This class represents all player characters in the world.<br>
- * There is always a client-thread connected to this (except if a player-store is activated upon logout).
- @@ -15619,6 +15621,23 @@
- _currentPetSkill = new SkillUseHolder(currentSkill, ctrlPressed, shiftPressed);
- }
- + private List<RandomCraftItem> generatedCraftItems;
- +
- + public List<RandomCraftItem> getGeneratedCraftItems()
- + {
- + return generatedCraftItems;
- + }
- +
- + public void setGeneratedCraftItems(List<RandomCraftItem> items)
- + {
- + generatedCraftItems = items;
- + }
- +
- + public void clearGeneratedCraftItems()
- + {
- + generatedCraftItems.clear();
- + }
- +
- @Override
- public Player getActingPlayer()
- {
- diff --git java/org/l2jmobius/gameserver/model/actor/instance/RandomCraft.java java/org/l2jmobius/gameserver/model/actor/instance/RandomCraft.java
- new file mode 100644
- index 0000000..cc5056f
- --- /dev/null
- +++ java/org/l2jmobius/gameserver/model/actor/instance/RandomCraft.java
- @@ -0,0 +1,495 @@
- +package org.l2jmobius.gameserver.model.actor.instance;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.util.ArrayList;
- +import java.util.LinkedList;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.Random;
- +
- +import org.l2jmobius.Config;
- +import org.l2jmobius.commons.database.DatabaseFactory;
- +import org.l2jmobius.gameserver.ai.CtrlIntention;
- +import org.l2jmobius.gameserver.model.World;
- +import org.l2jmobius.gameserver.model.actor.Npc;
- +import org.l2jmobius.gameserver.model.actor.Player;
- +import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
- +import org.l2jmobius.gameserver.model.item.instance.Item;
- +import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
- +import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
- +import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- +import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
- +import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
- +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
- +import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
- +
- +import Base.RandomCraft.RandomCraftItem;
- +import Base.RandomCraft.RandomCraftXML;
- +
- +/**
- + * @author Terius
- + */
- +
- +public class RandomCraft extends Npc
- +{
- + private boolean hasGeneratedItems;
- + List<RandomCraftItem> items = new LinkedList<>();
- +
- + public RandomCraft(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + setHasGeneratedItems(false);
- + }
- +
- + @Override
- + public void onAction(Player player)
- + {
- + if (this != player.getTarget())
- + {
- + player.setTarget(this);
- + player.sendPacket(new MyTargetSelected(getObjectId(), 0));
- + player.sendPacket(new ValidateLocation(this));
- + }
- + else
- + {
- + if (!canInteract(player))
- + {
- + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
- + }
- + else
- + {
- + // Gira el jugador para enfrentar la instancia
- + player.sendPacket(new MoveToPawn(player, this, Npc.INTERACTION_DISTANCE));
- +
- + onRandomAnimation(1);
- +
- + loadGeneratedItems(player);
- +
- + showHtmlWindow(player);
- +
- + // Enviar ActionFailed al jugador para evitar quedarse atascado
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + }
- + }
- +
- + @Override
- + public void onBypassFeedback(Player player, String command)
- + {
- + if (command.startsWith("refresh"))
- + {
- + // Verifique si el jugador tiene el artículo requerido (ID 57) y la cantidad (50000)
- + Item item57 = player.getInventory().getItemByItemId(Config.RANDOM_CRAFT_ITEM_ID_CONSUME);
- + if ((item57 != null) && (item57.getCount() >= Config.RANDOM_CRAFT_ITEM_CONSUME_REFRESH))
- + {
- + // Cargue al jugador el artículo requerido (ID 57) y la cantidad (50000)
- + player.destroyItemByItemId("Random Craft", Config.RANDOM_CRAFT_ITEM_ID_CONSUME, Config.RANDOM_CRAFT_ITEM_CONSUME_REFRESH, null, true);
- +
- + generateItems(player);
- +
- + showHtmlWindow(player);
- +
- + // Almacene los elementos generados en la base de datos para el jugador
- + saveGeneratedItems(player);
- + }
- + else
- + {
- + player.sendMessage("Necesitas al menos 50000 Adena para actualizar Random Craft.");
- + showHtmlWindow(player);
- + }
- + }
- + else if (command.startsWith("create"))
- + {
- +
- + // Carga al jugador el artículo con ID 57 y cantidad 300000
- + Item item57 = player.getInventory().getItemByItemId(Config.RANDOM_CRAFT_ITEM_ID_CONSUME);
- + if ((item57 != null) && (item57.getCount() >= Config.RANDOM_CRAFT_ITEM_CONSUME_CREATE))
- + {
- + // Eliminar los elementos generados para el jugador de la tabla RandomCraftItem
- + deleteGeneratedItems(player);
- +
- + createItem(player);
- + }
- + else
- + {
- + player.sendMessage("Necesitas al menos 300000 Adena para crear un elemento aleatorio.");
- + showHtmlWindow(player);
- + }
- +
- + }
- +
- + else if (command.startsWith("back"))
- + {
- +
- + showHtmlWindow(player);
- + }
- +
- + }
- +
- + private void generateItems(Player player)
- + {
- + List<RandomCraftItem> items = new LinkedList<>();
- + RandomCraftXML randomCraftXML = RandomCraftXML.getInstance();
- + Map<Integer, RandomCraftItem> craftItems = randomCraftXML.getItems();
- +
- + // Genera 4 elementos únicos para cada jugador en función de la probabilidad
- + List<Integer> selectedItems = new ArrayList<>();
- + while (selectedItems.size() < 5)
- + {
- + int itemId = getRandomItem(craftItems);
- + if (!selectedItems.contains(itemId))
- + {
- + selectedItems.add(itemId);
- + items.add(craftItems.get(itemId));
- + }
- + }
- +
- + // Asignar los elementos generados al jugador
- + player.setGeneratedCraftItems(items);
- + setHasGeneratedItems(true);
- +
- + }
- +
- + private static void deleteGeneratedItems(Player player)
- + {
- + try (Connection con = DatabaseFactory.getConnection();
- + PreparedStatement stmt = con.prepareStatement("DELETE FROM RandomCraftItem WHERE object_id = ?"))
- + {
- + stmt.setInt(1, player.getObjectId());
- + stmt.execute();
- + }
- + catch (SQLException e)
- + {
- + e.printStackTrace();
- + }
- + }
- +
- + private static void saveGeneratedItems(Player player)
- + {
- + try (Connection con = DatabaseFactory.getConnection();
- + PreparedStatement stmt = con.prepareStatement("DELETE FROM RandomCraftItem WHERE object_id = ?"))
- + {
- + stmt.setInt(1, player.getObjectId());
- + stmt.execute();
- +
- + try (PreparedStatement insertStmt = con.prepareStatement("INSERT INTO RandomCraftItem (object_id, item_id, amount, chance, announce) VALUES (?, ?, ?, ?, ?)"))
- + {
- + insertStmt.setInt(1, player.getObjectId());
- + List<RandomCraftItem> items = player.getGeneratedCraftItems();
- + if (items != null)
- + {
- + for (RandomCraftItem item : items)
- + {
- + insertStmt.setInt(2, item.getId());
- + insertStmt.setInt(3, item.getCantidad());
- + insertStmt.setDouble(4, item.getProbabilidad());
- + insertStmt.setBoolean(5, item.getAnnounce());
- + insertStmt.addBatch(); // Agregar la consulta al lote (batch)
- + }
- + insertStmt.executeBatch(); // Ejecutar el lote de consultas
- + }
- + }
- + }
- + catch (SQLException e)
- + {
- + e.printStackTrace();
- + }
- + }
- +
- + private void loadGeneratedItems(Player player)
- + {
- + try (Connection con = DatabaseFactory.getConnection();
- + PreparedStatement stmt = con.prepareStatement("SELECT item_id, amount, chance, announce FROM RandomCraftItem WHERE object_id = ?"))
- + {
- + stmt.setInt(1, player.getObjectId());
- +
- + try (ResultSet rset = stmt.executeQuery())
- + {
- + List<RandomCraftItem> items = new LinkedList<>();
- + while (rset.next())
- + {
- + int itemId = rset.getInt("item_id");
- + int amount = rset.getInt("amount");
- + int chance = rset.getInt("chance");
- + boolean announce = rset.getBoolean("announce");
- + RandomCraftItem item = new RandomCraftItem(itemId, amount, chance, announce);
- + items.add(item);
- + }
- +
- + player.setGeneratedCraftItems(items);
- + setHasGeneratedItems(!items.isEmpty());
- + }
- + }
- + catch (SQLException e)
- + {
- + e.printStackTrace();
- + }
- + }
- +
- + private static int getRandomItem(Map<Integer, RandomCraftItem> craftItems)
- + {
- + // Calcular la suma de probabilidad total
- + double totalProbability = 0;
- + for (RandomCraftItem item : craftItems.values())
- + {
- + totalProbability += item.getProbabilidad();
- + }
- +
- + // Generar un valor aleatorio entre 0 y la probabilidad total
- + Random random = new Random();
- + double randomValue = random.nextDouble() * totalProbability;
- +
- + // Seleccione el elemento en función de la probabilidad
- + double cumulativeProbability = 0;
- + for (RandomCraftItem item : craftItems.values())
- + {
- + cumulativeProbability += item.getProbabilidad();
- + if (randomValue <= cumulativeProbability)
- + {
- + return item.getId();
- + }
- + }
- +
- + // Si no se selecciona ningún artículo, devolver un artículo al azar
- + List<Integer> itemIds = new ArrayList<>(craftItems.keySet());
- + int index = random.nextInt(itemIds.size());
- + return itemIds.get(index);
- + }
- +
- + private void createItem(Player player)
- + {
- + // Comprueba si la lista de elementos está vacía
- + List<RandomCraftItem> items = player.getGeneratedCraftItems();
- + if ((items == null) || items.isEmpty())
- + {
- + player.sendMessage("Necesita actualizar para poder crear un elemento aleatorio.");
- + return;
- + }
- +
- + // Obtén un elemento aleatorio de la lista de elementos generados
- + Random random = new Random();
- + int index = random.nextInt(items.size());
- + RandomCraftItem craftItem = items.get(index);
- +
- + // Carga al jugador el artículo con ID 57 y cantidad 300000
- + Item item57 = player.getInventory().getItemByItemId(Config.RANDOM_CRAFT_ITEM_ID_CONSUME);
- + if ((item57 != null) && (item57.getCount() >= Config.RANDOM_CRAFT_ITEM_CONSUME_CREATE))
- + {
- +
- + // Da el artículo al jugador
- + Item Item = player.getInventory().addItem("Random Craft", craftItem.getId(), craftItem.getCantidad(), player, this);
- + if (Item != null)
- + {
- +
- + player.destroyItemByItemId("Random Craft", Config.RANDOM_CRAFT_ITEM_ID_CONSUME, Config.RANDOM_CRAFT_ITEM_CONSUME_CREATE, null, true);
- +
- + // Envía un mensaje al jugador con el nombre del artículo y la cantidad.
- + String message = "¡Felicidades! Has recibido " + craftItem.getItem().getName() + " (Cantidad: " + craftItem.getCantidad() + ")";
- + player.sendMessage(message);
- +
- + // Obtén el nombre del jugador que creó el elemento
- + String creatorName = player.getName();
- +
- + // Comprueba si el artículo tiene announce en true en el archivo XML
- + if (craftItem.getAnnounce())
- + {
- +
- + for (Player players : World.getInstance().getAllPlayers())
- + {
- +
- + String text = creatorName + " Ha Crafteado: " + craftItem.getItem().getName() + " En el RandomCraft System";
- +
- + players.sendPacket(new ExShowScreenMessage(text, 5000));
- +
- + }
- +
- + }
- +
- + // Agrega un efecto al jugador si el artículo lo permite
- + if (craftItem.getAnnounce())
- + {
- + MagicSkillUse MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0);
- + player.broadcastPacket(MSU);
- + }
- +
- + // Borra la lista de elementos para el jugador
- + player.clearGeneratedCraftItems();
- + setHasGeneratedItems(false);
- +
- + // Muestra la ventana de felicitaciones con el item ganador
- + showCongratulationsWindow(player, craftItem);
- +
- + return;
- + }
- + }
- +
- + player.sendMessage("Necesitas al menos 300000 Adena para crear un elemento aleatorio.");
- + }
- +
- + private void showHtmlWindow(Player player)
- + {
- + StringBuilder html = new StringBuilder();
- + html.append("<html><body>");
- + html.append("<center>Bienvenido a Random Craft System!</center>");
- + html.append("<br>");
- + html.append("<center>Podras Crear 1 item entre los 5 que salgan random!</center>");
- + html.append("<br>");
- + html.append("<center>Les Deseo Mucha Suerte</center>");
- + html.append("<br>");
- + html.append("<br>");
- +
- + List<RandomCraftItem> items = player.getGeneratedCraftItems();
- + if ((items == null) || items.isEmpty())
- + {
- + html.append("<center>La Lista Esta Vacia. Dale a Refresh</center>");
- + }
- + else
- + {
- + // Generar los iconos de los artículos en forma horizontal
- + for (RandomCraftItem item : items)
- + {
- + html.append("<img src=\"L2UI.SquareGray\" width=295 height=1>");
- + html.append("<div align=center>");
- + html.append("<table>");
- + html.append("<tr>");
- + html.append("<td>");
- + html.append("<img src=").append(item.getIcon()).append(" width=32 height=32>");
- + html.append("</td>");
- + html.append("<td width=260>");
- +
- + double chance = item.getProbabilidad();
- + String color;
- + String additionalInfo;
- +
- + if (chance <= 25)
- + {
- + color = "FF0000"; // Rojo
- + additionalInfo = " - Legendary";
- + }
- + else if (chance <= 50)
- + {
- + color = "9932CC"; // Violeta
- + additionalInfo = " - Epic";
- + }
- + else
- + {
- + color = "FFFF00"; // Amarillo
- + additionalInfo = " - Normal";
- + }
- +
- + html.append("<font color=").append(color).append(">").append(item.getItem().getName()).append(" x").append(item.getCantidad()).append(additionalInfo).append("</font>");
- +
- + html.append("</td>");
- + html.append("</tr>");
- + html.append("</table>");
- + html.append("</div>");
- + html.append("<img src=\"L2UI.SquareGray\" width=295 height=1>");
- + html.append("<br>");
- + }
- + }
- +
- + html.append("<br>");
- + html.append("<br>");
- + html.append("<center>");
- + html.append("<table>");
- + html.append("<tr>");
- + html.append("<td width=75 height=21>");
- + html.append("<button value=\"Refresh\" action=\"bypass -h npc_").append(getObjectId()).append("_refresh\" width=75 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">");
- + html.append("</td>");
- + html.append("<td width=75 height=21>");
- + html.append("<button value=\"Create\" action=\"bypass -h npc_").append(getObjectId()).append("_create\" width=75 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">");
- + html.append("</td>");
- + html.append("</tr>");
- + html.append("</table>");
- + html.append("</center>");
- +
- + html.append("</body></html>");
- +
- + showHtmlWindow(player, html.toString());
- + }
- +
- + private void showHtmlWindow(Player player, String htmlContent)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setHtml(htmlContent);
- +
- + player.sendPacket(html);
- + }
- +
- + private void showCongratulationsWindow(Player player, RandomCraftItem craftItem)
- + {
- + StringBuilder html = new StringBuilder();
- +
- + html.append("<html><body>");
- + html.append("<center>Felicidades, has ganado un item</center>");
- + html.append("<br>");
- + html.append("<center>¡Has recibido</center>");
- + html.append("<br>");
- + html.append("<br>");
- + html.append("<img src=\"L2UI.SquareGray\" width=295 height=1>");
- + html.append("<center>");
- + html.append("<table>");
- + html.append("<tr>");
- + html.append("<td>");
- + html.append("<img src=").append(craftItem.getIcon()).append(" width=32 height=32>");
- + html.append("</td>");
- + html.append("<td width=260>");
- +
- + double chance = craftItem.getProbabilidad();
- + String color;
- + String additionalInfo;
- +
- + if (chance <= 25)
- + {
- + color = "FF0000"; // Rojo
- + additionalInfo = " - Legendary";
- + }
- + else if (chance <= 50)
- + {
- + color = "9932CC"; // Violeta
- + additionalInfo = " - Epic";
- + }
- + else
- + {
- + color = "FFFF00"; // Amarillo
- + additionalInfo = " - Normal";
- + }
- +
- + html.append("<font color=").append(color).append(">").append(craftItem.getItem().getName()).append(" x").append(craftItem.getCantidad()).append(additionalInfo).append("</font>");
- +
- + html.append("</td>");
- + html.append("</tr>");
- + html.append("</table>");
- + html.append("</center>");
- + html.append("<img src=\"L2UI.SquareGray\" width=295 height=1>");
- + html.append("<br>");
- + html.append("<br>");
- + html.append("<br>");
- + html.append("<br>");
- + html.append("<center>");
- + html.append("<button value=\"Back\" action=\"bypass -h npc_").append(getObjectId()).append("_back\" width=75 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">");
- + html.append("</center>");
- + html.append("</body></html>");
- +
- + showHtmlWindow(player, html.toString());
- + }
- +
- + /**
- + * @return the hasGeneratedItems
- + */
- + public boolean isHasGeneratedItems()
- + {
- + return hasGeneratedItems;
- + }
- +
- + /**
- + * @param hasGeneratedItems the hasGeneratedItems to set
- + */
- + public void setHasGeneratedItems(boolean hasGeneratedItems)
- + {
- + this.hasGeneratedItems = hasGeneratedItems;
- + }
- +}
- diff --git java/org/l2jmobius/gameserver/model/item/ItemTemplate.java java/org/l2jmobius/gameserver/model/item/ItemTemplate.java
- index 3608c32..3baf3b9 100644
- --- java/org/l2jmobius/gameserver/model/item/ItemTemplate.java
- +++ java/org/l2jmobius/gameserver/model/item/ItemTemplate.java
- @@ -32,6 +32,8 @@
- import org.l2jmobius.gameserver.model.skill.funcs.Func;
- import org.l2jmobius.gameserver.model.skill.funcs.FuncTemplate;
- +import Base.Data.IconTable;
- +
- /**
- * This class contains all informations concerning the item (weapon, armor, etc).<br>
- * Mother class of :
- @@ -670,6 +672,16 @@
- }
- }
- + public String getIcon(int id)
- + {
- + if (IconTable._icons.get(id) == null)
- + {
- + return "icon.NOIMAGE";
- + }
- +
- + return IconTable._icons.get(id);
- + }
- +
- /**
- * Returns the name of the item
- * @return String
Advertisement
Comments
-
- If you place between 1 and 25 chance the item will come out as Legendary, in 26 to 50 Epic, 51 to 100 Normal
Add Comment
Please, Sign In to add comment
Advertisement