bump
|
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:
I checked my ItemDefinitionParser and this were the lines the error was on: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)
Wich also referred to this piece of code:Code:} else if (code >= 35 && code < 40) { String str = ByteBufferUtil.readString(buffer); def.setInventoryAction(code - 35, str);
I have fixed this error by changing the STRING_TERMINATOR int from 10 to 5. And it worked, but is this the right way?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(); }
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?
bump
bump
Apollo has a file server, maybe Apollo is trying to read the items in the old way? From the cache
Yeah i figured that out i think,
by that right?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; } } }
I compared that to the clients ItemDef readvalues , and it was pretty much the same ?
bump
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |