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.



  • Posts

    • We've added 5% discounts for bulk purchases of Google accounts for orders of 300 or more, and 10% for orders of 500 or more. The discount is applied automatically when you place your order! The discount is indicated in the product title and description for each category.  
    • 🎄 CHRISTMAS EVENT 🎄   ‼️ Information and details: https://forum.l2harbor.com/threads/rozhdestvenskie-xlopoty-christmas-chores.9430/post-171464
    • METATG.ORG Direct Telegram Service Provider A bonus of +7% on every order! *We add 7% more followers than your ordered amount to proactively cover potential drops and guarantee you an honest result." Telegram Followers - Price per 1000 SUBSCRIBERS Subscribers 3 days - $0.10 ~ 8 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 7 days - $0.17 ~ 13.6 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 14 days - $0.20 ~ 16 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 30 days - $0.30 ~ 24 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 60 days - $0.40 ~ 32 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers 90 days (Super Fast) - $0.50 ~ 40 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers 120 days (Super Fast) - $0.60 ~ 48 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers Lifetime (Super Fast) - $0.70 ~ 56 RUB Lifetime Subscribers. 14-day guarantee. Daily Completion: 200,000,000 Telegram Services - Price per 1000 Post Views - $0.06 ~ 5 RUB Reactions - $0.08 ~ 6.5 RUB Bot Starts - $0.10 ~ 8 RUB Bot Starts with referrals - $0.15 ~ 12 RUB DISCOUNTS and CASHBACK for large volumes Direct Supplier. We work from our own accounts with our own software! High execution speed. Multiple payment methods. We work 24/7! Additional discounts are discussed for volumes starting from $1000 per day. SUPPORT 24/7 - TELEGRAM WEBSITE 24/7 - METATG.ORG
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock