Thread: Item Definitions

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 Item Definitions 
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    660
    Discord
    View profile
    Rep Power
    5000
    load from the cache or dumping from the client and loading from a file such as a binary file or xml etc.?
    Reply With Quote  
     

  2. #2  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,881
    Thanks given
    1,854
    Thanks received
    4,741
    Rep Power
    5000
    cache
    where in the cache are they included tho?



    Reply With Quote  
     

  3. #3  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    660
    Discord
    View profile
    Rep Power
    5000
    Apparently it is number 10 but I HAVE NO IDEA HOW TO GET IT.

    Rep++ to someone who give me theirs.

    (YES I KNOW I CAN REP)
    Reply With Quote  
     

  4. #4  
    Registered Member D4NyZ's Avatar
    Join Date
    Sep 2008
    Age
    25
    Posts
    664
    Thanks given
    50
    Thanks received
    10
    Rep Power
    30
    Cache.

    But in cache you can only find ids, names and descriptions, no bonus =[.
    Spoiler for Retard below:

    Quote Originally Posted by dani_gonzales View Post
    dany i know u hate me because i am better then u,,,so stfu noob and stop spaming my posts or i conntact a moderator!

    Reply With Quote  
     

  5. #5  
    Registered Member
    Serenity's Avatar
    Join Date
    Oct 2008
    Age
    32
    Posts
    2,327
    Thanks given
    43
    Thanks received
    43
    Rep Power
    389
    you can dump the bonus from rune wiki

    you can use this code...
    its sloppy and you need changing but it works...

    Code:
     package deversity.version508.world.ItemManager.Util;
     
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.net.URL;
    import java.util.ArrayList;
    
    import deversity.version508.world.ItemManager.ItemManager;
     /**
     * Created by IntelliJ IDEA.
     * Author  : Serenity
     * From    : Rune-server.org
     * Date    : 11-mrt-2010
     * Time    : 10:24:29
     * Package : com.serenity.Util
     */
    public class RuneWikiDump {
        public static void main(String argsp[]) {
            int i = 13;
            ItemManager.getInstance();
    new RuneWikiDump(i * 1000, (1000 * i++) + 1000);
              ItemManager.getInstance().getFileManager().exportAllDefinitions();
    new RuneWikiDump(i * 1000, (1000 * i++) + 1000);
              ItemManager.getInstance().getFileManager().exportAllDefinitions();
    new RuneWikiDump(i * 1000, (1000 * i++) + 1000);
              ItemManager.getInstance().getFileManager().exportAllDefinitions();
    new RuneWikiDump(i * 1000, (1000 * i++) + 1000);
            ItemManager.getInstance().getItemEditor();
       
        }
        public static ArrayList<String> noBonus = new ArrayList<String>();
         private static ArrayList<String> nodump = new ArrayList<String>();
        public RuneWikiDump(int start, int end) {
            Logger.log(this.getClass(), "starting to dump information  for items :" + start + " - " + end);
            for (int i = start; i < end; i++) {
                if (ItemManager.getInstance().getItemDefinition(i) != null) {
                    if (ItemManager.getInstance().getItemDefinition(i).getEquipmentDefinition() != null) {
                        if (ItemManager.getInstance().getItemDefinition(i).getEquipmentDefinition().getEquipId() > 0) {
                          //  Logger.log(this.getClass(), "starting to dump :" + i + " - " + ItemManager.getInstance().getItemDefinition(i).getItemName());
                            dump(i, ItemManager.getInstance().getItemDefinition(i).getItemName());
                        }
                    }
                }
            }
            System.out.println("\n");
               System.out.println(" Size = "+noBonus.size());
            for (int i = 0; i < noBonus.size(); i++) {
                Logger.log(this.getClass(), "no bonus found for :  " + noBonus.get(i));
            }
                    System.out.println("\n");
                     System.out.println(" Size = "+nodump.size());
            for (int i = 0; i < nodump.size(); i++) {
                Logger.log(this.getClass(), "no dump available :  " + nodump.get(i));
            }
        }
        public void dump(int id, String itemName) {
            itemName = itemName.replace(" ", "_").replace("\'", "%27");
            boolean tradeAble = false;
            boolean equipable = false;
            boolean isEquipable = false;
            boolean hasBonus = false;
            boolean dumpBonus = false;
            int bonus[] = null;
            int bonusIndex = 0;
            int dumpCount = 0;
            try {
                InputStream instr = new URL("[Only registered and activated users can see links. ]" + itemName).openStream();
                BufferedReader in = new BufferedReader(new InputStreamReader(instr));
                for (String j = in.readLine(); j != null; j = in.readLine()) {
                    if (hasBonus) {
                        if (bonus == null) {
                            bonus = new int[14];
                        }
                        dumpCount++;
                        if (dumpCount >= 15 && dumpCount <= 19)
                            bonus[bonusIndex++] = Integer.parseInt(j.substring(j.indexOf("align=\"center\">") + "align=\"center\">".length()).replace("%", "").replace("+", ""));
                        if (dumpCount >= 33 && dumpCount <= 38)
                            bonus[bonusIndex++] = Integer.parseInt(j.substring(j.indexOf("align=\"center\">") + "align=\"center\">".length()).replace("%", "").replace("+", ""));
                        if (dumpCount >= 50 && dumpCount <= 52)
                            bonus[bonusIndex++] = Integer.parseInt(j.substring(j.indexOf("align=\"center\">") + "align=\"center\">".length()).replace("%", "").replace("+", ""));
                    }
                    if (tradeAble) {
                        boolean isTradeAble = j.substring("</th><td> ".length()).equals("Yes");
                      //  ItemManager.itemDefinitions[id].setTradeAble(isTradeAble);
                        if (!isTradeAble)
                            ItemManager.itemDefinitions[id].setGrandExchangePrices(null);
                        tradeAble = false;
                    }
                    if (equipable) {
                        isEquipable = j.substring("</th><td> ".length()).equals("Yes");
                        equipable = false;
                    }
                    if (j.contains("<th nowrap=\"nowrap\"><a href=\"/wiki/Tradeable\" title=\"Tradeable\">Tradeable</a>?")) {
                        tradeAble = true;
                    }
                    if (j.contains("<th nowrap=\"nowrap\"><a href=\"/wiki/Equipment\" title=\"Equipment\">Equipable</a>?")) {
                        equipable = true;
                    }
                    if (isEquipable) {
                        if (j.contains("title=\"Equipment Stats\">Bonuses</a><br />")) {
                            hasBonus = true;
                        }
                    }
                }
                if (!hasBonus) {
                    noBonus.add(ItemManager.itemDefinitions[id].getItemId() + " : " + ItemManager.itemDefinitions[id].getItemName() + " : " + isEquipable);
                }
             // if (bonus != null)
                //  ItemManager.itemDefinitions[id].getEquipmentDefinition().setBonus(bonus);
            } catch (Exception e) {
                   nodump.add(ItemManager.itemDefinitions[id].getItemId() + " : " + ItemManager.itemDefinitions[id].getItemName());
              //  e.printStackTrace();
            }
        }
    }
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  6. #6  
    Valar Morghulis

    Laxika's Avatar
    Join Date
    Sep 2006
    Age
    29
    Posts
    2,813
    Thanks given
    1,804
    Thanks received
    274
    Rep Power
    2128
    Quote Originally Posted by Michael View Post
    load from the cache or dumping from the client and loading from a file such as a binary file or xml etc.?
    Dump then binary or XML...
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,789
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Michael View Post
    Apparently it is number 10 but I HAVE NO IDEA HOW TO GET IT.

    Rep++ to someone who give me theirs.

    (YES I KNOW I CAN REP)
    The same way the client gets it, perhaps if you bothered looking at the client for a while you may learn something.

    I'd load them using a file with all the data like we do now, since you'll have to load stat bonuses anyway.

    Reply With Quote  
     

  8. #8  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    660
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Duke Lukem View Post
    The same way the client gets it, perhaps if you bothered looking at the client for a while you may learn something.

    I'd load them using a file with all the data like we do now, since you'll have to load stat bonuses anyway.
    kk cool thanks

    P.S. I did look at it but got confused as I suck donkey dick before understanding clients
    Reply With Quote  
     

  9. #9  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,789
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Michael View Post
    kk cool thanks

    P.S. I did look at it but got confused as I suck donkey dick before understanding clients
    Everyone has to start somewhere, and yeah i understand the newer clients require a little more patience..but if you spent a few days learning how the cache works, it opens up alot of possibilities for you, aswell as gaining knowlege that can be used on any client version.

    Reply With Quote  
     

  10. #10  
    Registered Member
    craig903's Avatar
    Join Date
    Sep 2007
    Age
    27
    Posts
    1,358
    Thanks given
    14
    Thanks received
    92
    Rep Power
    238
    Well the problem we have is that the cache only contains a few bits of data for each item (id, name, and descriptions). I would load the items from a binary file and make a program to modify it. Another thing to consider is will you ever use certain items? Maybe just create a fresh binary file and then add item definitions in when you add them into the server. The average server uses around 200 items overall (lol) but load 4000. I am making a program which controlls the loading of items/npcs and other defs. It scans through all spawn files and the server source code to check for all needed npc/item definitions and then packs them in the binfile for the server to load. Wells thats the idea anyway.
    Visit Rune Miracle [Only registered and activated users can see links. ]
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •