cache: update definitions

This commit is contained in:
Kyle Fricilone
2017-05-08 11:52:26 -05:00
parent d007cdfa9f
commit 50857627e9
6 changed files with 186 additions and 6 deletions

View File

@@ -24,6 +24,8 @@
*/ */
package net.runelite.cache.definitions; package net.runelite.cache.definitions;
import java.util.Map;
public class ItemDefinition public class ItemDefinition
{ {
public int id; public int id;
@@ -96,6 +98,8 @@ public class ItemDefinition
public int placeholderId = -1; public int placeholderId = -1;
public int placeholderTemplateId = -1; public int placeholderTemplateId = -1;
public Map<Integer, Object> params = null;
public ItemDefinition(int definitionID) public ItemDefinition(int definitionID)
{ {
this.id = definitionID; this.id = definitionID;

View File

@@ -25,6 +25,8 @@
package net.runelite.cache.definitions; package net.runelite.cache.definitions;
import java.util.Map;
public class NpcDefinition public class NpcDefinition
{ {
@@ -54,13 +56,14 @@ public class NpcDefinition
public boolean hasRenderPriority = false; public boolean hasRenderPriority = false;
public int ambient = 0; public int ambient = 0;
public int headIcon = -1; public int headIcon = -1;
public int anInt2184 = 30; //public int anInt2184 = 30;
public int[] anIntArray2185; public int[] anIntArray2185;
public short[] retextureToFind; public short[] retextureToFind;
public int anInt2187 = -1; public int anInt2187 = -1;
public boolean isClickable = true; public boolean isClickable = true;
public int anInt2189 = -1; public int anInt2189 = -1;
public boolean aBool2190 = false; public boolean aBool2190 = false;
public Map<Integer, Object> params = null;
public NpcDefinition(int definitionID) public NpcDefinition(int definitionID)
{ {

View File

@@ -25,6 +25,8 @@
package net.runelite.cache.definitions; package net.runelite.cache.definitions;
import java.util.Map;
public class ObjectDefinition public class ObjectDefinition
{ {
private int id; private int id;
@@ -70,6 +72,7 @@ public class ObjectDefinition
private int anInt2112 = 0; private int anInt2112 = 0;
private int anInt2113 = 0; private int anInt2113 = 0;
private boolean aBool2114 = true; private boolean aBool2114 = true;
private Map<Integer, Object> params = null;
public int getId() public int getId()
{ {
@@ -500,4 +503,14 @@ public class ObjectDefinition
{ {
this.aBool2114 = aBool2114; this.aBool2114 = aBool2114;
} }
public Map<Integer, Object> getParams()
{
return params;
}
public void setParams(final Map<Integer, Object> params)
{
this.params = params;
}
} }

View File

@@ -30,6 +30,8 @@ import net.runelite.cache.io.InputStream;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.HashMap;
public class ItemLoader public class ItemLoader
{ {
private static final Logger logger = LoggerFactory.getLogger(ItemLoader.class); private static final Logger logger = LoggerFactory.getLogger(ItemLoader.class);
@@ -254,6 +256,31 @@ public class ItemLoader
{ {
def.placeholderTemplateId = stream.readUnsignedShort(); def.placeholderTemplateId = stream.readUnsignedShort();
} }
else if (opcode == 249)
{
int length = stream.readUnsignedByte();
def.params = new HashMap<>(length);
for (int i = 0; i < length; i++)
{
boolean isString = stream.readUnsignedByte() == 1;
int key = stream.read24BitInt();
Object value;
if (isString)
{
value = stream.readString();
}
else
{
value = stream.readInt();
}
def.params.put(key, value);
}
}
else else
{ {
logger.warn("Unrecognized opcode {}", opcode); logger.warn("Unrecognized opcode {}", opcode);

View File

@@ -29,6 +29,8 @@ import net.runelite.cache.io.InputStream;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.HashMap;
public class NpcLoader public class NpcLoader
{ {
private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class); private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class);
@@ -190,11 +192,11 @@ public class NpcLoader
def.anInt2187 = stream.readUnsignedShort(); def.anInt2187 = stream.readUnsignedShort();
if ('\uffff' == def.anInt2187) if ('\uffff' == def.anInt2187)
{ {
def.anInt2187 = -40212193; def.anInt2187 = -1;
} }
length = stream.readUnsignedByte(); length = stream.readUnsignedByte();
def.anIntArray2185 = new int[length + 1]; def.anIntArray2185 = new int[length + 2];
for (index = 0; index <= length; ++index) for (index = 0; index <= length; ++index)
{ {
@@ -205,6 +207,8 @@ public class NpcLoader
} }
} }
def.anIntArray2185[length + 1] = -1;
} }
else if (107 == opcode) else if (107 == opcode)
{ {
@@ -218,9 +222,68 @@ public class NpcLoader
{ {
def.aBool2190 = true; def.aBool2190 = true;
} }
else if (opcode == 112) //else if (opcode == 112) // Appears to be removed from the client
//{
// def.anInt2184 = stream.readUnsignedByte();
//}
else if (opcode == 118)
{ {
def.anInt2184 = stream.readUnsignedByte(); def.anInt2174 = stream.readUnsignedShort();
if ('\uffff' == def.anInt2174)
{
def.anInt2174 = -1;
}
def.anInt2187 = stream.readUnsignedShort();
if ('\uffff' == def.anInt2187)
{
def.anInt2187 = -1;
}
int var = stream.readUnsignedShort();
if (var == 0xFFFF)
{
var = -1;
}
length = stream.readUnsignedByte();
def.anIntArray2185 = new int[length + 2];
for (index = 0; index <= length; ++index)
{
def.anIntArray2185[index] = stream.readUnsignedShort();
if (def.anIntArray2185[index] == '\uffff')
{
def.anIntArray2185[index] = -1;
}
}
def.anIntArray2185[length + 1] = var;
}
else if (opcode == 249)
{
length = stream.readUnsignedByte();
def.params = new HashMap<>(length);
for (int i = 0; i < length; i++)
{
boolean isString = stream.readUnsignedByte() == 1;
int key = stream.read24BitInt();
Object value;
if (isString)
{
value = stream.readString();
}
else
{
value = stream.readInt();
}
def.params.put(key, value);
}
} }
else else
{ {

View File

@@ -29,6 +29,9 @@ import net.runelite.cache.io.InputStream;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
public class ObjectLoader public class ObjectLoader
{ {
private static final Logger logger = LoggerFactory.getLogger(ObjectLoader.class); private static final Logger logger = LoggerFactory.getLogger(ObjectLoader.class);
@@ -263,7 +266,7 @@ public class ObjectLoader
def.setConfigId(configId); def.setConfigId(configId);
int length = is.readUnsignedByte(); int length = is.readUnsignedByte();
int[] configChangeDest = new int[length + 1]; int[] configChangeDest = new int[length + 2];
for (int index = 0; index <= length; ++index) for (int index = 0; index <= length; ++index)
{ {
@@ -274,6 +277,8 @@ public class ObjectLoader
} }
} }
configChangeDest[length + 1] = -1;
def.setConfigChangeDest(configChangeDest); def.setConfigChangeDest(configChangeDest);
} }
else if (opcode == 78) else if (opcode == 78)
@@ -300,6 +305,71 @@ public class ObjectLoader
{ {
def.setAnInt2105(is.readUnsignedByte()); def.setAnInt2105(is.readUnsignedByte());
} }
else if (opcode == 92)
{
int varpID = is.readUnsignedShort();
if (varpID == 0xFFFF)
{
varpID = -1;
}
def.setVarpID(varpID);
int configId = is.readUnsignedShort();
if (configId == 0xFFFF)
{
configId = -1;
}
def.setConfigId(configId);
int var = is.readUnsignedShort();
if (var == 0xFFFF)
{
var = -1;
}
int length = is.readUnsignedByte();
int[] configChangeDest = new int[length + 2];
for (int index = 0; index <= length; ++index)
{
configChangeDest[index] = is.readUnsignedShort();
if (0xFFFF == configChangeDest[index])
{
configChangeDest[index] = -1;
}
}
configChangeDest[length + 1] = var;
def.setConfigChangeDest(configChangeDest);
}
else if (opcode == 249)
{
int length = is.readUnsignedByte();
Map<Integer, Object> params = new HashMap<>(length);
for (int i = 0; i < length; i++)
{
boolean isString = is.readUnsignedByte() == 1;
int key = is.read24BitInt();
Object value;
if (isString)
{
value = is.readString();
}
else
{
value = is.readInt();
}
params.put(key, value);
}
def.setParams(params);
}
else else
{ {
logger.warn("Unrecognized opcode {}", opcode); logger.warn("Unrecognized opcode {}", opcode);