Jump to content

Recommended Posts

Posted (edited)

Nothing special but... huh anyway!
 

Support : Interlude

Tested : aCis & Frozen

  • net/sf/l2j/gameserver/GameServer.java
 import net.sf.l2j.gameserver.datatables.HerbDropTable;
+import net.sf.l2j.gameserver.datatables.IconsTable;
 import net.sf.l2j.gameserver.datatables.ItemTable;

 	StringUtil.printSection("Items");
 	ItemTable.getInstance();
+	IconsTable.getInstance();
 	SummonItemsData.getInstance();
  • net/sf/l2j/gameserver/datatables/IconsTable.java
+package net.sf.l2j.gameserver.datatables;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.GameServer;
+import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+
+public class IconsTable
+{
+    public static final Map<Integer, String> Icons = new HashMap<>();
+    private static int count;
+    private static long t0;
+    private static double t;
+
+    private static final Logger _log = Logger.getLogger(GameServer.class.getName());
+
+    public void reload()
+    {
+        Icons.clear();
+        parseData();
+    }
+
+    public static void parseData()
+    {
+        count=0;
+        t0 = System.currentTimeMillis();
+        try
+        {
+            File f = new File("./data/xml/icons.xml");
+            Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
+
+            for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
+            {
+                if ("list".equalsIgnoreCase(n.getNodeName()))
+                {
+                    for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+                    {
+                        if (d.getNodeName().equalsIgnoreCase("icon"))
+                        {
+                            count++;
+                            NamedNodeMap attrs = d.getAttributes();
+                            Node att = attrs.getNamedItem("Id");
+                            Node att2 = attrs.getNamedItem("value");
+                            Icons.put(Integer.valueOf(att.getNodeValue()), String.valueOf(att2.getNodeValue()));
+                        }
+                    }
+                }
+            }
+            t = System.currentTimeMillis() - t0;
+            _log.config("IconsTable: Succesfully loaded "+count+" icons, in "+t+" Milliseconds.");
+        }
+        catch (Exception e)
+        {
+            _log.config("IconsTable: Failed loading IconsTable. Possible error: "+e.getMessage());
+        }
+    }
+
+    public static String getIcon(int id)
+    {
+
+        if (Icons.get(id)==null)
+        {
+            _log.config("IconsTable: Invalid Icon request: "+id+", or it doesn't exist, Ignoring ...");
+            return "null";
+        }
+        return Icons.get(id);
+    }
+
+    public static final IconsTable getInstance()
+    {
+        parseData();
+        return SingletonHolder._instance;
+    }
+
+    private static class SingletonHolder
+    {
+        protected static final IconsTable _instance = new IconsTable();
+    }
+}
  • data/xml/icons.xml
http://pastebin.com/KMyYJND2

Please no hate... i'm too lazy to make diff.  :poker face:

 

Credits : Me and xxdem

Edited by newChar.needHelp()
Posted

Nothing special but... huh anyway!

 

  • net/sf/l2j/gameserver/GameServer.java
 import net.sf.l2j.gameserver.datatables.HerbDropTable;
+import net.sf.l2j.gameserver.datatables.IconsTable;
 import net.sf.l2j.gameserver.datatables.ItemTable;

 	StringUtil.printSection("Items");
 	ItemTable.getInstance();
+	IconsTable.getInstance();
 	SummonItemsData.getInstance();
  • net/sf/l2j/gameserver/datatables/IconsTable.java
+package net.sf.l2j.gameserver.datatables;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.GameServer;
+import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+
+public class IconsTable
+{
+    public static final Map<Integer, String> Icons = new HashMap<>();
+    private static int count;
+    private static long t0;
+    private static double t;
+
+    private static final Logger _log = Logger.getLogger(GameServer.class.getName());
+
+    public void reload()
+    {
+        Icons.clear();
+        parseData();
+    }
+
+    public static void parseData()
+    {
+        count=0;
+        t0 = System.currentTimeMillis();
+        try
+        {
+            File f = new File("./data/xml/icons.xml");
+            Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
+
+            for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
+            {
+                if ("list".equalsIgnoreCase(n.getNodeName()))
+                {
+                    for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+                    {
+                        if (d.getNodeName().equalsIgnoreCase("icon"))
+                        {
+                            count++;
+                            NamedNodeMap attrs = d.getAttributes();
+                            Node att = attrs.getNamedItem("Id");
+                            Node att2 = attrs.getNamedItem("value");
+                            Icons.put(Integer.valueOf(att.getNodeValue()), String.valueOf(att2.getNodeValue()));
+                        }
+                    }
+                }
+            }
+            t = System.currentTimeMillis() - t0;
+            _log.config("IconsTable: Succesfully loaded "+count+" icons, in "+t+" Milliseconds.");
+        }
+        catch (Exception e)
+        {
+            _log.config("IconsTable: Failed loading IconsTable. Possible error: "+e.getMessage());
+        }
+    }
+
+    public static String getIcon(int id)
+    {
+
+        if (Icons.get(id)==null)
+        {
+            _log.config("IconsTable: Invalid Icon request: "+id+", or it doesn't exist, Ignoring ...");
+            return "null";
+        }
+        return Icons.get(id);
+    }
+
+    public static final IconsTable getInstance()
+    {
+        parseData();
+        return SingletonHolder._instance;
+    }
+
+    private static class SingletonHolder
+    {
+        protected static final IconsTable _instance = new IconsTable();
+    }
+}
  • net/sf/l2j/gameserver/model/L2IconList.java
+package net.sf.l2j.gameserver.model;
+
+public class L2IconList
+{
+	private static int _icon;
+	private int _itemId;
+	
+	public void setitemId(int id)
+	{
+		_itemId = id;
+	}
+	
+	public int getitemId()
+	{
+		return _itemId;
+	}
+	
+	public void setIcon(int icon)
+	{
+		_icon = icon;
+	}
+	
+	public int getIcon()
+	{
+		return _icon;
+	}
+}
  • data/xml/icons.xml
http://pastebin.com/KMyYJND2

Please no hate... i'm too lazy to make diff.  :poker face:

Thats sexy and cute  :-[  Even tryskell won't resist in this one and he will probably write a cute comment. 

Even tho u did not add info such as "what chronicle supports" cause if those are interlude icons then its useless for freya -high5 e.t.c

 

but still good for the xml 

Posted (edited)

Thats sexy and cute  :-[  Even tryskell won't resist in this one and he will probably write a cute comment. 

Even tho u did not add info such as "what chronicle supports" cause if those are interlude icons then its useless for freya -high5 e.t.c

 

but still good for the xml 

 

Thx AccessDenied, Update chronicle support  O0

Edited by newChar.needHelp()
Posted

Thx AccessDenied, Update chronicle support  O0

Btw the code is messed up, who did the code anyway? And what's the purpose of L2IconList ? Since its not used 

Posted (edited)

Eee aaa.. All you need is a new String @ Item.java and simply read the image location from xml, from the item template, if it's in xml format :P

Edited by SweeTs
Posted

oh god, you can make a method "loadData" no need load data everytime u call instance.

You have no idea what a Singleton is do you?

Posted

Eee aaa.. All you need is a new String @ Item.java and simply read the image location from xml, from the item template, if it's in xml format :P

I did it for L2JFrozen a long time ago... :lol:

http://www.maxcheaters.com/topic/186701-please-check-here/

Posted

Why so hate guys? Just im Newbie... find the xml and i make but myself the java side :/ but im newbie...

If somebody can make the code more simple and better can send me with pm the update and i will update it...

Waiting...

 

P.S. I share this part of code because i want to share "Shift+Click" for Monster Drop list.

       Thats all.. :/

Guest
This topic is now closed to further replies.

×
×
  • Create New...