Thread: Dumping itemDefs (incl equip slots.) via RSwiki

Results 1 to 4 of 4
  1. #1 Dumping itemDefs (incl equip slots.) via RSwiki 
    Registered Member
    Join Date
    Feb 2012
    Posts
    33
    Thanks given
    1
    Thanks received
    2
    Rep Power
    11
    Hello,

    I was wondering if anyone would know if it would be possible to dump itemdefs including equipment slots to an accuracy just by the fact that jagex includes an image of the slot on each specific page of an item.

    An example is as follows:





    Would it be possible, with using some sort of page search function to look for the specific image urls present on the page, could you define the equipment slot of that item? This has probably been found before, but its just merely an idea that popped into my head. And since I couldn't make something myself to do such a thing (though I wish I could), maybe someone else can take use of it.


    Rswiki Equip images are below, just copy the image url and take use

    Shield
    One-Handed Weapon Slot
    Two-Handed Slot
    Head Slot
    Chest Slot
    Legs Slot
    Feet Slot
    Glove Slot
    Back Slot
    Neck Slot
    Ring Slot
    Ammo Slot

    This thread is simply asking if this is possible, and even possibly how I could go about creating such a tool to dump item definitions into an xml file, but also to help others in a possible way to get even more out of the dump than previouly planned.
    Reply With Quote  
     

  2. #2  
    なぜこのテキストは日本語で書かれている ?

    Kenneh's Avatar
    Join Date
    Dec 2009
    Age
    30
    Posts
    2,753
    Thanks given
    63
    Thanks received
    296
    Rep Power
    478
    I'm sure you can, but I've always been bad at parsing html.


    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2012
    Posts
    33
    Thanks given
    1
    Thanks received
    2
    Rep Power
    11
    I've currently been trying to create something to do specifically this via the use of Pattern and Matcher resources through wildcard characters. Everything seems to be in order except my management of the wildcard characters and their placement in order to create catching groups.

    Code pasted below.

    Note: this isnt the full version, just merely a tester or what can be done. After I know it is responding correctly, a loop can be added and a file output sequence.

    Code:
    import java.io.*;
    import java.net.*;
    import java.util.regex.*;
    
    public class URLREADER {
        public static void main(String[] args) throws Exception {
        
    String expr = "Attack bonus</a>\\s+&nbsp;\\s+<span\\s+class=\"SkillClickPic\">" + 
    "<a\\s+href=\"/wiki/Attack\"\\s+title=\"Attack\"><img\\s+alt=\"Attack-icon.png\""
    + "\\s+src=\"http://images2.wikia.nocookie.net/__cb20120122084602/runescape/images/5/51/Attack-icon.png\""
    + "\\s+width=\"23\"\\s+height=\"23\"></a></span>"
    + "</th><th\\s+rowspan=\"3\"\\s+colspan=\"2\"\\s+width=\"30\"\\s+align=\"center\">"
    + "<p><a\\s+href=\"/wiki/" +
     "([^\"]+)";
    			  
    Pattern patt = Pattern.compile(expr,
      Pattern.DOTALL | Pattern.UNIX_LINES);
    URL url = new URL("http://runescape.wikia.com/wiki/Bronze_dagger");
    Matcher m = patt.matcher(getURLContent(url));
    System.out.println("Finding pattern... with.. " + m);
    while (m.find()) {
      System.out.println("Trying...");
      String stateURL = m.group(1);  
      System.out.println("equip slot was: " + stateURL);
    }
    }
    public static CharSequence getURLContent(URL url) throws IOException {
      URLConnection conn = url.openConnection();
      String encoding = conn.getContentEncoding();
      if (encoding == null) {
        encoding = "UTF-8";
      }
      BufferedReader br = new BufferedReader(new
          InputStreamReader(conn.getInputStream(), encoding));
      StringBuilder sb = new StringBuilder(16384);
      try {
        String line;
        while ((line = br.readLine()) != null) {
          sb.append(line);
          sb.append('\n');
    	  System.out.println(sb);
        }
      } finally {
        br.close();
      }
      return sb;
    }
    }
    As you can see it is clear that the string object is a mess, with my poor input of wildcard characters. If anybody can do this, I will leave the text and the part I am wishing to Catch group in bold below.

    Code:
    <th colspan="10" align="center"><span class="SkillClickPic"><a href="/wiki/Attack" title="Attack"><img alt="Attack-icon.png" src="http://images2.wikia.nocookie.net/__cb20120122084602/runescape/images/5/51/Attack-icon.png" width="23" height="23"></a></span> &nbsp; <a href="/wiki/Attack" title="Attack">Attack bonus</a> &nbsp; <span class="SkillClickPic"><a href="/wiki/Attack" title="Attack"><img alt="Attack-icon.png" src="http://images2.wikia.nocookie.net/__cb20120122084602/runescape/images/5/51/Attack-icon.png" width="23" height="23"></a></span>
    </th><th rowspan="3" colspan="2" width="30" align="center">
    <p><a href="/wiki/Weapon_slot" title="Weapon slot"><img alt="Weapon slot.PNG" src="http://images2.wikia.nocookie.net/__cb20120116173532/runescape/images/thumb/a/a8/Weapon_slot.PNG/29px-Weapon_slot.PNG" width="29" height="29"></a>
    </p>
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Feb 2012
    Posts
    33
    Thanks given
    1
    Thanks received
    2
    Rep Power
    11
    Bump.

    Also managed to create a test script solely working on deciding what equipslot is active and if none of them are, the debug refers it to not being equippable.
    This is most likely going to be finished by me now, including information in an rs2hd/ziotic format. (via RSwiki)

    For anyone interested in looking :

    This is it so far, just change the url to check the item.

    Note: The only issue I have found so far with this method is the fact that it is unable to detect a definite difference between the types of helmets (full helm , mask, etc.). A way to help this would be to filter them via string objects referring to the item name, but apart from that I'd say you're stuck to input them on your own .

    Code:
    import java.io.*;
    import java.net.*;
    import java.util.regex.*;
    
    public class URLREADER {
        public static void main(String[] args) throws Exception {
        
    String expr [] = {"Cape slot", "Ring Slot","Hands Slot","Legwear slot","Body slot","Head slot","Feet slot","Neck slot","Ammunition slot","Shield slot","Weapon slot","Two-handed slot"};
    String EquipType[] = {"CAPE","RING","GLOVES","LEGS","PLATEBODY","HAT","BOOTS","AMULET","ARROWS","SHIELD","WEAPON","WEAPON_2H"};
    int sum = 0;
    int count[] = {0,0,0,0,0,0,0,0,0,0,0,0};	 
    for ( int i = 0 ; i < expr.length; i++){
    
    
    Pattern patt = Pattern.compile(expr[i],
      Pattern.DOTALL | Pattern.UNIX_LINES);
    URL url = new URL("http://runescape.wikia.com/wiki/Logs");
    Matcher m = patt.matcher(getURLContent(url));
    System.out.println("Finding pattern... with.. " + m + " at " + url);
    while(m.find()) {
               count[i]++;
               System.out.println("Match number "
                                  + count[i]);           
          }
    	  if(count[i] > 0){
    	  if(count[11] > count[10]){
    		System.out.println("Item is: "+EquipType[11]);
    		return;
    		}
    	  System.out.println("Item is: " +EquipType[i]);	 	
    	  }	else{
    	  System.out.println("Item is not: " +EquipType[i]);
    	  }	  
    	  }
    	  if(count[0] == 0 && count[1] == 0 && count[2] == 0 && count[3] == 0 && count[4] == 0 && count[5] == 0 && count[6] == 0 && count[7] == 0 && count[8] == 0 && count[9] == 0
    	  && count[10] == 0 && count[11] == 0){
    	  System.out.println("Not equippable");
    	  }
    	  }
    	  
    	  
    	  
       
       
       
    
     
      
    public static CharSequence getURLContent(URL url) throws IOException {
      URLConnection conn = url.openConnection();
      String encoding = conn.getContentEncoding();
      if (encoding == null) {
        encoding = "UTF-8";
      }
      BufferedReader br = new BufferedReader(new
          InputStreamReader(conn.getInputStream(), encoding));
      StringBuilder sb = new StringBuilder(16384);
      try {
        String line;
        while ((line = br.readLine()) != null) {
          sb.append(line);
          sb.append('\n');
    	  //System.out.println(sb);
        }
      } finally {
        br.close();
      }
      return sb;
    }
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [PI]RsWiki Perfect Prayer Drain rates [PI]
    By Organic in forum Snippets
    Replies: 44
    Last Post: 12-22-2013, 09:44 AM
  2. RSWiki: The RS Server and Client Documentation Resource
    By t4__ in forum Informative Threads
    Replies: 61
    Last Post: 11-05-2012, 04:27 AM
  3. [PI] Item equip slots [PI]
    By Sillhouette in forum Help
    Replies: 2
    Last Post: 04-01-2011, 09:04 PM
  4. [Delta 317] Holding/equip slots/attack speed?
    By Re4master8 in forum Help
    Replies: 7
    Last Post: 06-28-2009, 10:12 PM
  5. Dumping Equip ID's from Client
    By Vastiko in forum Informative Threads
    Replies: 4
    Last Post: 06-12-2009, 08:21 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •