Thread: [Apollo] Parsing definitions from Cache

Results 1 to 6 of 6
  1. #1 [Apollo] Parsing definitions from Cache 
    Registered Member DarkSlayerz's Avatar
    Join Date
    Nov 2008
    Posts
    928
    Thanks given
    88
    Thanks received
    44
    Rep Power
    46
    Hi guys,

    I was recently checking out the Server Buroa Released (http://www.rune-server.org/runescape...framework.html).

    And i have a client wich loads 474 Data. (Items, Maps, Objects, NPCS)

    But when i tried to run my server with this cache i got some errors,

    Firstly, the items:

    Code:
    SEVERE: Error whilst starting server.
    java.nio.BufferUnderflowException
    	at java.nio.Buffer.nextGetIndex(Buffer.java:492)
    	at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:135)
    	at org.apollo.util.ByteBufferUtil.readString(ByteBufferUtil.java:35)
    	at org.apollo.fs.parser.ItemDefinitionParser.parseDefinition(ItemDefinitionParser.java:124)
    	at org.apollo.fs.parser.ItemDefinitionParser.parse(ItemDefinitionParser.java:51)
    	at org.apollo.game.model.World.init(World.java:326)
    	at org.apollo.Server.start(Server.java:198)
    	at org.apollo.Server.main(Server.java:75)
    I checked my ItemDefinitionParser and this were the lines the error was on:

    Code:
    			} else if (code >= 35 && code < 40) {
    				String str = ByteBufferUtil.readString(buffer);
    				def.setInventoryAction(code - 35, str);
    Wich also referred to this piece of code:

    Code:
    	public static String readString(ByteBuffer buffer) {
    		final StringBuilder bldr = new StringBuilder();
    		char c;
    		while ((c = (char) buffer.get()) != NetworkConstants.STRING_TERMINATOR)
    			bldr.append(c);
    		return bldr.toString();
    	}
    I have fixed this error by changing the STRING_TERMINATOR int from 10 to 5. And it worked, but is this the right way?

    Then ive tried to run my server again, and it didnt give the error about the items but now about the objects. And pretty much the same things, can you guys please help me with this?
    Reply With Quote  
     

  2. #2  
    Registered Member DarkSlayerz's Avatar
    Join Date
    Nov 2008
    Posts
    928
    Thanks given
    88
    Thanks received
    44
    Rep Power
    46
    bump
    Reply With Quote  
     

  3. #3  
    Registered Member DarkSlayerz's Avatar
    Join Date
    Nov 2008
    Posts
    928
    Thanks given
    88
    Thanks received
    44
    Rep Power
    46
    bump
    Reply With Quote  
     

  4. #4  
    F*ck the rest join the best, WoR

    sigex's Avatar
    Join Date
    Mar 2008
    Age
    34
    Posts
    2,086
    Thanks given
    123
    Thanks received
    147
    Rep Power
    690
    Apollo has a file server, maybe Apollo is trying to read the items in the old way? From the cache


    The wor has begun.

    Reply With Quote  
     

  5. #5  
    Registered Member DarkSlayerz's Avatar
    Join Date
    Nov 2008
    Posts
    928
    Thanks given
    88
    Thanks received
    44
    Rep Power
    46
    Yeah i figured that out i think,

    Code:
    	private ItemDefinition parseDefinition(int id, ByteBuffer buffer) {
    		ItemDefinition def = new ItemDefinition(id);
    
    		while (true) {
    			int code = buffer.get() & 0xFF;
    
    			if (code == 0) {
    				return def;
    			} else if (code == 1) {
    				@SuppressWarnings("unused")
    				int modelId = buffer.getShort() & 0xFFFF;
    			} else if (code == 2) {
    				def.setName(ByteBufferUtil.readString(buffer));
    			} else if (code == 3) {
    				def.setDescription(ByteBufferUtil.readString(buffer));
    			} else if (code == 4) {
    				@SuppressWarnings("unused")
    				int modelScale = buffer.getShort() & 0xFFFF;
    			} else if (code == 5) {
    				@SuppressWarnings("unused")
    				int modelRotationX = buffer.getShort() & 0xFFFF;
    			} else if (code == 6) {
    				@SuppressWarnings("unused")
    				int modelRotationY = buffer.getShort() & 0xFFFF;
    			} else if (code == 7) {
    				@SuppressWarnings("unused")
    				int modelTransformationX = buffer.getShort();
    			} else if (code == 8) {
    				@SuppressWarnings("unused")
    				int modelTransformationY = buffer.getShort();
    			} else if (code == 10) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 11) {
    				def.setStackable(true);
    			} else if (code == 12) {
    				def.setValue(buffer.getInt());
    			} else if (code == 16) {
    				def.setMembersOnly(true);
    			} else if (code == 23) {
    				@SuppressWarnings("unused")
    				int unknownShort = buffer.getShort() & 0xFFFF;
    				@SuppressWarnings("unused")
    				int unknownByte = buffer.get();
    			} else if (code == 24) {
    				@SuppressWarnings("unused")
    				int unknownShort = buffer.getShort() & 0xFFFF;
    			} else if (code == 25) {
    				@SuppressWarnings("unused")
    				int unknownShort = buffer.getShort() & 0xFFFF;
    				@SuppressWarnings("unused")
    				int unknownByte = buffer.get();
    			} else if (code == 26) {
    				@SuppressWarnings("unused")
    				int unknownShort = buffer.getShort() & 0xFFFF;
    			} else if (code >= 30 && code < 35) {
    				String str = ByteBufferUtil.readString(buffer);
    				if (str.equalsIgnoreCase("hidden")) {
    					str = null;
    				}
    				def.setGroundAction(code - 30, str);
    			} else if (code >= 35 && code < 40) {
    				String str = ByteBufferUtil.readString(buffer);
    				def.setInventoryAction(code - 35, str);
    			} else if (code == 40) {
    				int colorCount = buffer.get() & 0xFF;
    				for (int i = 0; i < colorCount; i++) {
    					@SuppressWarnings("unused")
    					int oldColor = buffer.getShort() & 0xFFFF;
    					@SuppressWarnings("unused")
    					int newColor = buffer.getShort() & 0xFFFF;
    				}
    			} else if (code == 78) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 79) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 90) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 91) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 92) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 93) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 95) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 97) {
    				int noteInfoId = buffer.getShort() & 0xFFFF;
    				def.setNoteInfoId(noteInfoId);
    			} else if (code == 98) {
    				int noteGraphicId = buffer.getShort() & 0xFFFF;
    				def.setNoteGraphicId(noteGraphicId);
    			} else if (code >= 100 && code < 110) {
    				@SuppressWarnings("unused")
    				int stackId = buffer.getShort() & 0xFFFF;
    				@SuppressWarnings("unused")
    				int stackAmount = buffer.getShort() & 0xFFFF;
    			} else if (code == 110) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 111) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 112) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() & 0xFFFF;
    			} else if (code == 114) {
    				@SuppressWarnings("unused")
    				int unknown = buffer.getShort() * 5;
    			} else if (code == 115) {
    				@SuppressWarnings("unused")
    				int team = buffer.get() & 0xFF;
    			}
    		}
    	}
    by that right?

    I compared that to the clients ItemDef readvalues , and it was pretty much the same ?
    Reply With Quote  
     

  6. #6  
    Registered Member DarkSlayerz's Avatar
    Join Date
    Nov 2008
    Posts
    928
    Thanks given
    88
    Thanks received
    44
    Rep Power
    46
    bump
    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. Apollo actor definition parsing
    By Rabrg in forum Snippets
    Replies: 40
    Last Post: 03-17-2013, 03:17 PM
  2. [Apollo] NPC Definitions (Cache)
    By Chris Fletcher in forum Snippets
    Replies: 12
    Last Post: 05-21-2012, 12:06 AM
  3. loading icons from cache
    By harmy in forum Help
    Replies: 0
    Last Post: 03-22-2009, 02:18 PM
  4. Deleting stuff from cache
    By supra s in forum Help
    Replies: 3
    Last Post: 03-02-2009, 05:53 AM
  5. Update keys from cache?
    By Brown in forum Requests
    Replies: 9
    Last Post: 02-12-2009, 11:15 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •