Jump to content

.geticon() Using Xml


Recommended Posts

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()
Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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()
Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



  • Posts

    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt  
    • Server Rates: » Xp 500x. » Sp 500x. » Aden 500x. » Drop 1x. » PartyXp 2x. » PartySp 2x. » Starting character level -61. Enchant rates: » Safe enchant +4. » Blessed and simple scrolls max enchant (+16). » Crystal scrolls max enchant (+20). » Simple enchant scrolls chance – 65%. » Blessed enchant scrolls chance – 100%. » Crystal enchant scrolls chance – 50% Augmentations: » Mid life stone skill chance – 5%. » High life stone skill chance – 10%. » Top life stone skill chance – 20%. » Augments 1+1 Unique features: » Main town – Giran » Automatic-Manual Potions. » Working 2 castle sieges. (Giran-Aden) » SPS cancel lasts 10 seconds and than buffs come back. » Stackable scrolls, lifestones, book of giants. » Unique pvp zone » More then 11 active raid bosses. » Wedding system. » Unique farming areas. » Npc skill enchanter. » Full npc buffer with auto buff. » Max count of buffs – 55. » Max subclasses – 4. » Free and no quest class change. » Free and no quest sub class. » Raid boss drop nobless item. » No weight limit. » Unique protection anti-hwy armor for archers/daggers etc. » Ingame password change. » Top pvp/pk/online ranks NPC. » Unique monsters & NPC. » Interlude retail skills. » Server up-time [24/7] [99]%. » Perfect class balance (all class can kill all class depending on players skill and setup knowledge,gear,augmentations). » Announcements on double kills triple kills etc. » Announcements on Grand Boss death , with the name of the killer as well as clan name of the player. » Information Npc in game with all servers infromations. Custom server gear : 1). Titanium Armor Lv.1 2). Epic Armor Lv.2 3). Epic Weapons-Kamikaze-Black S grade (Same Stats) 4). Demonic-Angelic Wings-Baium Hair-Custom Accessories (SameStats) 5). Custom Fighter/Mage tattoo Lv1-Lv2-Lv3 6). Shirt (STR,CON,INT +1) 7). Custom Shields Server Commands: .tvtjoin .tvtleave – Join or leave tvt event. .ctfjoin .ctfleave – Join or leave ctf event. .dmjoin .dmleave – Join of leave dm event. .online – current online players count. .repair – repairs stuck character in world. .menu – opens online menu panel. .exit – PVP zone exit in case you are bullied. .changepassword - Opens online menu then u can change ur password in game. .farm - Enable/disable autofarm Event system: » TVT event » CTF event » DM event » Tournament Event » Party Zone » Unique event shop. Olympiad game: » Retail olympiad game. » Competition period [1] week. » Olympiad start time [18:00] end [00:00] GMT+2. » New Heroes every Sunday.
    • Tomorrow grand opening lests go 🙂 
    • New season of Warfire X150 has been postponed to September 28th.
  • Topics

×
×
  • Create New...