Skip to content

Commit

Permalink
project: merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed Oct 30, 2019
1 parent 13fc1f6 commit 2655654
Show file tree
Hide file tree
Showing 23 changed files with 205 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,37 @@
@Data
public class NpcDefinition
{

public final int id;
public short[] recolorToFind;
public int rotation = 32;
public String name = "null";
public short[] recolorToReplace;
public int size = 1;
public int[] models;
public int[] models_2;
public int stanceAnimation = -1;
public int anInt2165 = -1;
public int tileSpacesOccupied = 1;
public int walkAnimation = -1;
public short[] retextureToReplace;
public int rotate90RightAnimation = -1;
public boolean aBool2170 = true;
public int resizeX = 128;
public int contrast = 0;
public int[] chatheadModels;
public int standingAnimation = -1;
public int rotateLeftAnimation = -1;
public int rotateRightAnimation = -1;
public int walkingAnimation = -1;
public int rotate180Animation = -1;
public int varbitIndex = -1;
public String[] options = new String[5];
public boolean renderOnMinimap = true;
public int combatLevel = -1;
public int rotate90RightAnimation = -1;
public int rotate90LeftAnimation = -1;
public int resizeY = 128;
public boolean hasRenderPriority = false;
public int ambient = 0;
public short[] recolorToFind;
public short[] recolorToReplace;
public short[] retextureToFind;
public short[] retextureToReplace;
public String[] actions = new String[5];
public boolean isMinimapVisible = true;
public int combatLevel = -1;
public int widthScale = 128;
public int heightScale = 128;
public boolean hasRenderPriority;
public int ambient;
public int contrast;
public int headIcon = -1;
public int rotationSpeed = 32;
public int[] configs;
public short[] retextureToFind;
public int varbitId = -1;
public int varpIndex = -1;
public boolean isClickable = true;
public int anInt2189 = -1;
public boolean aBool2190 = false;
public Map<Integer, Object> params = null;
public boolean isInteractable = true;
public boolean rotationFlag = true;
public boolean isPet;
public Map<Integer, Object> params;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
*/
package net.runelite.cache.definitions.loaders;

import java.util.HashMap;
import net.runelite.cache.definitions.NpcDefinition;
import net.runelite.cache.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;

public class NpcLoader
{
private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class);
Expand Down Expand Up @@ -67,45 +66,44 @@ private void decodeValues(int opcode, NpcDefinition def, InputStream stream)
{
def.models[index] = stream.readUnsignedShort();
}

}
else if (opcode == 2)
{
def.name = stream.readString();
}
else if (opcode == 12)
{
def.tileSpacesOccupied = stream.readUnsignedByte();
def.size = stream.readUnsignedByte();
}
else if (opcode == 13)
{
def.stanceAnimation = stream.readUnsignedShort();
def.standingAnimation = stream.readUnsignedShort();
}
else if (opcode == 14)
{
def.walkAnimation = stream.readUnsignedShort();
def.walkingAnimation = stream.readUnsignedShort();
}
else if (opcode == 15)
{
def.anInt2165 = stream.readUnsignedShort();
def.rotateLeftAnimation = stream.readUnsignedShort();
}
else if (opcode == 16)
{
def.anInt2189 = stream.readUnsignedShort();
def.rotateRightAnimation = stream.readUnsignedShort();
}
else if (opcode == 17)
{
def.walkAnimation = stream.readUnsignedShort();
def.walkingAnimation = stream.readUnsignedShort();
def.rotate180Animation = stream.readUnsignedShort();
def.rotate90RightAnimation = stream.readUnsignedShort();
def.rotate90LeftAnimation = stream.readUnsignedShort();
}
else if (opcode >= 30 && opcode < 35)
{
def.options[opcode - 30] = stream.readString();
if (def.options[opcode - 30].equalsIgnoreCase("Hidden"))
def.actions[opcode - 30] = stream.readString();
if (def.actions[opcode - 30].equalsIgnoreCase("Hidden"))
{
def.options[opcode - 30] = null;
def.actions[opcode - 30] = null;
}
}
else if (opcode == 40)
Expand Down Expand Up @@ -137,29 +135,29 @@ else if (opcode == 41)
else if (opcode == 60)
{
length = stream.readUnsignedByte();
def.models_2 = new int[length];
def.chatheadModels = new int[length];

for (index = 0; index < length; ++index)
{
def.models_2[index] = stream.readUnsignedShort();
def.chatheadModels[index] = stream.readUnsignedShort();
}

}
else if (opcode == 93)
{
def.renderOnMinimap = false;
def.isMinimapVisible = false;
}
else if (opcode == 95)
{
def.combatLevel = stream.readUnsignedShort();
}
else if (opcode == 97)
{
def.resizeX = stream.readUnsignedShort();
def.widthScale = stream.readUnsignedShort();
}
else if (opcode == 98)
{
def.resizeY = stream.readUnsignedShort();
def.heightScale = stream.readUnsignedShort();
}
else if (opcode == 99)
{
Expand All @@ -179,18 +177,18 @@ else if (opcode == 102)
}
else if (opcode == 103)
{
def.rotation = stream.readUnsignedShort();
def.rotationSpeed = stream.readUnsignedShort();
}
else if (opcode == 106)
{
def.varbitIndex = stream.readUnsignedShort();
if ('\uffff' == def.varbitIndex)
def.varbitId = stream.readUnsignedShort();
if (def.varbitId == 65535)
{
def.varbitIndex = -1;
def.varbitId = -1;
}

def.varpIndex = stream.readUnsignedShort();
if ('\uffff' == def.varpIndex)
if (def.varpIndex == 65535)
{
def.varpIndex = -1;
}
Expand All @@ -212,26 +210,26 @@ else if (opcode == 106)
}
else if (opcode == 107)
{
def.isClickable = false;
def.isInteractable = false;
}
else if (opcode == 109)
{
def.aBool2170 = false;
def.rotationFlag = false;
}
else if (opcode == 111)
{
def.aBool2190 = true;
def.isPet = true;
}
else if (opcode == 118)
{
def.varbitIndex = stream.readUnsignedShort();
if ('\uffff' == def.varbitIndex)
def.varbitId = stream.readUnsignedShort();
if (def.varbitId == 65535)
{
def.varbitIndex = -1;
def.varbitId = -1;
}

def.varpIndex = stream.readUnsignedShort();
if ('\uffff' == def.varpIndex)
if (def.varpIndex == 65535)
{
def.varpIndex = -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,45 @@ public byte[] save(NpcDefinition npc)
out.writeByte(2);
out.writeString(npc.name);
}
if (npc.tileSpacesOccupied != 1)
if (npc.size != 1)
{
out.writeByte(12);
out.writeByte(npc.tileSpacesOccupied);
out.writeByte(npc.size);
}
if (npc.stanceAnimation != -1)
if (npc.standingAnimation != -1)
{
out.writeByte(13);
out.writeShort(npc.stanceAnimation);
out.writeShort(npc.standingAnimation);
}
if (npc.walkAnimation != -1)
if (npc.walkingAnimation != -1)
{
out.writeByte(14);
out.writeShort(npc.walkAnimation);
out.writeShort(npc.walkingAnimation);
}
if (npc.anInt2165 != -1)
if (npc.rotateLeftAnimation != -1)
{
out.writeByte(15);
out.writeShort(npc.anInt2165);
out.writeShort(npc.rotateLeftAnimation);
}
if (npc.anInt2189 != -1)
if (npc.rotateRightAnimation != -1)
{
out.writeByte(16);
out.writeShort(npc.anInt2189);
out.writeShort(npc.rotateRightAnimation);
}
if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1)
{
out.writeByte(17);
out.writeShort(npc.walkAnimation);
out.writeShort(npc.walkingAnimation);
out.writeShort(npc.rotate180Animation);
out.writeShort(npc.rotate90RightAnimation);
out.writeShort(npc.rotate90LeftAnimation);
}
for (int i = 0; i < 5; ++i)
{
if (npc.options[i] != null)
if (npc.actions[i] != null)
{
out.writeByte(30 + i);
out.writeString(npc.options[i]);
out.writeString(npc.actions[i]);
}
}
if (npc.recolorToFind != null && npc.recolorToReplace != null)
Expand All @@ -108,16 +108,16 @@ public byte[] save(NpcDefinition npc)
out.writeShort(npc.retextureToReplace[i]);
}
}
if (npc.models_2 != null)
if (npc.chatheadModels != null)
{
out.writeByte(60);
out.writeByte(npc.models_2.length);
for (int modelId : npc.models_2)
out.writeByte(npc.chatheadModels.length);
for (int modelId : npc.chatheadModels)
{
out.writeShort(modelId);
}
}
if (!npc.renderOnMinimap)
if (!npc.isMinimapVisible)
{
out.writeByte(93);
}
Expand All @@ -127,9 +127,9 @@ public byte[] save(NpcDefinition npc)
out.writeShort(npc.combatLevel);
}
out.writeByte(97);
out.writeShort(npc.resizeX);
out.writeShort(npc.widthScale);
out.writeByte(98);
out.writeShort(npc.resizeY);
out.writeShort(npc.heightScale);
if (npc.hasRenderPriority)
{
out.writeByte(99);
Expand All @@ -144,23 +144,23 @@ public byte[] save(NpcDefinition npc)
out.writeShort(npc.headIcon);
}
out.writeByte(103);
out.writeShort(npc.rotation);
if (!npc.isClickable)
out.writeShort(npc.rotationSpeed);
if (!npc.isInteractable)
{
out.writeByte(107);
}
if (!npc.aBool2170)
if (!npc.rotationFlag)
{
out.writeByte(109);
}
if (npc.aBool2190)
if (npc.isPet)
{
out.writeByte(111);
}
if (npc.configs != null)
{
out.writeByte(118);
out.writeShort(npc.varbitIndex);
out.writeShort(npc.varbitId);
out.writeShort(npc.varpIndex);

int[] c = npc.configs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import net.runelite.http.api.config.Configuration;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
Expand All @@ -66,11 +67,12 @@ public class ConfigService

@Autowired
public ConfigService(
MongoClient mongoClient
MongoClient mongoClient,
@Value("${mongo.database}") String databaseName
)
{

MongoDatabase database = mongoClient.getDatabase("config");
MongoDatabase database = mongoClient.getDatabase(databaseName);
MongoCollection<Document> collection = database.getCollection("config");
this.mongoCollection = collection;

Expand Down
1 change: 1 addition & 0 deletions http-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ redis:

mongo:
jndiName: java:comp/env/mongodb/runelite
database: runelite

# Twitter client for feed
runelite:
Expand Down
Loading

0 comments on commit 2655654

Please sign in to comment.