Fixed a bunch of potential bugs.
This commit is contained in:
@@ -100,10 +100,6 @@ public class BZip2Decompressor {
|
||||
i1++;
|
||||
j1--;
|
||||
} while (true);
|
||||
if (j1 == 0) {
|
||||
i = 1;
|
||||
break;
|
||||
}
|
||||
abyte0[i1] = byte4;
|
||||
i1++;
|
||||
j1--;
|
||||
|
||||
+3
-1
@@ -140,7 +140,9 @@ public class Definition<T extends Node> {
|
||||
if (examine == null) {
|
||||
try {
|
||||
examine = handlers.get("examine").toString();
|
||||
} catch (Exception e){}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(examine == null) {
|
||||
if (name.length() > 0) {
|
||||
examine = "It's a" + (StringUtils.isPlusN(name) ? "n " : " ") + name + ".";
|
||||
|
||||
@@ -3,6 +3,8 @@ package core.cache.def.impl;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -71,7 +73,7 @@ public final class CS2Mapping {
|
||||
*/
|
||||
public static void main(String... args) throws Throwable {
|
||||
GameWorld.prompt(false);
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter("./cs2.txt"));
|
||||
BufferedWriter bw = Files.newBufferedWriter(Paths.get("./cs2.txt"));
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
CS2Mapping mapping = forId(i);
|
||||
if (mapping == null) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class GraphicDefinition {
|
||||
if (def != null) {
|
||||
return def;
|
||||
}
|
||||
byte[] data = Cache.getIndexes()[21].getFileData(gfxId >>> 735411752, gfxId & 0xff);
|
||||
byte[] data = Cache.getIndexes()[21].getFileData(gfxId >>> 8, gfxId & 0xff);
|
||||
def = new GraphicDefinition();
|
||||
def.graphicsId = gfxId;
|
||||
if (data != null) {
|
||||
|
||||
@@ -57,10 +57,10 @@ public final class NPCDefinition extends Definition<NPC> {
|
||||
*/
|
||||
public boolean isVisibleOnMap;
|
||||
|
||||
/**
|
||||
/* *//**
|
||||
* The examine option value
|
||||
*/
|
||||
public String examine;
|
||||
*//*
|
||||
public String examine;*/
|
||||
|
||||
/**
|
||||
* The drop tables.
|
||||
@@ -201,7 +201,7 @@ public final class NPCDefinition extends Definition<NPC> {
|
||||
NPCDefinition def = DEFINITIONS.get(id);
|
||||
if (def == null) {
|
||||
def = new NPCDefinition(id);
|
||||
byte[] data = Cache.getIndexes()[18].getFileData(id >>> 134238215, id & 0x7f);
|
||||
byte[] data = Cache.getIndexes()[18].getFileData(id >>> 7, id & 0x7f);
|
||||
if (data == null) {
|
||||
if (id != -1) {
|
||||
// System.out.println("Failed loading NPC " + id + ".");
|
||||
|
||||
@@ -6,6 +6,7 @@ import core.cache.misc.buffer.ByteBufferUtils;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.object.Scenery;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
@@ -1670,6 +1671,6 @@ public class SceneryDefinition extends Definition<Scenery> {
|
||||
* @return The container id.
|
||||
*/
|
||||
public static int getContainerId(int id) {
|
||||
return id >>> 1998118472;
|
||||
return id >>> 8;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public class GZipDecompressor {
|
||||
|
||||
private static final Inflater inflaterInstance = new Inflater(true);
|
||||
|
||||
public static final void decompress(ByteBuffer buffer, byte data[]) {
|
||||
public static final void decompress(ByteBuffer buffer, byte[] data) {
|
||||
synchronized (inflaterInstance) {
|
||||
if (~buffer.get(buffer.position()) != -32 || buffer.get(buffer.position() + 1) != -117) {
|
||||
data = null;
|
||||
|
||||
@@ -2,6 +2,7 @@ package core.cache.misc.buffer;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Holds utility methods for reading/writing a byte buffer.
|
||||
@@ -29,7 +30,7 @@ public final class ByteBufferUtils {
|
||||
* @param buffer The byte buffer.
|
||||
*/
|
||||
public static void putString(String s, ByteBuffer buffer) {
|
||||
buffer.put(s.getBytes()).put((byte) 0);
|
||||
buffer.put(s.getBytes(StandardCharsets.UTF_8)).put((byte) 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user