Merge branch 'master' into true-current-tile

This commit is contained in:
Jesse Serrao
2019-03-26 01:09:09 +00:00
committed by GitHub
419 changed files with 15414 additions and 6200 deletions
+1
View File
@@ -6,6 +6,7 @@ cache:
- $HOME/.m2 - $HOME/.m2
jdk: jdk:
- oraclejdk8 - oraclejdk8
- openjdk11
install: true install: true
script: ./travis/build.sh script: ./travis/build.sh
notifications: notifications:
+1 -1
View File
@@ -29,7 +29,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<artifactId>cache-client</artifactId> <artifactId>cache-client</artifactId>
-7
View File
@@ -1,7 +0,0 @@
jdbc.url=jdbc:mysql://192.168.1.2:3306/cache
jdbc.username=runelite
jdbc.password=runelite
minio.url=http://192.168.1.2:9000
minio.accesskey=QPQ15JX1ESAVMR0TLCL1
minio.secretkey=
minio.bucket=runelite
+1 -1
View File
@@ -28,7 +28,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<name>Cache Updater</name> <name>Cache Updater</name>
@@ -33,9 +33,10 @@ import java.util.Map;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.sql2o.Sql2o; import org.sql2o.Sql2o;
import org.sql2o.converters.Converter; import org.sql2o.converters.Converter;
import org.sql2o.quirks.NoQuirks; import org.sql2o.quirks.NoQuirks;
@@ -43,16 +44,7 @@ import org.sql2o.quirks.NoQuirks;
@Configuration @Configuration
public class CacheConfiguration public class CacheConfiguration
{ {
@Value("${jdbc.url}") @Value("${minio.endpoint}")
private String jdbcUrl;
@Value("${jdbc.username}")
private String jdbcUsername;
@Value("${jdbc.password}")
private String jdbcPassword;
@Value("${minio.url}")
private String minioUrl; private String minioUrl;
@Value("${minio.accesskey}") @Value("${minio.accesskey}")
@@ -62,13 +54,10 @@ public class CacheConfiguration
private String minioSecretKey; private String minioSecretKey;
@Bean @Bean
@ConfigurationProperties(prefix = "datasource.runelite-cache")
public DataSource dataSource() public DataSource dataSource()
{ {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); return DataSourceBuilder.create().build();
dataSource.setUrl(jdbcUrl);
dataSource.setUsername(jdbcUsername);
dataSource.setPassword(jdbcPassword);
return dataSource;
} }
@Bean @Bean
@@ -0,0 +1,16 @@
---
# Database
datasource:
runelite-cache:
driverClassName: com.mysql.jdbc.Driver
type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
url: jdbc:mysql://localhost/runelite-cache
username: runelite
password: runelite
# Minio client storage for cache
minio:
endpoint: http://localhost:9000
accesskey: AM54M27O4WZK65N6F8IP
secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP
bucket: runelite
+1 -1
View File
@@ -29,7 +29,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<artifactId>cache</artifactId> <artifactId>cache</artifactId>
@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.definitions.ScriptDefinition;
import net.runelite.cache.io.InputStream; import net.runelite.cache.io.InputStream;
import static net.runelite.cache.script.Opcodes.LOAD_STRING; import static net.runelite.cache.script.Opcodes.SCONST;
import static net.runelite.cache.script.Opcodes.POP_INT; import static net.runelite.cache.script.Opcodes.POP_INT;
import static net.runelite.cache.script.Opcodes.POP_STRING; import static net.runelite.cache.script.Opcodes.POP_STRING;
import static net.runelite.cache.script.Opcodes.RETURN; import static net.runelite.cache.script.Opcodes.RETURN;
@@ -94,7 +94,7 @@ public class ScriptLoader
for (int i = 0; in.getOffset() < endIdx; instructions[i++] = opcode) for (int i = 0; in.getOffset() < endIdx; instructions[i++] = opcode)
{ {
opcode = in.readUnsignedShort(); opcode = in.readUnsignedShort();
if (opcode == LOAD_STRING) if (opcode == SCONST)
{ {
stringOperands[i] = in.readString(); stringOperands[i] = in.readString();
} }
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.definitions.ScriptDefinition;
import net.runelite.cache.io.OutputStream; import net.runelite.cache.io.OutputStream;
import static net.runelite.cache.script.Opcodes.LOAD_STRING; import static net.runelite.cache.script.Opcodes.SCONST;
import static net.runelite.cache.script.Opcodes.POP_INT; import static net.runelite.cache.script.Opcodes.POP_INT;
import static net.runelite.cache.script.Opcodes.POP_STRING; import static net.runelite.cache.script.Opcodes.POP_STRING;
import static net.runelite.cache.script.Opcodes.RETURN; import static net.runelite.cache.script.Opcodes.RETURN;
@@ -48,7 +48,7 @@ public class ScriptSaver
{ {
int opcode = instructions[i]; int opcode = instructions[i];
out.writeShort(opcode); out.writeShort(opcode);
if (opcode == LOAD_STRING) if (opcode == SCONST)
{ {
out.writeString(stringOperands[i]); out.writeString(stringOperands[i]);
} }
@@ -28,10 +28,6 @@ public class Instruction
{ {
private final int opcode; private final int opcode;
private String name; private String name;
private int intStackPops;
private int stringStackPops;
private int intStackPushes;
private int stringStackPushes;
public Instruction(int opcode) public Instruction(int opcode)
{ {
@@ -52,44 +48,4 @@ public class Instruction
{ {
this.name = name; this.name = name;
} }
public int getIntStackPops()
{
return intStackPops;
}
public void setIntStackPops(int intStackPops)
{
this.intStackPops = intStackPops;
}
public int getStringStackPops()
{
return stringStackPops;
}
public void setStringStackPops(int stringStackPops)
{
this.stringStackPops = stringStackPops;
}
public int getIntStackPushes()
{
return intStackPushes;
}
public void setIntStackPushes(int intStackPushes)
{
this.intStackPushes = intStackPushes;
}
public int getStringStackPushes()
{
return stringStackPushes;
}
public void setStringStackPushes(int stringStackPushes)
{
this.stringStackPushes = stringStackPushes;
}
} }
File diff suppressed because it is too large Load Diff
+444 -362
View File
@@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2017, Adam <Adam@sigterm.info> * Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2018-2019, Hunter WB <hunterwb.com>
* Copyright (c) 2019, Abex
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -26,10 +28,10 @@ package net.runelite.cache.script;
public class Opcodes public class Opcodes
{ {
public static final int LOAD_INT = 0; public static final int ICONST = 0;
public static final int GET_VARP = 1; public static final int GET_VARP = 1;
public static final int PUT_VARP = 2; public static final int SET_VARP = 2;
public static final int LOAD_STRING = 3; public static final int SCONST = 3;
public static final int JUMP = 6; public static final int JUMP = 6;
public static final int IF_ICMPNE = 7; public static final int IF_ICMPNE = 7;
public static final int IF_ICMPEQ = 8; public static final int IF_ICMPEQ = 8;
@@ -44,374 +46,454 @@ public class Opcodes
public static final int ISTORE = 34; public static final int ISTORE = 34;
public static final int SLOAD = 35; public static final int SLOAD = 35;
public static final int SSTORE = 36; public static final int SSTORE = 36;
public static final int STRING_APPEND = 37; public static final int JOIN_STRING = 37;
public static final int POP_INT = 38; public static final int POP_INT = 38;
public static final int POP_STRING = 39; public static final int POP_STRING = 39;
public static final int INVOKE = 40; public static final int INVOKE = 40;
public static final int GET_VARC = 42; public static final int GET_VARC_INT = 42;
public static final int PUT_VARC = 43; public static final int SET_VARC_INT = 43;
public static final int ARRAY_INITIALIZE = 44; public static final int DEFINE_ARRAY = 44;
public static final int ARRAY_LOAD = 45; public static final int GET_ARRAY_INT = 45;
public static final int ARRAY_STORE = 46; public static final int SET_ARRAY_INT = 46;
public static final int GET_VARC_STRING = 47; public static final int GET_VARC_STRING_OLD = 47;
public static final int PUT_VARC_STRING = 48; public static final int SET_VARC_STRING_OLD = 48;
public static final int GET_VARC_STRING = 49;
public static final int SET_VARC_STRING = 50;
public static final int SWITCH = 60; public static final int SWITCH = 60;
public static final int WIDGET_CREATE_CHILD = 100; public static final int CC_CREATE = 100;
public static final int WIDGET_DESTROY_CHILD = 101; public static final int CC_DELETE = 101;
public static final int WIDGET_UNSET_CHILDREN = 102; public static final int CC_DELETEALL = 102;
public static final int WIDGET_LOAD_CHILD = 200; public static final int CC_FIND = 200;
public static final int WIDGET_LOAD = 201; public static final int IF_FIND = 201;
public static final int WIDGET_PUT_POSITION = 1000; public static final int CC_SETPOSITION = 1000;
public static final int WIDGET_PUT_SIZE = 1001; public static final int CC_SETSIZE = 1001;
public static final int WIDGET_PUT_HIDDEN = 1003; public static final int CC_SETHIDE = 1003;
public static final int WIDGET_PUT_NO_CLICK_THROUGH = 1005; public static final int CC_SETNOCLICKTHROUGH = 1005;
public static final int WIDGET_PUT_SCROLL = 1100; public static final int CC_SETSCROLLPOS = 1100;
public static final int WIDGET_PUT_TEXTCOLOR = 1101; public static final int CC_SETCOLOUR = 1101;
public static final int WIDGET_PUT_FILLED = 1102; public static final int CC_SETFILL = 1102;
public static final int WIDGET_PUT_OPACITY = 1103; public static final int CC_SETTRANS = 1103;
public static final int WIDGET_PUT_LINE_WIDTH = 1104; public static final int CC_SETLINEWID = 1104;
public static final int WIDGET_PUT_SPRITEID = 1105; public static final int CC_SETGRAPHIC = 1105;
public static final int WIDGET_PUT_TEXTUREID = 1106; public static final int CC_SET2DANGLE = 1106;
public static final int WIDGET_PUT_SPRITE_TILING = 1107; public static final int CC_SETTILING = 1107;
public static final int WIDGET_PUT_MODELID_1 = 1108; public static final int CC_SETMODEL = 1108;
public static final int WIDGET_PUT_3D_ROTATION = 1109; public static final int CC_SETMODELANGLE = 1109;
public static final int WIDGET_PUT_ANIMATION = 1110; public static final int CC_SETMODELANIM = 1110;
public static final int WIDGET_PUT_TEXT = 1112; public static final int CC_SETMODELORTHOG = 1111;
public static final int WIDGET_PUT_FONTID = 1113; public static final int CC_SETTEXT = 1112;
public static final int WIDGET_PUT_TEXT_ALIGNMENT = 1114; public static final int CC_SETTEXTFONT = 1113;
public static final int WIDGET_PUT_TEXT_SHADOWED = 1115; public static final int CC_SETTEXTALIGN = 1114;
public static final int WIDGET_PUT_BORDERTHICKNESS = 1116; public static final int CC_SETTEXTSHADOW = 1115;
public static final int WIDGET_PUT_SPRITE2 = 1117; public static final int CC_SETOUTLINE = 1116;
public static final int WIDGET_PUT_FLIPPEDVERTICALLY = 1118; public static final int CC_SETGRAPHICSHADOW = 1117;
public static final int WIDGET_PUT_FLIPPEDHORIZONALLY = 1119; public static final int CC_SETVFLIP = 1118;
public static final int WIDGET_PUT_SCROLLWIDTHHEIGHT = 1120; public static final int CC_SETHFLIP = 1119;
public static final int WIDGET_ADVANCE_DIALOGUE = 1121; public static final int CC_SETSCROLLSIZE = 1120;
public static final int WIDGET_PUT_MODELID_2 = 1201; public static final int CC_RESUME_PAUSEBUTTON = 1121;
public static final int WIDGET_PUT_MODELID_3 = 1202; public static final int CC_SETFILLCOLOUR = 1123;
public static final int WIDGET_PUT_ACTION = 1300; public static final int CC_SETLINEDIRECTION = 1126;
public static final int WIDGET_PUT_DRAG_PARENT = 1301; public static final int CC_SETOBJECT = 1200;
public static final int WIDGET_PUT_NAME = 1305; public static final int CC_SETNPCHEAD = 1201;
public static final int WIDGET_PUT_SELECTED_ACTION = 1306; public static final int CC_SETPLAYERHEAD_SELF = 1202;
public static final int WIDGET_PUT_ACTIONS_NULL = 1307; public static final int CC_SETOBJECT_NONUM = 1205;
public static final int WIDGET_PUT_MOUSE_PRESS_LISTENER = 1400; public static final int CC_SETOBJECT_ALWAYS_NUM = 1212;
public static final int WIDGET_PUT_DRAGGED_OVER_LISTENER = 1401; public static final int CC_SETOP = 1300;
public static final int WIDGET_PUT_MOUSE_RELEASE_LISTENER = 1402; public static final int CC_SETDRAGGABLE = 1301;
public static final int WIDGET_PUT_MOUSE_ENTER_LISTENER = 1403; public static final int CC_SETDRAGGABLEBEHAVIOR = 1302;
public static final int WIDGET_PUT_MOUSE_EXIT_LISTENER = 1404; public static final int CC_SETDRAGDEADZONE = 1303;
public static final int WIDGET_PUT_DRAG_START_LISTENER = 1405; public static final int CC_SETDRAGDEADTIME = 1304;
public static final int WIDGET_PUT_USE_WITH_LISTENER = 1406; public static final int CC_SETOPBASE = 1305;
public static final int WIDGET_PUT_CONFIG_LISTENER = 1407; public static final int CC_SETTARGETVERB = 1306;
public static final int WIDGET_PUT_RENDER_LISTENER = 1408; public static final int CC_CLEAROPS = 1307;
public static final int WIDGET_PUT_OPTION_CLICK_LISTENER = 1409; public static final int CC_SETONCLICK = 1400;
public static final int WIDGET_PUT_DRAG_RELEASE_LISTENER = 1410; public static final int CC_SETONHOLD = 1401;
public static final int WIDGET_PUT_DRAG_LISTENER = 1411; public static final int CC_SETONRELEASE = 1402;
public static final int WIDGET_PUT_MOUSE_HOVER_LISTENER = 1412; public static final int CC_SETONMOUSEOVER = 1403;
public static final int WIDGET_PUT_TABLE_LISTENER = 1414; public static final int CC_SETONMOUSELEAVE = 1404;
public static final int WIDGET_PUT_SKILL_LISTENER = 1415; public static final int CC_SETONDRAG = 1405;
public static final int WIDGET_PUT_USE_LISTENER = 1416; public static final int CC_SETONTARGETLEAVE = 1406;
public static final int WIDGET_PUT_SCROLL_LISTENER = 1417; public static final int CC_SETONVARTRANSMIT = 1407;
public static final int WIDGET_PUT_MSG_LISTENER = 1418; public static final int CC_SETONTIMER = 1408;
public static final int WIDGET_PUT_KEY_LISTENER = 1419; public static final int CC_SETONOP = 1409;
public static final int WIDGET_PUT_FRIENDS_LISTENER = 1420; public static final int CC_SETONDRAGCOMPLETE = 1410;
public static final int WIDGET_PUT_CLAN_LISTENER = 1421; public static final int CC_SETONCLICKREPEAT = 1411;
public static final int WIDGET_PUT_DIALOG_ABORT_LISTENER = 1423; public static final int CC_SETONMOUSEREPEAT = 1412;
public static final int WIDGET_PUT_OPENCLOSE_LISTENER = 1424; public static final int CC_SETONINVTRANSMIT = 1414;
public static final int WIDGET_PUT_GE_LISTENER = 1425; public static final int CC_SETONSTATTRANSMIT = 1415;
public static final int WIDGET_PUT_RESIZE_LISTENER = 1427; public static final int CC_SETONTARGETENTER = 1416;
public static final int WIDGET_GET_RELATIVEX = 1500; public static final int CC_SETONSCROLLWHEEL = 1417;
public static final int WIDGET_GET_RELATIVEY = 1501; public static final int CC_SETONCHATTRANSMIT = 1418;
public static final int WIDGET_GET_WIDTH = 1502; public static final int CC_SETONKEY = 1419;
public static final int WIDGET_GET_HEIGHT = 1503; public static final int CC_SETONFRIENDTRANSMIT = 1420;
public static final int WIDGET_GET_HIDDEN = 1504; public static final int CC_SETONCLANTRANSMIT = 1421;
public static final int WIDGET_GET_PARENTID = 1505; public static final int CC_SETONMISCTRANSMIT = 1422;
public static final int WIDGET_GET_SCROLLX = 1600; public static final int CC_SETONDIALOGABORT = 1423;
public static final int WIDGET_GET_SCROLLY = 1601; public static final int CC_SETONSUBCHANGE = 1424;
public static final int WIDGET_GET_TEXT = 1602; public static final int CC_SETONSTOCKTRANSMIT = 1425;
public static final int WIDGET_GET_SCROLLWIDTH = 1603; public static final int CC_SETONRESIZE = 1427;
public static final int WIDGET_GET_SCROLLHEIGHT = 1604; public static final int CC_GETX = 1500;
public static final int WIDGET_GET_MODELZOOM = 1605; public static final int CC_GETY = 1501;
public static final int WIDGET_GET_ROTATIONX = 1606; public static final int CC_GETWIDTH = 1502;
public static final int WIDGET_GET_ROTATIONY = 1607; public static final int CC_GETHEIGHT = 1503;
public static final int WIDGET_GET_ROTATIONZ = 1608; public static final int CC_GETHIDE = 1504;
public static final int WIDGET_GET_OPACITY = 1609; public static final int CC_GETLAYER = 1505;
public static final int WIDGET_GET_TEXTCOLOR = 1611; public static final int CC_GETSCROLLX = 1600;
public static final int WIDGET_GET_ITEMID = 1700; public static final int CC_GETSCROLLY = 1601;
public static final int WIDGET_GET_STACKSIZE = 1701; public static final int CC_GETTEXT = 1602;
public static final int WIDGET_GET_INDEX = 1702; public static final int CC_GETSCROLLWIDTH = 1603;
public static final int WIDGET_GET_CONFIG = 1800; public static final int CC_GETSCROLLHEIGHT = 1604;
public static final int WIDGET_GET_ACTION = 1801; public static final int CC_GETMODELZOOM = 1605;
public static final int WIDGET_GET_NAME = 1802; public static final int CC_GETMODELANGLE_X = 1606;
public static final int WIDGET_PUT_POSITION_WIDGET = WIDGET_PUT_POSITION + 1000; public static final int CC_GETMODELANGLE_Z = 1607;
public static final int WIDGET_PUT_SIZE_WIDGET = WIDGET_PUT_SIZE + 1000; public static final int CC_GETMODELANGLE_Y = 1608;
public static final int WIDGET_PUT_HIDDEN_WIDGET = WIDGET_PUT_HIDDEN + 1000; public static final int CC_GETTRANS = 1609;
public static final int WIDGET_PUT_NO_CLICK_THROUGH_WIDGET = WIDGET_PUT_NO_CLICK_THROUGH + 1000; public static final int CC_GETCOLOUR = 1611;
public static final int WIDGET_PUT_SCROLL_WIDGET = WIDGET_PUT_SCROLL + 1000; public static final int CC_GETFILLCOLOUR = 1612;
public static final int WIDGET_PUT_TEXTCOLOR_WIDGET = WIDGET_PUT_TEXTCOLOR + 1000; public static final int CC_GETINVOBJECT = 1700;
public static final int WIDGET_PUT_FILLED_WIDGET = WIDGET_PUT_FILLED + 1000; public static final int CC_GETINVCOUNT = 1701;
public static final int WIDGET_PUT_OPACITY_WIDGET = WIDGET_PUT_OPACITY + 1000; public static final int CC_GETID = 1702;
public static final int WIDGET_PUT_LINE_WIDTH_WIDGET = WIDGET_PUT_LINE_WIDTH + 1000; public static final int CC_GETTARGETMASK = 1800;
public static final int WIDGET_PUT_SPRITEID_WIDGET = WIDGET_PUT_SPRITEID + 1000; public static final int CC_GETOP = 1801;
public static final int WIDGET_PUT_TEXTUREID_WIDGET = WIDGET_PUT_TEXTUREID + 1000; public static final int CC_GETOPBASE = 1802;
public static final int WIDGET_PUT_SPRITE_TILING_WIDGET = WIDGET_PUT_SPRITE_TILING + 1000; public static final int CC_CALLONRESIZE = 1927;
public static final int WIDGET_PUT_MODELID_1_WIDGET = WIDGET_PUT_MODELID_1 + 1000; public static final int IF_SETPOSITION = 2000;
public static final int WIDGET_PUT_3D_ROTATION_WIDGET = WIDGET_PUT_3D_ROTATION + 1000; public static final int IF_SETSIZE = 2001;
public static final int WIDGET_PUT_ANIMATION_WIDGET = WIDGET_PUT_ANIMATION + 1000; public static final int IF_SETHIDE = 2003;
public static final int WIDGET_PUT_TEXT_WIDGET = WIDGET_PUT_TEXT + 1000; public static final int IF_SETNOCLICKTHROUGH = 2005;
public static final int WIDGET_PUT_FONTID_WIDGET = WIDGET_PUT_FONTID + 1000; public static final int IF_SETSCROLLPOS = 2100;
public static final int WIDGET_PUT_TEXT_ALIGNMENT_WIDGET = WIDGET_PUT_TEXT_ALIGNMENT + 1000; public static final int IF_SETCOLOUR = 2101;
public static final int WIDGET_PUT_TEXT_SHADOWED_WIDGET = WIDGET_PUT_TEXT_SHADOWED + 1000; public static final int IF_SETFILL = 2102;
public static final int WIDGET_PUT_BORDERTHICKNESS_WIDGET = WIDGET_PUT_BORDERTHICKNESS + 1000; public static final int IF_SETTRANS = 2103;
public static final int WIDGET_PUT_SPRITE2_WIDGET = WIDGET_PUT_SPRITE2 + 1000; public static final int IF_SETLINEWID = 2104;
public static final int WIDGET_PUT_FLIPPEDVERTICALLY_WIDGET = WIDGET_PUT_FLIPPEDVERTICALLY + 1000; public static final int IF_SETGRAPHIC = 2105;
public static final int WIDGET_PUT_FLIPPEDHORIZONALLY_WIDGET = WIDGET_PUT_FLIPPEDHORIZONALLY + 1000; public static final int IF_SET2DANGLE = 2106;
public static final int WIDGET_PUT_SCROLLWIDTHHEIGHT_WIDGET = WIDGET_PUT_SCROLLWIDTHHEIGHT + 1000; public static final int IF_SETTILING = 2107;
public static final int WIDGET_ADVANCE_DIALOGUE_WIDGET = WIDGET_ADVANCE_DIALOGUE + 1000; public static final int IF_SETMODEL = 2108;
public static final int WIDGET_PUT_MODELID_2_WIDGET = WIDGET_PUT_MODELID_2 + 1000; public static final int IF_SETMODELANGLE = 2109;
public static final int WIDGET_PUT_MODELID_3_WIDGET = WIDGET_PUT_MODELID_3 + 1000; public static final int IF_SETMODELANIM = 2110;
public static final int WIDGET_PUT_ACTION_WIDGET = WIDGET_PUT_ACTION + 1000; public static final int IF_SETMODELORTHOG = 2111;
public static final int WIDGET_PUT_DRAG_PARENT_WIDGET = WIDGET_PUT_DRAG_PARENT + 1000; public static final int IF_SETTEXT = 2112;
public static final int WIDGET_PUT_NAME_WIDGET = WIDGET_PUT_NAME + 1000; public static final int IF_SETTEXTFONT = 2113;
public static final int WIDET_PUT_SELECTED_ACTION_WIDGET = WIDGET_PUT_SELECTED_ACTION + 1000; public static final int IF_SETTEXTALIGN = 2114;
public static final int WIDGET_PUT_ACTIONS_NULL_WIDGET = WIDGET_PUT_ACTIONS_NULL + 1000; public static final int IF_SETTEXTSHADOW = 2115;
public static final int WIDGET_PUT_MOUSE_PRESS_LISTENER_WIDGET = WIDGET_PUT_MOUSE_PRESS_LISTENER + 1000; public static final int IF_SETOUTLINE = 2116;
public static final int WIDGET_PUT_DRAGGED_OVER_LISTENER_WIDGET = WIDGET_PUT_DRAGGED_OVER_LISTENER + 1000; public static final int IF_SETGRAPHICSHADOW = 2117;
public static final int WIDGET_PUT_MOUSE_RELEASE_LISTENER_WIDGET = WIDGET_PUT_MOUSE_RELEASE_LISTENER + 1000; public static final int IF_SETVFLIP = 2118;
public static final int WIDGET_PUT_MOUSE_ENTER_LISTENER_WIDGET = WIDGET_PUT_MOUSE_ENTER_LISTENER + 1000; public static final int IF_SETHFLIP = 2119;
public static final int WIDGET_PUT_MOUSE_EXIT_LISTENER_WIDGET = WIDGET_PUT_MOUSE_EXIT_LISTENER + 1000; public static final int IF_SETSCROLLSIZE = 2120;
public static final int WIDGET_PUT_DRAG_START_LISTENER_WIDGET = WIDGET_PUT_DRAG_START_LISTENER + 1000; public static final int IF_RESUME_PAUSEBUTTON = 2121;
public static final int WIDGET_PUT_USE_WITH_LISTENER_WIDGET = WIDGET_PUT_USE_WITH_LISTENER + 1000; public static final int IF_SETFILLCOLOUR = 2123;
public static final int WIDGET_PUT_CONFIG_LISTENER_WIDGET = WIDGET_PUT_CONFIG_LISTENER + 1000; public static final int IF_SETLINEDIRECTION = 2126;
public static final int WIDGET_PUT_RENDER_LISTENER_WIDGET = WIDGET_PUT_RENDER_LISTENER + 1000; public static final int IF_SETOBJECT = 2200;
public static final int WIDGET_PUT_OPTION_CLICK_LISTENER_WIDGET = WIDGET_PUT_OPTION_CLICK_LISTENER + 1000; public static final int IF_SETNPCHEAD = 2201;
public static final int WIDGET_PUT_DRAG_RELEASE_LISTENER_WIDGET = WIDGET_PUT_DRAG_RELEASE_LISTENER + 1000; public static final int IF_SETPLAYERHEAD_SELF = 2202;
public static final int WIDGET_PUT_DRAG_LISTENER_WIDGET = WIDGET_PUT_DRAG_LISTENER + 1000; public static final int IF_SETOBJECT_NONUM = 2205;
public static final int WIDGET_PUT_MOUSE_HOVER_LISTENER_WIDGET = WIDGET_PUT_MOUSE_HOVER_LISTENER + 1000; public static final int IF_SETOBJECT_ALWAYS_NUM = 2212;
public static final int WIDGET_PUT_TABLE_LISTENER_WIDGET = WIDGET_PUT_TABLE_LISTENER + 1000; public static final int IF_SETOP = 2300;
public static final int WIDGET_PUT_SKILL_LISTENER_WIDGET = WIDGET_PUT_SKILL_LISTENER + 1000; public static final int IF_SETDRAGGABLE = 2301;
public static final int WIDGET_PUT_USE_LISTENER_WIDGET = WIDGET_PUT_USE_LISTENER + 1000; public static final int IF_SETDRAGGABLEBEHAVIOR = 2302;
public static final int WIDGET_PUT_SCROLL_LISTENER_WIDGET = WIDGET_PUT_SCROLL_LISTENER + 1000; public static final int IF_SETDRAGDEADZONE = 2303;
public static final int WIDGET_PUT_MSG_LISTENER_WIDGET = WIDGET_PUT_MSG_LISTENER + 1000; public static final int IF_SETDRAGDEADTIME = 2304;
public static final int WIDGET_PUT_KEY_LISTENER_WIDGET = WIDGET_PUT_KEY_LISTENER + 1000; public static final int IF_SETOPBASE = 2305;
public static final int WIDGET_PUT_FRIENDS_LISTENER_WIDGET = WIDGET_PUT_FRIENDS_LISTENER + 1000; public static final int IF_SETTARGETVERB = 2306;
public static final int WIDGET_PUT_CLAN_LISTENER_WIDGET = WIDGET_PUT_CLAN_LISTENER + 1000; public static final int IF_CLEAROPS = 2307;
public static final int WIDGET_PUT_DIALOG_ABORT_LISTENER_WIDGET = WIDGET_PUT_DIALOG_ABORT_LISTENER + 1000; public static final int IF_SETOPKEY = 2350;
public static final int WIDGET_PUT_OPENCLOSE_LISTENER_WIDGET = WIDGET_PUT_OPENCLOSE_LISTENER + 1000; public static final int IF_SETOPTKEY = 2351;
public static final int WIDGET_PUT_GE_LISTENER_WIDGET = WIDGET_PUT_GE_LISTENER + 1000; public static final int IF_SETOPKEYRATE = 2352;
public static final int WIDGET_PUT_RESIZE_LISTENER_WIDGET = WIDGET_PUT_RESIZE_LISTENER + 1000; public static final int IF_SETOPTKEYRATE = 2353;
public static final int WIDGET_GET_RELATIVEX_WIDGET = WIDGET_GET_RELATIVEX + 1000; public static final int IF_SETOPKEYIGNOREHELD = 2354;
public static final int WIDGET_GET_RELATIVEY_WIDGET = WIDGET_GET_RELATIVEY + 1000; public static final int IF_SETOPTKEYIGNOREHELD = 2355;
public static final int WIDGET_GET_WIDTH_WIDGET = WIDGET_GET_WIDTH + 1000; public static final int IF_SETONCLICK = 2400;
public static final int WIDGET_GET_HEIGHT_WIDGET = WIDGET_GET_HEIGHT + 1000; public static final int IF_SETONHOLD = 2401;
public static final int WIDGET_GET_HIDDEN_WIDGET = WIDGET_GET_HIDDEN + 1000; public static final int IF_SETONRELEASE = 2402;
public static final int WIDGET_GET_PARENTID_WIDGET = WIDGET_GET_PARENTID + 1000; public static final int IF_SETONMOUSEOVER = 2403;
public static final int WIDGET_GET_SCROLLX_WIDGET = WIDGET_GET_SCROLLX + 1000; public static final int IF_SETONMOUSELEAVE = 2404;
public static final int WIDGET_GET_SCROLLY_WIDGET = WIDGET_GET_SCROLLY + 1000; public static final int IF_SETONDRAG = 2405;
public static final int WIDGET_GET_TEXT_WIDGET = WIDGET_GET_TEXT + 1000; public static final int IF_SETONTARGETLEAVE = 2406;
public static final int WIDGET_GET_SCROLLWIDTH_WIDGET = WIDGET_GET_SCROLLWIDTH + 1000; public static final int IF_SETONVARTRANSMIT = 2407;
public static final int WIDGET_GET_SCROLLHEIGHT_WIDGET = WIDGET_GET_SCROLLHEIGHT + 1000; public static final int IF_SETONTIMER = 2408;
public static final int WIDGET_GET_MODELZOOM_WIDGET = WIDGET_GET_MODELZOOM + 1000; public static final int IF_SETONOP = 2409;
public static final int WIDGET_GET_ROTATIONX_WIDGET = WIDGET_GET_ROTATIONX + 1000; public static final int IF_SETONDRAGCOMPLETE = 2410;
public static final int WIDGET_GET_ROTATIONY_WIDGET = WIDGET_GET_ROTATIONY + 1000; public static final int IF_SETONCLICKREPEAT = 2411;
public static final int WIDGET_GET_ROTATIONZ_WIDGET = WIDGET_GET_ROTATIONZ + 1000; public static final int IF_SETONMOUSEREPEAT = 2412;
public static final int WIDGET_GET_OPACITY_WIDGET = WIDGET_GET_OPACITY + 1000; public static final int IF_SETONINVTRANSMIT = 2414;
public static final int WIDGET_GET_TEXTCOLOR_WIDGET = WIDGET_GET_TEXTCOLOR + 1000; public static final int IF_SETONSTATTRANSMIT = 2415;
public static final int WIDGET_GET_ITEMID_WIDGET = WIDGET_GET_ITEMID + 1000; public static final int IF_SETONTARGETENTER = 2416;
public static final int WIDGET_GET_STACKSIZE_WIDGET = WIDGET_GET_STACKSIZE + 1000; public static final int IF_SETONSCROLLWHEEL = 2417;
public static final int WIGET_GET_INDEX_WIDGET = WIDGET_GET_INDEX + 1000; public static final int IF_SETONCHATTRANSMIT = 2418;
public static final int GET_WIDGET_ROOT = 2706; public static final int IF_SETONKEY = 2419;
public static final int WIDGET_GET_CONFIG_WIGET = WIDGET_GET_CONFIG + 1000; public static final int IF_SETONFRIENDTRANSMIT = 2420;
public static final int WIDGET_GET_ACTION_WIDGET = WIDGET_GET_ACTION + 1000; public static final int IF_SETONCLANTRANSMIT = 2421;
public static final int WIDGET_GET_NAME_WIDGET = WIDGET_GET_NAME + 1000; public static final int IF_SETONMISCTRANSMIT = 2422;
public static final int SEND_GAME_MESSAGE = 3100; public static final int IF_SETONDIALOGABORT = 2423;
public static final int PLAYER_ANIMATE = 3101; public static final int IF_SETONSUBCHANGE = 2424;
public static final int CLOSE_WINDOW = 3103; public static final int IF_SETONSTOCKTRANSMIT = 2425;
public static final int NUMERIC_INPUT = 3104; public static final int IF_SETONRESIZE = 2427;
public static final int STRING_INPUT_1 = 3105; public static final int IF_GETX = 2500;
public static final int STRING_INPUT_2 = 3106; public static final int IF_GETY = 2501;
public static final int PLAYER_ACTION = 3107; public static final int IF_GETWIDTH = 2502;
public static final int SET_TOP_CONTEXT_MENU_ROW = 3108; public static final int IF_GETHEIGHT = 2503;
public static final int SET_TOP_CONTEXT_MENU_ROW_2 = 3109; public static final int IF_GETHIDE = 2504;
public static final int SET_MOUSE_BUTTON_CONTROLS_CAMERA = 3110; public static final int IF_GETLAYER = 2505;
public static final int GET_HIDEROOFS = 3111; public static final int IF_GETSCROLLX = 2600;
public static final int SET_HIDEROOFS = 3112; public static final int IF_GETSCROLLY = 2601;
public static final int OPEN_URL = 3113; public static final int IF_GETTEXT = 2602;
public static final int ITEM_PRICE = 3115; public static final int IF_GETSCROLLWIDTH = 2603;
public static final int SEND_BUG_REPORT = 3116; public static final int IF_GETSCROLLHEIGHT = 2604;
public static final int SET_SHIFT_DROP_ENABLED = 3117; public static final int IF_GETMODELZOOM = 2605;
public static final int SET_CONNECTION_TEXT_ENABLED = 3126; public static final int IF_GETMODELANGLE_X = 2606;
public static final int PLAY_SOUND_EFFECT = 3200; public static final int IF_GETMODELANGLE_Z = 2607;
public static final int GET_GAMECYCLE = 3300; public static final int IF_GETMODELANGLE_Y = 2608;
public static final int GET_ITEMCONTAINER_ITEMID = 3301; public static final int IF_GETTRANS = 2609;
public static final int GET_ITEMCONTAINER_STACKSIZE = 3302; public static final int IF_GETCOLOUR = 2611;
public static final int GET_ITEMCONTAINER_STACKSIZES_TOTAL = 3303; public static final int IF_GETFILLCOLOUR = 2612;
public static final int GET_INVENTORY_SIZE = 3304; public static final int IF_GETINVOBJECT = 2700;
public static final int GET_BOOSTEDSKILLLEVELS = 3305; public static final int IF_GETINVCOUNT = 2701;
public static final int GET_REALSKILLLEVELS = 3306; public static final int IF_HASSUB = 2702;
public static final int GET_SKILLEXPERIENCES = 3307; public static final int IF_GETTOP = 2706;
public static final int GET_COORDINATES = 3308; public static final int IF_GETTARGETMASK = 2800;
public static final int DIVIDE_BY_16384 = 3309; public static final int IF_GETOP = 2801;
public static final int RIGHT_SHIFT_28 = 3310; public static final int IF_GETOPBASE = 2802;
public static final int AND_16384 = 3311; public static final int IF_CALLONRESIZE = 2927;
public static final int GET_ISMEMBERS = 3312; public static final int MES = 3100;
public static final int GET_ITEMCONTAINER_ITEMID_2 = 3313; public static final int ANIM = 3101;
public static final int GET_ITEMCONTAINER_STACKSIZE_2 = 3314; public static final int IF_CLOSE = 3103;
public static final int GET_ITEMCONTAINER_STACKSIZES_TOTAL_2 = 3315; public static final int RESUME_COUNTDIALOG = 3104;
public static final int GET_RIGHTS = 3316; public static final int RESUME_NAMEDIALOG = 3105;
public static final int GET_SYSTEM_UPDATE_TIMER = 3317; public static final int RESUME_STRINGDIALOG = 3106;
public static final int GET_WORLDNUM = 3318; public static final int OPPLAYER = 3107;
public static final int GET_ENERGY = 3321; public static final int IF_DRAGPICKUP = 3108;
public static final int GET_WEIGHT = 3322; public static final int CC_DRAGPICKUP = 3109;
public static final int GET_PLAYERMOD = 3323; public static final int MOUSECAM = 3110;
public static final int GET_FLAGS = 3324; public static final int GETREMOVEROOFS = 3111;
public static final int PACK_LOCATION = 3325; public static final int SETREMOVEROOFS = 3112;
public static final int GET_ENUM_VALUE = 3408; public static final int OPENURL = 3113;
public static final int GET_FRIENDCOUNT = 3600; public static final int RESUME_OBJDIALOG = 3115;
public static final int GET_FRIEND = 3601; public static final int BUG_REPORT = 3116;
public static final int GET_FRIEND_WORLD = 3602; public static final int SETSHIFTCLICKDROP = 3117;
public static final int GET_FRIEND_RANK = 3603; public static final int SETSHOWMOUSEOVERTEXT = 3118;
public static final int ADD_FRIEND = 3605; public static final int RENDERSELF = 3119;
public static final int REMOVE_FRIEND = 3606; public static final int SETSHOWMOUSECROSS = 3125;
public static final int ADD_IGNORE = 3607; public static final int SETSHOWLOADINGMESSAGES = 3126;
public static final int REMOVE_IGNORE = 3608; public static final int SETTAPTODROP = 3127;
public static final int IS_FRIEND = 3609; public static final int GETTAPTODROP = 3128;
public static final int GET_CLANCHAT_OWNER = 3611; public static final int GETCANVASSIZE = 3132;
public static final int GET_CLANCHATCOUNT = 3612; public static final int SETHIDEUSERNAME = 3141;
public static final int GET_CLAN_MEMBER_NAME = 3613; public static final int GETHIDEUSERNAME = 3142;
public static final int GET_CLAN_MEMBER_WORLD = 3614; public static final int SETREMEMBERUSERNAME = 3143;
public static final int GET_CLAN_MEMBER_RANK = 3615; public static final int GETREMEMBERUSERNAME = 3144;
public static final int CLANCHAT_KICK_RANK = 3616; public static final int SOUND_SYNTH = 3200;
public static final int CLANCHAT_KICK_CLANMEMBER = 3617; public static final int SOUND_SONG = 3201;
public static final int GET_CLANCHAT_RANK = 3618; public static final int SOUND_JINGLE = 3202;
public static final int JOIN_CLANCHAT = 3619; public static final int CLIENTCLOCK = 3300;
public static final int PART_CLANCHAT = 3620; public static final int INV_GETOBJ = 3301;
public static final int GET_IGNORECOUNT = 3621; public static final int INV_GETNUM = 3302;
public static final int GET_IGNORE = 3622; public static final int INV_TOTAL = 3303;
public static final int IS_IGNORE = 3623; public static final int INV_SIZE = 3304;
public static final int CLANMEMBER_ISME = 3624; public static final int STAT = 3305;
public static final int GET_CLANCHATOWNER = 3625; public static final int STAT_BASE = 3306;
public static final int GET_GRANDEXCHANGE_OFFER_IS_SELLING = 3903; public static final int STAT_XP = 3307;
public static final int GET_GRANDEXCHANGE_OFFER_ITEMID = 3904; public static final int COORD = 3308;
public static final int GET_GRANDEXCHANGE_OFFER_PRICE = 3905; public static final int COORDX = 3309;
public static final int GET_GRANDEXCHANGE_OFFER_TOTALQUANTITY = 3906; public static final int COORDZ = 3310;
public static final int GET_GRANDEXCHANGE_OFFER_QUANTITYSOLD = 3907; public static final int COORDY = 3311;
public static final int GET_GRANDEXCHANGE_OFFER_SPENT = 3908; public static final int MAP_MEMBERS = 3312;
public static final int GET_GRANDEXCHANGE_OFFER_NOT_STARTED = 3910; public static final int INVOTHER_GETOBJ = 3313;
public static final int GET_GRANDEXCHANGE_OFFER_STATUS_2 = 3911; public static final int INVOTHER_GETNUM = 3314;
public static final int GET_GRANDEXCHANGE_OFFER_DONE = 3912; public static final int INVOTHER_TOTAL = 3315;
public static final int IADD = 4000; public static final int STAFFMODLEVEL = 3316;
public static final int ISUB = 4001; public static final int REBOOTTIMER = 3317;
public static final int IMUL = 4002; public static final int MAP_WORLD = 3318;
public static final int IDIV = 4003; public static final int RUNENERGY_VISIBLE = 3321;
public static final int RAND_EXCL = 4004; public static final int RUNWEIGHT_VISIBLE = 3322;
public static final int RAND_INCL = 4005; public static final int PLAYERMOD = 3323;
public static final int WORLDFLAGS = 3324;
public static final int MOVECOORD = 3325;
public static final int ENUM_STRING = 3400;
public static final int ENUM = 3408;
public static final int ENUM_GETOUTPUTCOUNT = 3411;
public static final int FRIEND_COUNT = 3600;
public static final int FRIEND_GETNAME = 3601;
public static final int FRIEND_GETWORLD = 3602;
public static final int FRIEND_GETRANK = 3603;
public static final int FRIEND_SETRANK = 3604;
public static final int FRIEND_ADD = 3605;
public static final int FRIEND_DEL = 3606;
public static final int IGNORE_ADD = 3607;
public static final int IGNORE_DEL = 3608;
public static final int FRIEND_TEST = 3609;
public static final int CLAN_GETCHATDISPLAYNAME = 3611;
public static final int CLAN_GETCHATCOUNT = 3612;
public static final int CLAN_GETCHATUSERNAME = 3613;
public static final int CLAN_GETCHATUSERWORLD = 3614;
public static final int CLAN_GETCHATUSERRANK = 3615;
public static final int CLAN_GETCHATMINKICK = 3616;
public static final int CLAN_KICKUSER = 3617;
public static final int CLAN_GETCHATRANK = 3618;
public static final int CLAN_JOINCHAT = 3619;
public static final int CLAN_LEAVECHAT = 3620;
public static final int IGNORE_COUNT = 3621;
public static final int IGNORE_GETNAME = 3622;
public static final int IGNORE_TEST = 3623;
public static final int CLAN_ISSELF = 3624;
public static final int CLAN_GETCHATOWNERNAME = 3625;
public static final int CLAN_ISFRIEND = 3626;
public static final int CLAN_ISIGNORE = 3627;
public static final int STOCKMARKET_GETOFFERTYPE = 3903;
public static final int STOCKMARKET_GETOFFERITEM = 3904;
public static final int STOCKMARKET_GETOFFERPRICE = 3905;
public static final int STOCKMARKET_GETOFFERCOUNT = 3906;
public static final int STOCKMARKET_GETOFFERCOMPLETEDCOUNT = 3907;
public static final int STOCKMARKET_GETOFFERCOMPLETEDGOLD = 3908;
public static final int STOCKMARKET_ISOFFEREMPTY = 3910;
public static final int STOCKMARKET_ISOFFERSTABLE = 3911;
public static final int STOCKMARKET_ISOFFERFINISHED = 3912;
public static final int STOCKMARKET_ISOFFERADDING = 3913;
public static final int TRADINGPOST_SORTBY_NAME = 3914;
public static final int TRADINGPOST_SORTBY_PRICE = 3915;
public static final int TRADINGPOST_SORTFILTERBY_WORLD = 3916;
public static final int TRADINGPOST_SORTBY_AGE = 3917;
public static final int TRADINGPOST_SORTBY_COUNT = 3918;
public static final int TRADINGPOST_GETTOTALOFFERS = 3919;
public static final int TRADINGPOST_GETOFFERWORLD = 3920;
public static final int TRADINGPOST_GETOFFERNAME = 3921;
public static final int TRADINGPOST_GETOFFERPREVIOUSNAME = 3922;
public static final int TRADINGPOST_GETOFFERAGE = 3923;
public static final int TRADINGPOST_GETOFFERCOUNT = 3924;
public static final int TRADINGPOST_GETOFFERPRICE = 3925;
public static final int TRADINGPOST_GETOFFERITEM = 3926;
public static final int ADD = 4000;
public static final int SUB = 4001;
public static final int MULTIPLY = 4002;
public static final int DIV = 4003;
public static final int RANDOM = 4004;
public static final int RANDOMINC = 4005;
public static final int INTERPOLATE = 4006; public static final int INTERPOLATE = 4006;
public static final int ADD_PERCENT = 4007; public static final int ADDPERCENT = 4007;
public static final int SET_BIT = 4008; public static final int SETBIT = 4008;
public static final int CLEAR_BIT = 4009; public static final int CLEARBIT = 4009;
public static final int TEST_BIT = 4010; public static final int TESTBIT = 4010;
public static final int MODULO = 4011; public static final int MOD = 4011;
public static final int POW = 4012; public static final int POW = 4012;
public static final int INVPOW = 4013; public static final int INVPOW = 4013;
public static final int AND = 4014; public static final int AND = 4014;
public static final int OR = 4015; public static final int OR = 4015;
public static final int SCALE = 4018; public static final int SCALE = 4018;
public static final int CONCAT_INT = 4100; public static final int APPEND_NUM = 4100;
public static final int CONCAT_STRING = 4101; public static final int APPEND = 4101;
public static final int TOLOWERCASE = 4103; public static final int APPEND_SIGNNUM = 4102;
public static final int FORMAT_DATE = 4104; public static final int LOWERCASE = 4103;
public static final int SWITCH_MALE_OR_FEMALE = 4105; public static final int FROMDATE = 4104;
public static final int INT_TO_STRING = 4106; public static final int TEXT_GENDER = 4105;
public static final int STRING_COMPARE = 4107; public static final int TOSTRING = 4106;
public static final int GET_LINE_COUNT = 4108; public static final int COMPARE = 4107;
public static final int GET_MAX_LINE_WIDTH = 4109; public static final int PARAHEIGHT = 4108;
public static final int SWITCH_STRING = 4110; public static final int PARAWIDTH = 4109;
public static final int APPENDTAGS = 4111; public static final int TEXT_SWITCH = 4110;
public static final int CONCAT_CHAR = 4112; public static final int ESCAPE = 4111;
public static final int CHAR_IS_PRINTABLE = 4113; public static final int APPEND_CHAR = 4112;
public static final int ISALNUM = 4114; public static final int CHAR_ISPRINTABLE = 4113;
public static final int ISALPHA = 4115; public static final int CHAR_ISALPHANUMERIC = 4114;
public static final int ISDIGIT = 4116; public static final int CHAR_ISALPHA = 4115;
public static final int CHAR_ISNUMERIC = 4116;
public static final int STRING_LENGTH = 4117; public static final int STRING_LENGTH = 4117;
public static final int STRING_SUBSTRING = 4118; public static final int SUBSTRING = 4118;
public static final int STRING_REMOVE_HTML = 4119; public static final int REMOVETAGS = 4119;
public static final int STRING_INDEXOF = 4120; public static final int STRING_INDEXOF_CHAR = 4120;
public static final int STRING_INDEXOF_FROM = 4121; public static final int STRING_INDEXOF_STRING = 4121;
public static final int GET_ITEM_NAME = 4200; public static final int OC_NAME = 4200;
public static final int GET_ITEM_GROUND_ACTION = 4201; public static final int OC_OP = 4201;
public static final int GET_ITEM_INVENTORY_ACTION = 4202; public static final int OC_IOP = 4202;
public static final int GET_ITEM_PRICE = 4203; public static final int OC_COST = 4203;
public static final int GET_ITEM_STACKABLE = 4204; public static final int OC_STACKABLE = 4204;
public static final int GET_ITEM_NOTE_1 = 4205; public static final int OC_CERT = 4205;
public static final int GET_ITEM_NOTE_2 = 4206; public static final int OC_UNCERT = 4206;
public static final int GET_ITEM_ISMEMBERS = 4207; public static final int OC_MEMBERS = 4207;
public static final int SEARCH_ITEM = 4210; public static final int OC_PLACEHOLDER = 4208;
public static final int NEXT_SEARCH_RESULT = 4211; public static final int OC_UNPLACEHOLDER = 4209;
public static final int CHATFILTER_UPDATE = 5001; public static final int OC_FIND = 4210;
public static final int REPORT_PLAYER = 5002; public static final int OC_FINDNEXT = 4211;
public static final int GET_CHAT_MESSAGE_TYPE = 5003; public static final int OC_FINDRESET = 4212;
public static final int GET_CHAT_MESSAGE = 5004; public static final int CHAT_GETFILTER_PUBLIC = 5000;
public static final int CHATBOX_INPUT = 5008; public static final int CHAT_SETFILTER = 5001;
public static final int PRIVMSG = 5009; public static final int CHAT_SENDABUSEREPORT = 5002;
public static final int GET_LOCALPLAYER_NAME = 5015; public static final int CHAT_GETHISTORY_BYTYPEANDLINE = 5003;
public static final int GET_CHATLINEBUFFER_LENGTH = 5017; public static final int CHAT_GETHISTORY_BYUID = 5004;
public static final int GET_MESSAGENODE_PREV_ID = 5018; public static final int CHAT_GETFILTER_PRIVATE = 5005;
public static final int GET_MESSAGENODE_NEXT_ID = 5019; public static final int CHAT_SENDPUBLIC = 5008;
public static final int RUN_COMMAND = 5020; public static final int CHAT_SENDPRIVATE = 5009;
public static final int GET_ISRESIZED = 5306; public static final int CHAT_PLAYERNAME = 5015;
public static final int SET_ISRESIZED = 5307; public static final int CHAT_GETFILTER_TRADE = 5016;
public static final int GET_SCREENTYPE = 5308; public static final int CHAT_GETHISTORYLENGTH = 5017;
public static final int SET_SCREENTYPE = 5309; public static final int CHAT_GETNEXTUID = 5018;
public static final int GET_MAPANGLE = 5506; public static final int CHAT_GETPREVUID = 5019;
public static final int SET_CAMERA_FOCAL_POINT_HEIGHT = 5530; public static final int DOCHEAT = 5020;
public static final int GET_CAMERA_FOCAL_POINT_HEIGHT = 5531; public static final int CHAT_SETMESSAGEFILTER = 5021;
public static final int CANCEL_LOGIN = 5630; public static final int CHAT_GETMESSAGEFILTER = 5022;
public static final int SET_ZOOM_DISTANCE = 6201; public static final int GETWINDOWMODE = 5306;
public static final int GET_VIEWPORT_SIZE = 6203; public static final int SETWINDOWMODE = 5307;
public static final int GET_ZOOM_DISTANCE = 6204; public static final int GETDEFAULTWINDOWMODE = 5308;
public static final int LOAD_WORLDS = 6500; public static final int SETDEFAULTWINDOWMODE = 5309;
public static final int GET_FIRST_WORLD = 6501; public static final int CAM_FORCEANGLE = 5504;
public static final int GET_NEXT_WORLD = 6502; public static final int CAM_GETANGLE_XA = 5505;
public static final int GET_WORLD_BY_ID = 6506; public static final int CAM_GETANGLE_YA = 5506;
public static final int GET_WORLD_BY_INDEX = 6511; public static final int CAM_SETFOLLOWHEIGHT = 5530;
public static final int GET_IS_MOBILE = 6518; public static final int CAM_GETFOLLOWHEIGHT = 5531;
public static final int GET_MAP_SURFACE_NAME_BY_ID = 6601; public static final int LOGOUT = 5630;
public static final int SET_CURRENT_MAP_SURFACE = 6602; public static final int VIEWPORT_SETFOV = 6200;
public static final int GET_CURRENT_MAP_ZOOM = 6603; public static final int VIEWPORT_SETZOOM = 6201;
public static final int SET_CURRENT_MAP_ZOOM = 6604; public static final int VIEWPORT_CLAMPFOV = 6202;
public static final int SET_MAP_POSITION = 6606; public static final int VIEWPORT_GETEFFECTIVESIZE = 6203;
public static final int SET_MAP_POSITION_IMMEDIATE = 6607; public static final int VIEWPORT_GETZOOM = 6204;
public static final int SET_MAP_POSITION_2 = 6608; public static final int VIEWPORT_GETFOV = 6205;
public static final int SET_MAP_POSITION_IMMEDIATE_2 = 6609; public static final int WORLDLIST_FETCH = 6500;
public static final int GET_MAP_POSITION = 6610; public static final int WORLDLIST_START = 6501;
public static final int GET_MAP_DEFAULT_POSITION_BY_ID = 6611; public static final int WORLDLIST_NEXT = 6502;
public static final int GET_MAP_DIMENSIONS_BY_ID = 6612; public static final int WORLDLIST_SPECIFIC = 6506;
public static final int GET_MAP_BOUNDS_BY_ID = 6613; public static final int WORLDLIST_SORT = 6507;
public static final int GET_MAP_INITAL_ZOOM_BY_ID = 6614; public static final int SETFOLLOWEROPSLOWPRIORITY = 6512;
public static final int GET_CURRENT_MAP_ID = 6616; public static final int NC_PARAM = 6513;
public static final int MAP_ID_CONTAINS_COORD = 6621; public static final int LC_PARAM = 6514;
public static final int GET_MAP_DISPLAY_DIMENSIONS = 6622; public static final int OC_PARAM = 6515;
public static final int GET_MAP_ID_CONTAINING_COORD = 6623; public static final int STRUCT_PARAM = 6516;
public static final int SET_MAP_ICON_FLASH_COUNT = 6624; public static final int ON_MOBILE = 6518;
public static final int RESET_MAP_ICON_FLASH_COUNT = 6625; public static final int CLIENTTYPE = 6519;
public static final int SET_MAP_ICON_FLASH_PERIOD = 6626; public static final int BATTERYLEVEL = 6524;
public static final int RESET_MAP_ICON_FLASH_PERIOD = 6627; public static final int BATTERYCHARGING = 6525;
public static final int SET_MAP_ICON_FLASH_FOREVER = 6628; public static final int WIFIAVAILABLE = 6526;
public static final int FLASH_MAP_ICONS_BY_ID = 6629; public static final int WORLDMAP_GETMAPNAME = 6601;
public static final int FLASH_MAP_ICONS_BY_GROUP = 6630; public static final int WORLDMAP_SETMAP = 6602;
public static final int CLEAR_FLASHING_ICONS = 6631; public static final int WORLDMAP_GETZOOM = 6603;
public static final int SET_MAP_ICONS_DISABLED = 6632; public static final int WORLDMAP_SETZOOM = 6604;
public static final int SET_MAP_ICONS_ENABLED_BY_ID = 6633; public static final int WORLDMAP_ISLOADED = 6605;
public static final int SET_MAP_ICONS_ENABLED_BY_GROUP = 6634; public static final int WORLDMAP_JUMPTODISPLAYCOORD = 6606;
public static final int GET_MAP_ICONS_DISABLED = 6635; public static final int WORLDMAP_JUMPTODISPLAYCOORD_INSTANT = 6607;
public static final int GET_MAP_ICONS_ENABLED_BY_ID = 6636; public static final int WORLDMAP_JUMPTOSOURCECOORD = 6608;
public static final int GET_MAP_ICONS_ENABLED_BY_GROUP = 6637; public static final int WORLDMAP_JUMPTOSOURCECOORD_INSTANT = 6609;
public static final int GET_FIRST_MAP_ICON = 6639; public static final int WORLDMAP_GETDISPLAYPOSITION = 6610;
public static final int GET_NEXT_MAP_ICON = 6640; public static final int WORLDMAP_GETCONFIGORIGIN = 6611;
public static final int GET_MAPICON_NAME_BY_ID = 6693; public static final int WORLDMAP_GETCONFIGSIZE = 6612;
public static final int GET_MAPICON_FONT_SIZE = 6694; public static final int WORLDMAP_GETCONFIGBOUNDS = 6613;
public static final int GET_MAPICON_GROUP_BY_ID = 6695; public static final int WORLDMAP_GETCONFIGZOOM = 6614;
public static final int GET_MAPICON_SPRITE_BY_ID = 6696; public static final int WORLDMAP_GETCURRENTMAP = 6616;
public static final int GET_CURRENT_MAPICON_ID = 6697; public static final int WORLDMAP_GETDISPLAYCOORD = 6617;
public static final int GET_CURRENT_MAPICON_COORD = 6698; public static final int WORLDMAP_COORDINMAP = 6621;
public static final int GET_CURRENT_MAPICON_OTHER_COORD = 6699; public static final int WORLDMAP_GETSIZE = 6622;
public static final int WORLDMAP_PERPETUALFLASH = 6628;
public static final int WORLDMAP_FLASHELEMENT = 6629;
public static final int WORLDMAP_FLASHELEMENTCATEGORY = 6630;
public static final int WORLDMAP_STOPCURRENTFLASHES = 6631;
public static final int WORLDMAP_DISABLEELEMENTS = 6632;
public static final int WORLDMAP_DISABLEELEMENT = 6633;
public static final int WORLDMAP_DISABLEELEMENTCATEGORY = 6634;
public static final int WORLDMAP_GETDISABLEELEMENTS = 6635;
public static final int WORLDMAP_GETDISABLEELEMENT = 6636;
public static final int WORLDMAP_GETDISABLEELEMENTCATEGORY = 6637;
public static final int WORLDMAP_LISTELEMENT_START = 6639;
public static final int WORLDMAP_LISTELEMENT_NEXT = 6640;
public static final int MEC_TEXT = 6693;
public static final int MEC_TEXTSIZE = 6694;
public static final int MEC_CATEGORY = 6695;
public static final int MEC_SPRITE = 6696;
} }
@@ -204,7 +204,7 @@ public class Disassembler
switch (opcode) switch (opcode)
{ {
case Opcodes.LOAD_INT: case Opcodes.ICONST:
case Opcodes.ILOAD: case Opcodes.ILOAD:
case Opcodes.SLOAD: case Opcodes.SLOAD:
case Opcodes.ISTORE: case Opcodes.ISTORE:
@@ -3,28 +3,28 @@
.string_stack_count 0 .string_stack_count 0
.int_var_count 2 .int_var_count 2
.string_var_count 1 .string_var_count 1
get_varc 5 get_varc_int 5
load_int 14 iconst 14
if_icmpeq LABEL4 if_icmpeq LABEL4
jump LABEL7 jump LABEL7
LABEL4: LABEL4:
load_int 1 iconst 1
put_varc 66 set_varc_int 66
return return
LABEL7: LABEL7:
load_int -1 iconst -1
istore 0 istore 0
load_string "" sconst ""
sstore 0 sstore 0
get_varc_string 22 get_varc_string_old 22
string_length string_length
istore 1 istore 1
iload 1 iload 1
load_int 0 iconst 0
if_icmpgt LABEL18 if_icmpgt LABEL18
jump LABEL193 jump LABEL193
LABEL18: LABEL18:
get_varc 5 get_varc_int 5
switch switch
1: LABEL21 1: LABEL21
2: LABEL44 2: LABEL44
@@ -46,90 +46,90 @@ LABEL21:
return return
jump LABEL192 jump LABEL192
LABEL23: LABEL23:
get_ignorecount ignore_count
load_int 0 iconst 0
if_icmplt LABEL27 if_icmplt LABEL27
jump LABEL30 jump LABEL30
LABEL27: LABEL27:
load_string "Unable to update ignore list - system busy." sconst "Unable to update ignore list - system busy."
send_game_message mes
jump LABEL43 jump LABEL43
LABEL30: LABEL30:
get_varc 5 get_varc_int 5
load_int 4 iconst 4
if_icmpeq LABEL34 if_icmpeq LABEL34
jump LABEL37 jump LABEL37
LABEL34: LABEL34:
get_varc_string 22 get_varc_string_old 22
add_ignore ignore_add
jump LABEL43 jump LABEL43
LABEL37: LABEL37:
get_varc 5 get_varc_int 5
load_int 5 iconst 5
if_icmpeq LABEL41 if_icmpeq LABEL41
jump LABEL43 jump LABEL43
LABEL41: LABEL41:
get_varc_string 22 get_varc_string_old 22
remove_ignore ignore_del
LABEL43: LABEL43:
jump LABEL192 jump LABEL192
LABEL44: LABEL44:
get_friendcount friend_count
load_int 0 iconst 0
if_icmplt LABEL48 if_icmplt LABEL48
jump LABEL51 jump LABEL51
LABEL48: LABEL48:
load_string "Unable to complete action - system busy." sconst "Unable to complete action - system busy."
send_game_message mes
jump LABEL109 jump LABEL109
LABEL51: LABEL51:
get_varc 5 get_varc_int 5
load_int 2 iconst 2
if_icmpeq LABEL55 if_icmpeq LABEL55
jump LABEL58 jump LABEL58
LABEL55: LABEL55:
get_varc_string 22 get_varc_string_old 22
add_friend friend_add
jump LABEL109 jump LABEL109
LABEL58: LABEL58:
get_varc 5 get_varc_int 5
load_int 3 iconst 3
if_icmpeq LABEL62 if_icmpeq LABEL62
jump LABEL65 jump LABEL65
LABEL62: LABEL62:
get_varc_string 22 get_varc_string_old 22
remove_friend friend_del
jump LABEL109 jump LABEL109
LABEL65: LABEL65:
get_varc 5 get_varc_int 5
load_int 6 iconst 6
if_icmpeq LABEL69 if_icmpeq LABEL69
jump LABEL109 jump LABEL109
LABEL69: LABEL69:
get_varc 203 get_varc_int 203
load_int 0 iconst 0
if_icmpeq LABEL76 if_icmpeq LABEL76
get_varc 203 get_varc_int 203
load_int -1 iconst -1
if_icmpeq LABEL76 if_icmpeq LABEL76
jump LABEL82 jump LABEL82
LABEL76: LABEL76:
load_int 1 iconst 1
load_int 1 iconst 1
invoke 299 invoke 299
load_string "You must set a name before you can chat." sconst "You must set a name before you can chat."
send_game_message mes
return return
LABEL82: LABEL82:
5005 chat_getfilter_private
load_int 2 iconst 2
if_icmpeq LABEL86 if_icmpeq LABEL86
jump LABEL97 jump LABEL97
LABEL86: LABEL86:
5000 chat_getfilter_public
load_int 1 iconst 1
5016 chat_getfilter_trade
chatfilter_update chat_setfilter
invoke 178 invoke 178
invoke 553 invoke 553
istore 0 istore 0
@@ -139,123 +139,123 @@ LABEL86:
invoke 89 invoke 89
LABEL97: LABEL97:
get_varbit 4394 get_varbit 4394
load_int 1 iconst 1
if_icmpeq LABEL101 if_icmpeq LABEL101
jump LABEL104 jump LABEL104
LABEL101: LABEL101:
get_varc_string 23 get_varc_string_old 23
remove_friend friend_del
jump LABEL107 jump LABEL107
LABEL104: LABEL104:
get_varc_string 23 get_varc_string_old 23
get_varc_string 22 get_varc_string_old 22
privmsg chat_sendprivate
LABEL107: LABEL107:
get_gamecycle clientclock
put_varc 61 set_varc_int 61
LABEL109: LABEL109:
jump LABEL192 jump LABEL192
LABEL110: LABEL110:
get_varc_string 22 get_varc_string_old 22
invoke 212 invoke 212
numeric_input resume_countdialog
jump LABEL192 jump LABEL192
LABEL114: LABEL114:
get_varc_string 22 get_varc_string_old 22
string_remove_html removetags
put_varc_string 128 set_varc_string_old 128
get_varc_string 22 get_varc_string_old 22
string_input_1 resume_namedialog
jump LABEL192 jump LABEL192
LABEL120: LABEL120:
get_varc_string 22 get_varc_string_old 22
string_input_2 resume_stringdialog
jump LABEL192 jump LABEL192
LABEL123: LABEL123:
get_varc 203 get_varc_int 203
load_int 0 iconst 0
if_icmpeq LABEL130 if_icmpeq LABEL130
get_varc 203 get_varc_int 203
load_int -1 iconst -1
if_icmpeq LABEL130 if_icmpeq LABEL130
jump LABEL136 jump LABEL136
LABEL130: LABEL130:
load_int 1 iconst 1
load_int 1 iconst 1
invoke 299 invoke 299
load_string "You must set a name before you can chat." sconst "You must set a name before you can chat."
send_game_message mes
return return
LABEL136: LABEL136:
get_varc_string 22 get_varc_string_old 22
string_remove_html removetags
put_varc_string 129 set_varc_string_old 129
get_varc_string 22 get_varc_string_old 22
join_clanchat clan_joinchat
jump LABEL192 jump LABEL192
LABEL142: LABEL142:
iload 1 iload 1
load_int 10 iconst 10
if_icmpgt LABEL146 if_icmpgt LABEL146
jump LABEL152 jump LABEL152
LABEL146: LABEL146:
get_varc_string 22 get_varc_string_old 22
load_int 0 iconst 0
load_int 9 iconst 9
string_substring substring
sstore 0 sstore 0
jump LABEL154 jump LABEL154
LABEL152: LABEL152:
get_varc_string 22 get_varc_string_old 22
sstore 0 sstore 0
LABEL154: LABEL154:
sload 0 sload 0
tolowercase lowercase
5021 chat_setmessagefilter
invoke 553 invoke 553
invoke 84 invoke 84
jump LABEL192 jump LABEL192
LABEL160: LABEL160:
get_varc 203 get_varc_int 203
load_int 0 iconst 0
if_icmpeq LABEL167 if_icmpeq LABEL167
get_varc 203 get_varc_int 203
load_int -1 iconst -1
if_icmpeq LABEL167 if_icmpeq LABEL167
jump LABEL173 jump LABEL173
LABEL167: LABEL167:
load_int 1 iconst 1
load_int 1 iconst 1
invoke 299 invoke 299
load_string "You must set a name before you can chat." sconst "You must set a name before you can chat."
send_game_message mes
return return
LABEL173: LABEL173:
get_varc_string 22 get_varc_string_old 22
load_int 0 iconst 0
put_varc 62 set_varc_int 62
put_varc_string 28 set_varc_string_old 28
invoke 95 invoke 95
load_int 552 iconst 552
load_int -2147483645 iconst -2147483645
load_int 1 iconst 1
load_string "I1" sconst "I1"
load_int 10616843 iconst 10616843
widget_put_render_listener_widget if_setontimer
jump LABEL192 jump LABEL192
LABEL185: LABEL185:
load_int 0 iconst 0
load_int 1 iconst 1
invoke 299 invoke 299
return return
jump LABEL192 jump LABEL192
LABEL190: LABEL190:
get_varc_string 22 get_varc_string_old 22
invoke 2061 invoke 2061
LABEL192: LABEL192:
jump LABEL199 jump LABEL199
LABEL193: LABEL193:
get_varc 5 get_varc_int 5
switch switch
16: LABEL198 16: LABEL198
7: LABEL196 7: LABEL196
@@ -269,7 +269,7 @@ LABEL196:
LABEL198: LABEL198:
return return
LABEL199: LABEL199:
load_int 1 iconst 1
load_int 1 iconst 1
invoke 299 invoke 299
return return
@@ -12,111 +12,111 @@
jump LABEL84 jump LABEL84
LABEL3: LABEL3:
iload 1 iload 1
get_varc 175 get_varc_int 175
if_icmplt LABEL7 if_icmplt LABEL7
jump LABEL9 jump LABEL9
LABEL7: LABEL7:
load_int 0 iconst 0
return return
LABEL9: LABEL9:
sload 0 sload 0
string_remove_html removetags
is_ignore ignore_test
load_int 1 iconst 1
if_icmpeq LABEL15 if_icmpeq LABEL15
jump LABEL17 jump LABEL17
LABEL15: LABEL15:
load_int 0 iconst 0
return return
LABEL17: LABEL17:
load_int 1 iconst 1
return return
jump LABEL84 jump LABEL84
LABEL20: LABEL20:
iload 1 iload 1
get_varc 175 get_varc_int 175
if_icmplt LABEL24 if_icmplt LABEL24
jump LABEL26 jump LABEL26
LABEL24: LABEL24:
load_int 0 iconst 0
return return
LABEL26: LABEL26:
sload 0 sload 0
string_remove_html removetags
is_ignore ignore_test
load_int 1 iconst 1
if_icmpeq LABEL32 if_icmpeq LABEL32
jump LABEL34 jump LABEL34
LABEL32: LABEL32:
load_int 0 iconst 0
return return
LABEL34: LABEL34:
5005 chat_getfilter_private
load_int 0 iconst 0
if_icmpeq LABEL38 if_icmpeq LABEL38
jump LABEL40 jump LABEL40
LABEL38: LABEL38:
load_int 1 iconst 1
return return
LABEL40: LABEL40:
5005 chat_getfilter_private
load_int 1 iconst 1
if_icmpeq LABEL44 if_icmpeq LABEL44
jump LABEL51 jump LABEL51
LABEL44: LABEL44:
sload 0 sload 0
is_friend friend_test
load_int 1 iconst 1
if_icmpeq LABEL49 if_icmpeq LABEL49
jump LABEL51 jump LABEL51
LABEL49: LABEL49:
load_int 1 iconst 1
return return
LABEL51: LABEL51:
load_int 0 iconst 0
return return
jump LABEL84 jump LABEL84
LABEL54: LABEL54:
iload 1 iload 1
get_varc 175 get_varc_int 175
if_icmplt LABEL58 if_icmplt LABEL58
jump LABEL60 jump LABEL60
LABEL58: LABEL58:
load_int 0 iconst 0
return return
LABEL60: LABEL60:
iload 0 iload 0
load_int 5 iconst 5
if_icmpeq LABEL64 if_icmpeq LABEL64
jump LABEL76 jump LABEL76
LABEL64: LABEL64:
get_varbit 1627 get_varbit 1627
load_int 0 iconst 0
if_icmpeq LABEL68 if_icmpeq LABEL68
jump LABEL76 jump LABEL76
LABEL68: LABEL68:
get_gamecycle clientclock
iload 1 iload 1
isub sub
load_int 500 iconst 500
if_icmpge LABEL74 if_icmpge LABEL74
jump LABEL76 jump LABEL76
LABEL74: LABEL74:
load_int 0 iconst 0
return return
LABEL76: LABEL76:
5005 chat_getfilter_private
load_int 2 iconst 2
if_icmpne LABEL80 if_icmpne LABEL80
jump LABEL82 jump LABEL82
LABEL80: LABEL80:
load_int 1 iconst 1
return return
LABEL82: LABEL82:
load_int 0 iconst 0
return return
LABEL84: LABEL84:
load_int 0 iconst 0
return return
load_int -1 iconst -1
return return
@@ -3,5 +3,5 @@
.string_stack_count 0 .string_stack_count 0
.int_var_count 0 .int_var_count 0
.string_var_count 0 .string_var_count 0
load_string ": " sconst ": "
return return
+3 -2
View File
@@ -23,8 +23,9 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--> -->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" <!DOCTYPE module PUBLIC
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker"> <module name="Checker">
<module name="TreeWalker"> <module name="TreeWalker">
<module name="LeftCurly"> <module name="LeftCurly">
+1 -1
View File
@@ -28,7 +28,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<name>Web API</name> <name>Web API</name>
@@ -55,7 +55,7 @@ public class FeedClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error looking up feed: {}", response.message()); logger.debug("Error looking up feed: {}", response);
return null; return null;
} }
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.api.ge;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
@Slf4j
@AllArgsConstructor
public class GrandExchangeClient
{
private static final MediaType JSON = MediaType.parse("application/json");
private static final Gson GSON = RuneLiteAPI.GSON;
private final UUID uuid;
public void submit(GrandExchangeTrade grandExchangeTrade)
{
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("ge")
.build();
Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
.post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade)))
.url(url)
.build();
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
{
@Override
public void onFailure(Call call, IOException e)
{
log.debug("unable to submit trade", e);
}
@Override
public void onResponse(Call call, Response response)
{
log.debug("Submitted trade");
response.close();
}
});
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Levi <me@levischuck.com> * Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -22,34 +22,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.plugins.xptracker; package net.runelite.http.api.ge;
import java.time.Instant;
import lombok.Data; import lombok.Data;
@Data @Data
class XpStateTotal public class GrandExchangeTrade
{ {
private int xpGainedInSession = 0; private boolean buy;
private int xpPerHour = 0; private int itemId;
private int quantity;
void reset() private int price;
{ private Instant time;
xpGainedInSession = 0;
xpPerHour = 0;
}
void addXpGainedInSession(int skillXpGainedInSession)
{
xpGainedInSession += skillXpGainedInSession;
}
void addXpPerHour(int skillXpGainedPerHour)
{
xpPerHour += skillXpGainedPerHour;
}
XpSnapshotTotal snapshot()
{
return new XpSnapshotTotal(xpGainedInSession, xpPerHour);
}
} }
@@ -106,7 +106,7 @@ public class HiscoreClient
case 404: case 404:
return null; return null;
default: default:
throw new IOException("Error retrieving data from Jagex Hiscores: " + okresponse.message()); throw new IOException("Error retrieving data from Jagex Hiscores: " + okresponse);
} }
} }
@@ -63,7 +63,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error looking up item {}: {}", itemId, response.message()); logger.debug("Error looking up item {}: {}", itemId, response);
return null; return null;
} }
@@ -99,7 +99,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error looking up items {}: {}", Arrays.toString(itemIds), response.message()); logger.debug("Error looking up items {}: {}", Arrays.toString(itemIds), response);
return null; return null;
} }
@@ -130,7 +130,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error grabbing icon {}: {}", itemId, response.message()); logger.debug("Error grabbing icon {}: {}", itemId, response);
return null; return null;
} }
@@ -160,7 +160,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error looking up item {}: {}", itemName, response.message()); logger.debug("Error looking up item {}: {}", itemName, response);
return null; return null;
} }
@@ -191,7 +191,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.warn("Error looking up prices: {}", response.message()); logger.warn("Error looking up prices: {}", response);
return null; return null;
} }
@@ -204,11 +204,12 @@ public class ItemClient
} }
} }
public Map<String, ItemStats> getStats() throws IOException public Map<Integer, ItemStats> getStats() throws IOException
{ {
HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder() HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder()
.addPathSegment("item") .addPathSegment("item")
.addPathSegment("stats.min.json"); // TODO: Change this to stats.min.json later after release is undeployed
.addPathSegment("stats.ids.min.json");
HttpUrl url = urlBuilder.build(); HttpUrl url = urlBuilder.build();
@@ -222,12 +223,12 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.warn("Error looking up item stats: {}", response.message()); logger.warn("Error looking up item stats: {}", response);
return null; return null;
} }
InputStream in = response.body().byteStream(); InputStream in = response.body().byteStream();
final Type typeToken = new TypeToken<Map<String, ItemStats>>() final Type typeToken = new TypeToken<Map<Integer, ItemStats>>()
{ {
}.getType(); }.getType();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), typeToken); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), typeToken);
@@ -24,6 +24,7 @@
*/ */
package net.runelite.http.api.loottracker; package net.runelite.http.api.loottracker;
import java.time.Instant;
import java.util.Collection; import java.util.Collection;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@@ -37,4 +38,5 @@ public class LootRecord
private String eventId; private String eventId;
private LootRecordType type; private LootRecordType type;
private Collection<GameItem> drops; private Collection<GameItem> drops;
private Instant time;
} }
@@ -90,7 +90,6 @@ public class LootTrackerClient
Request request = new Request.Builder() Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
.get()
.url(url) .url(url)
.build(); .build();
@@ -98,7 +97,7 @@ public class LootTrackerClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
log.debug("Error looking up loot: {}", response.message()); log.debug("Error looking up loot: {}", response);
return null; return null;
} }
@@ -35,9 +35,9 @@ import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
@Slf4j @Slf4j
public class GrandExchangeClient public class OSBGrandExchangeClient
{ {
public GrandExchangeResult lookupItem(int itemId) throws IOException public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
{ {
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("osb") .addPathSegment("osb")
@@ -55,11 +55,11 @@ public class GrandExchangeClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Error looking up item id: " + response.message()); throw new IOException("Error looking up item id: " + response);
} }
final InputStream in = response.body().byteStream(); final InputStream in = response.body().byteStream();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), GrandExchangeResult.class); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), OSBGrandExchangeResult.class);
} }
catch (JsonParseException ex) catch (JsonParseException ex)
{ {
@@ -28,7 +28,7 @@ import java.time.Instant;
import lombok.Data; import lombok.Data;
@Data @Data
public class GrandExchangeResult public class OSBGrandExchangeResult
{ {
private int item_id; private int item_id;
private int buy_average; private int buy_average;
@@ -57,7 +57,7 @@ public class WorldClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
logger.debug("Error looking up worlds: {}", response.message()); logger.debug("Error looking up worlds: {}", response);
return null; return null;
} }
@@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true)
public class Join extends WebsocketMessage public class Join extends WebsocketMessage
{ {
private final UUID partyId; private final UUID partyId;
@@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true)
public class UserJoin extends WebsocketMessage public class UserJoin extends WebsocketMessage
{ {
private final UUID memberId; private final UUID memberId;
@@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true)
public class UserPart extends WebsocketMessage public class UserPart extends WebsocketMessage
{ {
private final UUID memberId; private final UUID memberId;
@@ -24,9 +24,11 @@
*/ */
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
@Value @Value
@EqualsAndHashCode(callSuper = true)
public class UserSync extends PartyMemberMessage public class UserSync extends PartyMemberMessage
{ {
} }
+71 -7
View File
@@ -28,7 +28,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<name>Web Service</name> <name>Web Service</name>
@@ -55,6 +55,10 @@
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.mapstruct</groupId> <groupId>org.mapstruct</groupId>
@@ -78,6 +82,12 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.2.3</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.sql2o</groupId> <groupId>org.sql2o</groupId>
<artifactId>sql2o</artifactId> <artifactId>sql2o</artifactId>
@@ -112,24 +122,28 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>3.10.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.43</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId> <artifactId>mockwebserver</artifactId>
<version>3.7.0</version> <version>3.7.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@@ -171,6 +185,56 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version> <version>${spring.boot.version}</version>
</plugin> </plugin>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<dependencies>
<!-- Java 11+ does not include this anymore -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>
<location>net.runelite</location>
</locations>
<schemes>
<scheme>https</scheme>
</schemes>
<host>api.runelite.net</host>
<basePath>/runelite-${project.version}</basePath>
<info>
<title>${project.parent.name} HTTP API</title>
<version>${project.version}</version>
<description>${project.description}</description>
<license>
<url>https://tldrlegal.com/license/bsd-2-clause-license-(freebsd)</url>
<name>BSD 2-Clause "Simplified"</name>
</license>
</info>
<templatePath>${basedir}/src/main/templates/template.html.hbs</templatePath>
<swaggerDirectory>${project.build.directory}/swagger-ui</swaggerDirectory>
<outputPath>${project.build.directory}/site/api.html</outputPath>
<attachSwaggerArtifact>true</attachSwaggerArtifact>
<outputFormats>json</outputFormats>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
@@ -25,13 +25,13 @@
package net.runelite.http.service; package net.runelite.http.service;
import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.LoggerContext;
import com.google.common.base.Strings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
@@ -44,17 +44,23 @@ import okhttp3.Cache;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import org.slf4j.ILoggerFactory; import org.slf4j.ILoggerFactory;
import org.slf4j.impl.StaticLoggerBinder; import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.sql2o.Sql2o; import org.sql2o.Sql2o;
import org.sql2o.converters.Converter; import org.sql2o.converters.Converter;
import org.sql2o.quirks.NoQuirks; import org.sql2o.quirks.NoQuirks;
@SpringBootApplication @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableScheduling @EnableScheduling
@Slf4j @Slf4j
public class SpringBootWebApplication extends SpringBootServletInitializer public class SpringBootWebApplication extends SpringBootServletInitializer
@@ -96,35 +102,86 @@ public class SpringBootWebApplication extends SpringBootServletInitializer
}; };
} }
private Context getContext() throws NamingException @ConfigurationProperties(prefix = "datasource.runelite")
@Bean("dataSourceRuneLite")
public DataSourceProperties dataSourceProperties()
{ {
Context initCtx = new InitialContext(); return new DataSourceProperties();
return (Context) initCtx.lookup("java:comp/env"); }
@ConfigurationProperties(prefix = "datasource.runelite-cache")
@Bean("dataSourceRuneLiteCache")
public DataSourceProperties dataSourcePropertiesCache()
{
return new DataSourceProperties();
}
@ConfigurationProperties(prefix = "datasource.runelite-tracker")
@Bean("dataSourceRuneLiteTracker")
public DataSourceProperties dataSourcePropertiesTracker()
{
return new DataSourceProperties();
}
@Bean(value = "runelite", destroyMethod = "")
public DataSource runeliteDataSource(@Qualifier("dataSourceRuneLite") DataSourceProperties dataSourceProperties)
{
return getDataSource(dataSourceProperties);
}
@Bean(value = "runelite-cache", destroyMethod = "")
public DataSource runeliteCache2DataSource(@Qualifier("dataSourceRuneLiteCache") DataSourceProperties dataSourceProperties)
{
return getDataSource(dataSourceProperties);
}
@Bean(value = "runelite-tracker", destroyMethod = "")
public DataSource runeliteTrackerDataSource(@Qualifier("dataSourceRuneLiteTracker") DataSourceProperties dataSourceProperties)
{
return getDataSource(dataSourceProperties);
} }
@Bean("Runelite SQL2O") @Bean("Runelite SQL2O")
Sql2o sql2o() throws NamingException public Sql2o sql2o(@Qualifier("runelite") DataSource dataSource)
{ {
DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite"); return createSql2oFromDataSource(dataSource);
Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter());
return new Sql2o(dataSource, new NoQuirks(converters));
} }
@Bean("Runelite Cache SQL2O") @Bean("Runelite Cache SQL2O")
Sql2o cacheSql2o() throws NamingException public Sql2o cacheSql2o(@Qualifier("runelite-cache") DataSource dataSource)
{ {
DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite-cache2"); return createSql2oFromDataSource(dataSource);
Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter());
return new Sql2o(dataSource, new NoQuirks(converters));
} }
@Bean("Runelite XP Tracker SQL2O") @Bean("Runelite XP Tracker SQL2O")
Sql2o trackerSql2o() throws NamingException public Sql2o trackerSql2o(@Qualifier("runelite-tracker") DataSource dataSource)
{ {
DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite-tracker"); return createSql2oFromDataSource(dataSource);
Map<Class, Converter> converters = new HashMap<>(); }
@Bean
public MongoClient mongoClient(@Value("${mongo.host}") String host)
{
return MongoClients.create(host);
}
private static DataSource getDataSource(DataSourceProperties dataSourceProperties)
{
if (!Strings.isNullOrEmpty(dataSourceProperties.getJndiName()))
{
// Use JNDI provided datasource, which is already configured with pooling
JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
return dataSourceLookup.getDataSource(dataSourceProperties.getJndiName());
}
else
{
return dataSourceProperties.initializeDataSourceBuilder().build();
}
}
private static Sql2o createSql2oFromDataSource(final DataSource dataSource)
{
final Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter()); converters.put(Instant.class, new InstantConverter());
return new Sql2o(dataSource, new NoQuirks(converters)); return new Sql2o(dataSource, new NoQuirks(converters));
} }
@@ -24,22 +24,42 @@
*/ */
package net.runelite.http.service; package net.runelite.http.service;
import java.util.List;
import net.runelite.http.api.RuneLiteAPI;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc
public class SpringWebMvcConfigurer extends WebMvcConfigurerAdapter
{
/** /**
* Configure .js as application/json to trick Cloudflare into caching json responses * Configure .js as application/json to trick Cloudflare into caching json responses
*/ */
@Configuration
@EnableWebMvc
public class SpringContentNegotiationConfigurer extends WebMvcConfigurerAdapter
{
@Override @Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) public void configureContentNegotiation(ContentNegotiationConfigurer configurer)
{ {
configurer.mediaType("js", MediaType.APPLICATION_JSON); configurer.mediaType("js", MediaType.APPLICATION_JSON);
} }
/**
* Use GSON instead of Jackson for JSON serialization
* @param converters
*/
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters)
{
// Could not figure out a better way to force GSON
converters.removeIf(MappingJackson2HttpMessageConverter.class::isInstance);
GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
gsonHttpMessageConverter.setGson(RuneLiteAPI.GSON);
converters.add(gsonHttpMessageConverter);
}
} }
@@ -33,6 +33,8 @@ import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service; import com.github.scribejava.core.oauth.OAuth20Service;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -45,13 +47,12 @@ import net.runelite.http.api.ws.messages.LoginResponse;
import net.runelite.http.service.account.beans.SessionEntry; import net.runelite.http.service.account.beans.SessionEntry;
import net.runelite.http.service.account.beans.UserEntry; import net.runelite.http.service.account.beans.UserEntry;
import net.runelite.http.service.util.redis.RedisPool; import net.runelite.http.service.util.redis.RedisPool;
import net.runelite.http.service.ws.SessionManager;
import net.runelite.http.service.ws.WSService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -88,8 +89,7 @@ public class AccountService
private static final String SCOPE = "https://www.googleapis.com/auth/userinfo.email"; private static final String SCOPE = "https://www.googleapis.com/auth/userinfo.email";
private static final String USERINFO = "https://www.googleapis.com/oauth2/v2/userinfo"; private static final String USERINFO = "https://www.googleapis.com/oauth2/v2/userinfo";
private static final String RL_OAUTH_URL = "https://api.runelite.net/oauth/"; private static final String RL_REDIR = "https://runelite.net/logged-in";
private static final String RL_REDIR = "http://runelite.net/logged-in";
private final Gson gson = RuneLiteAPI.GSON; private final Gson gson = RuneLiteAPI.GSON;
private final Gson websocketGson = WebsocketGsonFactory.build(); private final Gson websocketGson = WebsocketGsonFactory.build();
@@ -97,6 +97,7 @@ public class AccountService
private final Sql2o sql2o; private final Sql2o sql2o;
private final String oauthClientId; private final String oauthClientId;
private final String oauthClientSecret; private final String oauthClientSecret;
private final String oauthCallback;
private final AuthFilter auth; private final AuthFilter auth;
private final RedisPool jedisPool; private final RedisPool jedisPool;
@@ -105,6 +106,7 @@ public class AccountService
@Qualifier("Runelite SQL2O") Sql2o sql2o, @Qualifier("Runelite SQL2O") Sql2o sql2o,
@Value("${oauth.client-id}") String oauthClientId, @Value("${oauth.client-id}") String oauthClientId,
@Value("${oauth.client-secret}") String oauthClientSecret, @Value("${oauth.client-secret}") String oauthClientSecret,
@Value("${oauth.callback}") String oauthCallback,
AuthFilter auth, AuthFilter auth,
RedisPool jedisPool RedisPool jedisPool
) )
@@ -112,6 +114,7 @@ public class AccountService
this.sql2o = sql2o; this.sql2o = sql2o;
this.oauthClientId = oauthClientId; this.oauthClientId = oauthClientId;
this.oauthClientSecret = oauthClientSecret; this.oauthClientSecret = oauthClientSecret;
this.oauthCallback = oauthCallback;
this.auth = auth; this.auth = auth;
this.jedisPool = jedisPool; this.jedisPool = jedisPool;
@@ -135,7 +138,7 @@ public class AccountService
} }
} }
@RequestMapping("/login") @GetMapping("/login")
public OAuthResponse login(@RequestParam UUID uuid) public OAuthResponse login(@RequestParam UUID uuid)
{ {
State state = new State(); State state = new State();
@@ -146,11 +149,14 @@ public class AccountService
.apiKey(oauthClientId) .apiKey(oauthClientId)
.apiSecret(oauthClientSecret) .apiSecret(oauthClientSecret)
.scope(SCOPE) .scope(SCOPE)
.callback(RL_OAUTH_URL) .callback(oauthCallback)
.state(gson.toJson(state)) .state(gson.toJson(state))
.build(GoogleApi20.instance()); .build(GoogleApi20.instance());
String authorizationUrl = service.getAuthorizationUrl(); final Map<String, String> additionalParams = new HashMap<>();
additionalParams.put("prompt", "select_account");
String authorizationUrl = service.getAuthorizationUrl(additionalParams);
OAuthResponse lr = new OAuthResponse(); OAuthResponse lr = new OAuthResponse();
lr.setOauthUrl(authorizationUrl); lr.setOauthUrl(authorizationUrl);
@@ -159,7 +165,7 @@ public class AccountService
return lr; return lr;
} }
@RequestMapping("/callback") @GetMapping("/callback")
public Object callback( public Object callback(
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
@@ -182,7 +188,7 @@ public class AccountService
.apiKey(oauthClientId) .apiKey(oauthClientId)
.apiSecret(oauthClientSecret) .apiSecret(oauthClientSecret)
.scope(SCOPE) .scope(SCOPE)
.callback(RL_OAUTH_URL) .callback(oauthCallback)
.state(gson.toJson(state)) .state(gson.toJson(state))
.build(GoogleApi20.instance()); .build(GoogleApi20.instance());
@@ -241,19 +247,13 @@ public class AccountService
LoginResponse response = new LoginResponse(); LoginResponse response = new LoginResponse();
response.setUsername(username); response.setUsername(username);
WSService service = SessionManager.findSession(uuid);
if (service != null)
{
service.send(response);
}
try (Jedis jedis = jedisPool.getResource()) try (Jedis jedis = jedisPool.getResource())
{ {
jedis.publish("session." + uuid, websocketGson.toJson(response, WebsocketMessage.class)); jedis.publish("session." + uuid, websocketGson.toJson(response, WebsocketMessage.class));
} }
} }
@RequestMapping("/logout") @GetMapping("/logout")
public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException
{ {
SessionEntry session = auth.handle(request, response); SessionEntry session = auth.handle(request, response);
@@ -271,15 +271,9 @@ public class AccountService
} }
} }
@RequestMapping("/session-check") @GetMapping("/session-check")
public void sessionCheck(HttpServletRequest request, HttpServletResponse response) throws IOException public void sessionCheck(HttpServletRequest request, HttpServletResponse response) throws IOException
{ {
auth.handle(request, response); auth.handle(request, response);
} }
@RequestMapping("/wscount")
public int wscount()
{
return SessionManager.getCount();
}
} }
@@ -62,6 +62,7 @@ import net.runelite.http.service.cache.beans.IndexEntry;
import net.runelite.http.service.util.exception.NotFoundException; import net.runelite.http.service.util.exception.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@@ -75,7 +76,7 @@ public class CacheController
@Autowired @Autowired
private CacheService cacheService; private CacheService cacheService;
@RequestMapping("/") @GetMapping("/")
public List<Cache> listCaches() public List<Cache> listCaches()
{ {
return cacheService.listCaches().stream() return cacheService.listCaches().stream()
@@ -83,7 +84,7 @@ public class CacheController
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@RequestMapping("{cacheId}") @GetMapping("{cacheId}")
public List<CacheIndex> listIndexes(@PathVariable int cacheId) public List<CacheIndex> listIndexes(@PathVariable int cacheId)
{ {
CacheEntry cache = cacheService.findCache(cacheId); CacheEntry cache = cacheService.findCache(cacheId);
@@ -99,7 +100,7 @@ public class CacheController
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@RequestMapping("{cacheId}/{indexId}") @GetMapping("{cacheId}/{indexId}")
public List<CacheArchive> listArchives(@PathVariable int cacheId, public List<CacheArchive> listArchives(@PathVariable int cacheId,
@PathVariable int indexId) @PathVariable int indexId)
{ {
@@ -122,7 +123,7 @@ public class CacheController
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@RequestMapping("{cacheId}/{indexId}/{archiveId}") @GetMapping("{cacheId}/{indexId}/{archiveId}")
public CacheArchive getCacheArchive(@PathVariable int cacheId, public CacheArchive getCacheArchive(@PathVariable int cacheId,
@PathVariable int indexId, @PathVariable int indexId,
@PathVariable int archiveId) @PathVariable int archiveId)
@@ -149,7 +150,7 @@ public class CacheController
archiveEntry.getNameHash(), archiveEntry.getRevision()); archiveEntry.getNameHash(), archiveEntry.getRevision());
} }
@RequestMapping("{cacheId}/{indexId}/{archiveId}/data") @GetMapping("{cacheId}/{indexId}/{archiveId}/data")
public byte[] getArchiveData( public byte[] getArchiveData(
@PathVariable int cacheId, @PathVariable int cacheId,
@PathVariable int indexId, @PathVariable int indexId,
@@ -200,7 +201,7 @@ public class CacheController
return archiveEntry; return archiveEntry;
} }
@RequestMapping("item/{itemId}") @GetMapping("item/{itemId}")
public ItemDefinition getItem(@PathVariable int itemId) throws IOException public ItemDefinition getItem(@PathVariable int itemId) throws IOException
{ {
ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM); ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM);
@@ -221,7 +222,7 @@ public class CacheController
return itemdef; return itemdef;
} }
@RequestMapping(path = "item/{itemId}/image", produces = "image/png") @GetMapping(path = "item/{itemId}/image", produces = "image/png")
public ResponseEntity<byte[]> getItemImage( public ResponseEntity<byte[]> getItemImage(
@PathVariable int itemId, @PathVariable int itemId,
@RequestParam(defaultValue = "1") int quantity, @RequestParam(defaultValue = "1") int quantity,
@@ -313,7 +314,7 @@ public class CacheController
return ResponseEntity.ok(bao.toByteArray()); return ResponseEntity.ok(bao.toByteArray());
} }
@RequestMapping("object/{objectId}") @GetMapping("object/{objectId}")
public ObjectDefinition getObject( public ObjectDefinition getObject(
@PathVariable int objectId @PathVariable int objectId
) throws IOException ) throws IOException
@@ -336,7 +337,7 @@ public class CacheController
return objectdef; return objectdef;
} }
@RequestMapping("npc/{npcId}") @GetMapping("npc/{npcId}")
public NpcDefinition getNpc( public NpcDefinition getNpc(
@PathVariable int npcId @PathVariable int npcId
) throws IOException ) throws IOException
@@ -41,6 +41,7 @@ import java.io.InputStream;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.cache.ConfigType; import net.runelite.cache.ConfigType;
@@ -233,6 +234,11 @@ public class CacheService
public List<ItemDefinition> getItems() throws IOException public List<ItemDefinition> getItems() throws IOException
{ {
CacheEntry cache = findMostRecent(); CacheEntry cache = findMostRecent();
if (cache == null)
{
return Collections.emptyList();
}
IndexEntry indexEntry = findIndexForCache(cache, IndexType.CONFIGS.getNumber()); IndexEntry indexEntry = findIndexForCache(cache, IndexType.CONFIGS.getNumber());
ArchiveEntry archiveEntry = findArchiveForIndex(indexEntry, ConfigType.ITEM.getId()); ArchiveEntry archiveEntry = findArchiveForIndex(indexEntry, ConfigType.ITEM.getId());
ArchiveFiles archiveFiles = getArchiveFiles(archiveEntry); ArchiveFiles archiveFiles = getArchiveFiles(archiveEntry);
@@ -0,0 +1,103 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.config;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.runelite.http.api.config.Configuration;
import net.runelite.http.service.account.AuthFilter;
import net.runelite.http.service.account.beans.SessionEntry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.PUT;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/config")
public class ConfigController
{
private final ConfigService configService;
private final AuthFilter authFilter;
@Autowired
public ConfigController(ConfigService configService, AuthFilter authFilter)
{
this.configService = configService;
this.authFilter = authFilter;
}
@GetMapping
public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return null;
}
return configService.get(session.getUser());
}
@RequestMapping(path = "/{key:.+}", method = PUT)
public void setKey(
HttpServletRequest request,
HttpServletResponse response,
@PathVariable String key,
@RequestBody(required = false) String value
) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return;
}
configService.setKey(session.getUser(), key, value);
}
@RequestMapping(path = "/{key:.+}", method = DELETE)
public void unsetKey(
HttpServletRequest request,
HttpServletResponse response,
@PathVariable String key
) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return;
}
configService.unsetKey(session.getUser(), key);
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Adam <Adam@sigterm.info> * Copyright (c) 2017-2019, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -24,28 +24,36 @@
*/ */
package net.runelite.http.service.config; package net.runelite.http.service.config;
import java.io.IOException; import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import static com.mongodb.client.model.Filters.eq;
import com.mongodb.client.model.IndexOptions;
import com.mongodb.client.model.Indexes;
import static com.mongodb.client.model.Updates.set;
import static com.mongodb.client.model.Updates.unset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.ConfigEntry;
import net.runelite.http.api.config.Configuration; import net.runelite.http.api.config.Configuration;
import net.runelite.http.service.account.AuthFilter; import org.bson.Document;
import net.runelite.http.service.account.beans.SessionEntry;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.PUT;
import org.springframework.web.bind.annotation.RestController;
import org.sql2o.Connection; import org.sql2o.Connection;
import org.sql2o.Sql2o; import org.sql2o.Sql2o;
import org.sql2o.Sql2oException; import org.sql2o.Sql2oException;
@RestController @Service
@RequestMapping("/config") @Slf4j
public class ConfigService public class ConfigService
{ {
private static final String CREATE_CONFIG = "CREATE TABLE IF NOT EXISTS `config` (\n" private static final String CREATE_CONFIG = "CREATE TABLE IF NOT EXISTS `config` (\n"
@@ -59,16 +67,17 @@ public class ConfigService
+ " ADD CONSTRAINT `user_fk` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;"; + " ADD CONSTRAINT `user_fk` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;";
private final Sql2o sql2o; private final Sql2o sql2o;
private final AuthFilter auth; private final Gson GSON = RuneLiteAPI.GSON;
private final MongoCollection<Document> mongoCollection;
@Autowired @Autowired
public ConfigService( public ConfigService(
@Qualifier("Runelite SQL2O") Sql2o sql2o, @Qualifier("Runelite SQL2O") Sql2o sql2o,
AuthFilter auth MongoClient mongoClient
) )
{ {
this.sql2o = sql2o; this.sql2o = sql2o;
this.auth = auth;
try (Connection con = sql2o.open()) try (Connection con = sql2o.open())
{ {
@@ -85,75 +94,160 @@ public class ConfigService
// Ignore, happens when index already exists // Ignore, happens when index already exists
} }
} }
MongoDatabase database = mongoClient.getDatabase("config");
MongoCollection<Document> collection = database.getCollection("config");
this.mongoCollection = collection;
// Create unique index on _userId
IndexOptions indexOptions = new IndexOptions().unique(true);
collection.createIndex(Indexes.ascending("_userId"), indexOptions);
} }
@RequestMapping private Document getConfig(int userId)
public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException
{ {
SessionEntry session = auth.handle(request, response); return mongoCollection.find(eq("_userId", userId)).first();
if (session == null)
{
return null;
} }
List<ConfigEntry> config; public Configuration get(int userId)
try (Connection con = sql2o.open())
{ {
config = con.createQuery("select `key`, value from config where user = :user") Map<String, Object> configMap = getConfig(userId);
.addParameter("user", session.getUser())
.executeAndFetch(ConfigEntry.class); if (configMap == null || configMap.isEmpty())
{
return new Configuration(Collections.emptyList());
}
List<ConfigEntry> config = new ArrayList<>();
for (String group : configMap.keySet())
{
// Reserved keys
if (group.startsWith("_") || group.startsWith("$"))
{
continue;
}
Map<String, Object> groupMap = (Map) configMap.get(group);
for (Map.Entry<String, Object> entry : groupMap.entrySet())
{
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Map || value instanceof Collection)
{
value = GSON.toJson(entry.getValue());
}
else if (value == null)
{
continue;
}
ConfigEntry configEntry = new ConfigEntry();
configEntry.setKey(group + "." + key.replace(':', '.'));
configEntry.setValue(value.toString());
config.add(configEntry);
}
} }
return new Configuration(config); return new Configuration(config);
} }
@RequestMapping(path = "/{key:.+}", method = PUT)
public void setKey( public void setKey(
HttpServletRequest request, int userId,
HttpServletResponse response, String key,
@PathVariable String key, @Nullable String value
@RequestBody(required = false) String value )
) throws IOException
{ {
SessionEntry session = auth.handle(request, response);
if (session == null)
{
return;
}
try (Connection con = sql2o.open()) try (Connection con = sql2o.open())
{ {
con.createQuery("insert into config (user, `key`, value) values (:user, :key, :value) on duplicate key update `key` = :key, value = :value") con.createQuery("insert into config (user, `key`, value) values (:user, :key, :value) on duplicate key update `key` = :key, value = :value")
.addParameter("user", session.getUser()) .addParameter("user", userId)
.addParameter("key", key) .addParameter("key", key)
.addParameter("value", value != null ? value : "") .addParameter("value", value != null ? value : "")
.executeUpdate(); .executeUpdate();
} }
}
@RequestMapping(path = "/{key:.+}", method = DELETE) if (key.startsWith("$") || key.startsWith("_"))
public void unsetKey(
HttpServletRequest request,
HttpServletResponse response,
@PathVariable String key
) throws IOException
{
SessionEntry session = auth.handle(request, response);
if (session == null)
{ {
return; return;
} }
String[] split = key.split("\\.", 2);
if (split.length != 2)
{
return;
}
Object jsonValue = parseJsonString(value);
mongoCollection.updateOne(eq("_userId", userId),
set(split[0] + "." + split[1].replace('.', ':'), jsonValue));
}
public void unsetKey(
int userId,
String key
)
{
try (Connection con = sql2o.open()) try (Connection con = sql2o.open())
{ {
con.createQuery("delete from config where user = :user and `key` = :key") con.createQuery("delete from config where user = :user and `key` = :key")
.addParameter("user", session.getUser()) .addParameter("user", userId)
.addParameter("key", key) .addParameter("key", key)
.executeUpdate(); .executeUpdate();
} }
if (key.startsWith("$") || key.startsWith("_"))
{
return;
}
String[] split = key.split("\\.", 2);
if (split.length != 2)
{
return;
}
mongoCollection.updateOne(eq("_userId", userId),
unset(split[0] + "." + split[1].replace('.', ':')));
}
private static Object parseJsonString(String value)
{
Object jsonValue;
try
{
jsonValue = RuneLiteAPI.GSON.fromJson(value, Object.class);
if (jsonValue instanceof Double || jsonValue instanceof Float)
{
Number number = (Number) jsonValue;
if (Math.floor(number.doubleValue()) == number.doubleValue() && !Double.isInfinite(number.doubleValue()))
{
// value is an int or long. 'number' might be truncated so parse it from 'value'
try
{
jsonValue = Integer.parseInt(value);
}
catch (NumberFormatException ex)
{
try
{
jsonValue = Long.parseLong(value);
}
catch (NumberFormatException ex2)
{
}
}
}
}
}
catch (JsonSyntaxException ex)
{
jsonValue = value;
}
return jsonValue;
} }
} }
@@ -30,6 +30,7 @@ import static net.runelite.http.service.examine.ExamineType.OBJECT;
import net.runelite.http.service.item.ItemEntry; import net.runelite.http.service.item.ItemEntry;
import net.runelite.http.service.item.ItemService; import net.runelite.http.service.item.ItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -50,19 +51,19 @@ public class ExamineController
this.itemService = itemService; this.itemService = itemService;
} }
@RequestMapping("/npc/{id}") @GetMapping("/npc/{id}")
public String getNpc(@PathVariable int id) public String getNpc(@PathVariable int id)
{ {
return examineService.get(NPC, id); return examineService.get(NPC, id);
} }
@RequestMapping("/object/{id}") @GetMapping("/object/{id}")
public String getObject(@PathVariable int id) public String getObject(@PathVariable int id)
{ {
return examineService.get(OBJECT, id); return examineService.get(OBJECT, id);
} }
@RequestMapping("/item/{id}") @GetMapping("/item/{id}")
public String getItem(@PathVariable int id) public String getItem(@PathVariable int id)
{ {
// Tradeable item examine info is available from the Jagex item API // Tradeable item examine info is available from the Jagex item API
@@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -71,7 +72,7 @@ public class FeedController
} }
catch (IOException e) catch (IOException e)
{ {
log.warn(null, e); log.warn(e.getMessage());
} }
try try
@@ -80,7 +81,7 @@ public class FeedController
} }
catch (IOException e) catch (IOException e)
{ {
log.warn(null, e); log.warn(e.getMessage());
} }
try try
@@ -89,13 +90,13 @@ public class FeedController
} }
catch (IOException e) catch (IOException e)
{ {
log.warn(null, e); log.warn(e.getMessage());
} }
feedResult = new FeedResult(items); feedResult = new FeedResult(items);
} }
@RequestMapping @GetMapping
public ResponseEntity<FeedResult> getFeed() public ResponseEntity<FeedResult> getFeed()
{ {
if (feedResult == null) if (feedResult == null)
@@ -63,7 +63,7 @@ public class BlogService
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Error getting blog posts: " + response.message()); throw new IOException("Error getting blog posts: " + response);
} }
try try
@@ -50,7 +50,7 @@ import org.xml.sax.SAXException;
@Service @Service
public class OSRSNewsService public class OSRSNewsService
{ {
private static final HttpUrl RSS_URL = HttpUrl.parse("http://services.runescape.com/m=news/latest_news.rss?oldschool=true"); private static final HttpUrl RSS_URL = HttpUrl.parse("https://services.runescape.com/m=news/latest_news.rss?oldschool=true");
private static final SimpleDateFormat PUB_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy '00:00:00 GMT'", Locale.US); private static final SimpleDateFormat PUB_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy '00:00:00 GMT'", Locale.US);
public List<FeedItem> getNews() throws IOException public List<FeedItem> getNews() throws IOException
@@ -63,7 +63,7 @@ public class OSRSNewsService
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Error getting OSRS news: " + response.message()); throw new IOException("Error getting OSRS news: " + response);
} }
try try
@@ -103,9 +103,9 @@ public class TwitterService
{ {
return getTweets(true); return getTweets(true);
} }
throw new InternalServerErrorException("Could not auth to Twitter after trying once: " + response.message()); throw new InternalServerErrorException("Could not auth to Twitter after trying once: " + response);
default: default:
throw new IOException("Error getting Twitter list: " + response.message()); throw new IOException("Error getting Twitter list: " + response);
} }
} }
@@ -124,7 +124,7 @@ public class TwitterService
i.getUser().getProfileImageUrl(), i.getUser().getProfileImageUrl(),
i.getUser().getScreenName(), i.getUser().getScreenName(),
i.getText().replace("\n\n", " ").replaceAll("\n", " "), i.getText().replace("\n\n", " ").replaceAll("\n", " "),
"https://twitter.com/statuses/" + i.getId(), "https://twitter.com/" + i.getUser().getScreenName() + "/status/" + i.getId(),
getTimestampFromSnowflake(i.getId()))); getTimestampFromSnowflake(i.getId())));
} }
@@ -146,7 +146,7 @@ public class TwitterService
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Error authing to Twitter: " + response.message()); throw new IOException("Error authing to Twitter: " + response);
} }
InputStream in = response.body().byteStream(); InputStream in = response.body().byteStream();
@@ -0,0 +1,111 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.ge;
import java.io.IOException;
import java.util.Collection;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.runelite.http.api.ge.GrandExchangeTrade;
import net.runelite.http.service.account.AuthFilter;
import net.runelite.http.service.account.beans.SessionEntry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ge")
public class GrandExchangeController
{
private final GrandExchangeService grandExchangeService;
private final AuthFilter authFilter;
@Autowired
public GrandExchangeController(GrandExchangeService grandExchangeService, AuthFilter authFilter)
{
this.grandExchangeService = grandExchangeService;
this.authFilter = authFilter;
}
@PostMapping
public void submit(HttpServletRequest request, HttpServletResponse response, @RequestBody GrandExchangeTrade grandExchangeTrade) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return;
}
grandExchangeService.add(session.getUser(), grandExchangeTrade);
}
@GetMapping
public Collection<GrandExchangeTrade> get(HttpServletRequest request, HttpServletResponse response,
@RequestParam(required = false, defaultValue = "1024") int limit,
@RequestParam(required = false, defaultValue = "0") int offset) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return null;
}
return grandExchangeService.get(session.getUser(), limit, offset).stream()
.map(GrandExchangeController::convert)
.collect(Collectors.toList());
}
private static GrandExchangeTrade convert(TradeEntry tradeEntry)
{
GrandExchangeTrade grandExchangeTrade = new GrandExchangeTrade();
grandExchangeTrade.setBuy(tradeEntry.getAction() == TradeAction.BUY);
grandExchangeTrade.setItemId(tradeEntry.getItem());
grandExchangeTrade.setQuantity(tradeEntry.getQuantity());
grandExchangeTrade.setPrice(tradeEntry.getPrice());
grandExchangeTrade.setTime(tradeEntry.getTime());
return grandExchangeTrade;
}
@DeleteMapping
public void delete(HttpServletRequest request, HttpServletResponse response) throws IOException
{
SessionEntry session = authFilter.handle(request, response);
if (session == null)
{
return;
}
grandExchangeService.delete(session.getUser());
}
}
@@ -0,0 +1,113 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.ge;
import java.util.Collection;
import net.runelite.http.api.ge.GrandExchangeTrade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.sql2o.Connection;
import org.sql2o.Sql2o;
@Service
public class GrandExchangeService
{
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `ge_trades` (\n" +
" `id` int(11) NOT NULL AUTO_INCREMENT,\n" +
" `user` int(11) NOT NULL,\n" +
" `action` enum('BUY','SELL') NOT NULL,\n" +
" `item` int(11) NOT NULL,\n" +
" `quantity` int(11) NOT NULL,\n" +
" `price` int(11) NOT NULL,\n" +
" `time` timestamp NOT NULL DEFAULT current_timestamp(),\n" +
" PRIMARY KEY (`id`),\n" +
" KEY `user_time` (`user`, `time`),\n" +
" KEY `time` (`time`),\n" +
" CONSTRAINT `ge_trades_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`id`)\n" +
") ENGINE=InnoDB;";
private final Sql2o sql2o;
@Autowired
public GrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o)
{
this.sql2o = sql2o;
// Ensure necessary tables exist
try (Connection con = sql2o.open())
{
con.createQuery(CREATE_TABLE).executeUpdate();
}
}
public void add(int userId, GrandExchangeTrade grandExchangeTrade)
{
try (Connection con = sql2o.open())
{
con.createQuery("insert into ge_trades (user, action, item, quantity, price) values (:user," +
" :action, :item, :quantity, :price)")
.addParameter("user", userId)
.addParameter("action", grandExchangeTrade.isBuy() ? "BUY" : "SELL")
.addParameter("item", grandExchangeTrade.getItemId())
.addParameter("quantity", grandExchangeTrade.getQuantity())
.addParameter("price", grandExchangeTrade.getPrice())
.executeUpdate();
}
}
public Collection<TradeEntry> get(int userId, int limit, int offset)
{
try (Connection con = sql2o.open())
{
return con.createQuery("select id, user, action, item, quantity, price, time from ge_trades where user = :user limit :limit offset :offset")
.addParameter("user", userId)
.addParameter("limit", limit)
.addParameter("offset", offset)
.executeAndFetch(TradeEntry.class);
}
}
public void delete(int userId)
{
try (Connection con = sql2o.open())
{
con.createQuery("delete from ge_trades where user = :user")
.addParameter("user", userId)
.executeUpdate();
}
}
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void expire()
{
try (Connection con = sql2o.open())
{
con.createQuery("delete from ge_trades where time < current_timestamp - interval 1 month")
.executeUpdate();
}
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.ge;
enum TradeAction
{
BUY,
SELL;
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.ge;
import java.time.Instant;
import lombok.Data;
@Data
class TradeEntry
{
private int id;
private int user;
private TradeAction action;
private int item;
private int quantity;
private int price;
private Instant time;
}
@@ -34,6 +34,7 @@ import net.runelite.http.service.util.HiscoreEndpointEditor;
import net.runelite.http.service.xp.XpTrackerService; import net.runelite.http.service.xp.XpTrackerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -50,7 +51,7 @@ public class HiscoreController
@Autowired @Autowired
private XpTrackerService xpTrackerService; private XpTrackerService xpTrackerService;
@RequestMapping("/{endpoint}") @GetMapping("/{endpoint}")
public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws ExecutionException public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws ExecutionException
{ {
HiscoreResult result = hiscoreService.lookupUsername(username, endpoint); HiscoreResult result = hiscoreService.lookupUsername(username, endpoint);
@@ -68,7 +69,7 @@ public class HiscoreController
return result; return result;
} }
@RequestMapping("/{endpoint}/{skillName}") @GetMapping("/{endpoint}/{skillName}")
public SingleHiscoreSkillResult singleSkillLookup(@PathVariable HiscoreEndpoint endpoint, @PathVariable String skillName, @RequestParam String username) throws ExecutionException public SingleHiscoreSkillResult singleSkillLookup(@PathVariable HiscoreEndpoint endpoint, @PathVariable String skillName, @RequestParam String username) throws ExecutionException
{ {
HiscoreSkill skill = HiscoreSkill.valueOf(skillName.toUpperCase()); HiscoreSkill skill = HiscoreSkill.valueOf(skillName.toUpperCase());
@@ -40,6 +40,7 @@ import net.runelite.http.api.item.SearchResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@@ -78,7 +79,7 @@ public class ItemController
.toArray(ItemPrice[]::new), 30, TimeUnit.MINUTES); .toArray(ItemPrice[]::new), 30, TimeUnit.MINUTES);
} }
@RequestMapping("/{itemId}") @GetMapping("/{itemId}")
public Item getItem(HttpServletResponse response, @PathVariable int itemId) public Item getItem(HttpServletResponse response, @PathVariable int itemId)
{ {
ItemEntry item = itemService.getItem(itemId); ItemEntry item = itemService.getItem(itemId);
@@ -91,7 +92,7 @@ public class ItemController
return null; return null;
} }
@RequestMapping(path = "/{itemId}/icon", produces = "image/gif") @GetMapping(path = "/{itemId}/icon", produces = "image/gif")
public ResponseEntity<byte[]> getIcon(@PathVariable int itemId) public ResponseEntity<byte[]> getIcon(@PathVariable int itemId)
{ {
ItemEntry item = itemService.getItem(itemId); ItemEntry item = itemService.getItem(itemId);
@@ -104,7 +105,7 @@ public class ItemController
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
@RequestMapping(path = "/{itemId}/icon/large", produces = "image/gif") @GetMapping(path = "/{itemId}/icon/large", produces = "image/gif")
public ResponseEntity<byte[]> getIconLarge(HttpServletResponse response, @PathVariable int itemId) public ResponseEntity<byte[]> getIconLarge(HttpServletResponse response, @PathVariable int itemId)
{ {
ItemEntry item = itemService.getItem(itemId); ItemEntry item = itemService.getItem(itemId);
@@ -117,7 +118,7 @@ public class ItemController
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
@RequestMapping("/{itemId}/price") @GetMapping("/{itemId}/price")
public ResponseEntity<ItemPrice> itemPrice( public ResponseEntity<ItemPrice> itemPrice(
@PathVariable int itemId, @PathVariable int itemId,
@RequestParam(required = false) Instant time @RequestParam(required = false) Instant time
@@ -179,7 +180,7 @@ public class ItemController
.body(itemPrice); .body(itemPrice);
} }
@RequestMapping("/search") @GetMapping("/search")
public SearchResult search(@RequestParam String query) public SearchResult search(@RequestParam String query)
{ {
List<ItemEntry> result = itemService.search(query); List<ItemEntry> result = itemService.search(query);
@@ -193,7 +194,7 @@ public class ItemController
return searchResult; return searchResult;
} }
@RequestMapping("/price") @GetMapping("/price")
public ItemPrice[] prices(@RequestParam("id") int[] itemIds) public ItemPrice[] prices(@RequestParam("id") int[] itemIds)
{ {
if (itemIds.length > MAX_BATCH_LOOKUP) if (itemIds.length > MAX_BATCH_LOOKUP)
@@ -216,7 +217,7 @@ public class ItemController
.toArray(ItemPrice[]::new); .toArray(ItemPrice[]::new);
} }
@RequestMapping("/prices") @GetMapping("/prices")
public ResponseEntity<ItemPrice[]> prices() public ResponseEntity<ItemPrice[]> prices()
{ {
return ResponseEntity.ok() return ResponseEntity.ok()
@@ -377,7 +377,7 @@ public class ItemService
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Unsuccessful http response: " + response.message()); throw new IOException("Unsuccessful http response: " + response);
} }
InputStream in = response.body().byteStream(); InputStream in = response.body().byteStream();
@@ -401,7 +401,7 @@ public class ItemService
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
throw new IOException("Unsuccessful http response: " + response.message()); throw new IOException("Unsuccessful http response: " + response);
} }
return response.body().bytes(); return response.body().bytes();
@@ -489,10 +489,16 @@ public class ItemService
public void reloadItems() throws IOException public void reloadItems() throws IOException
{ {
List<ItemDefinition> items = cacheService.getItems(); List<ItemDefinition> items = cacheService.getItems();
if (items.isEmpty())
{
log.warn("Failed to load any items from cache, item price updating will be disabled");
}
tradeableItems = items.stream() tradeableItems = items.stream()
.filter(item -> item.isTradeable) .filter(item -> item.isTradeable)
.mapToInt(item -> item.id) .mapToInt(item -> item.id)
.toArray(); .toArray();
log.debug("Loaded {} tradeable items", tradeableItems.length); log.debug("Loaded {} tradeable items", tradeableItems.length);
} }
@@ -35,6 +35,7 @@ import net.runelite.http.service.account.AuthFilter;
import net.runelite.http.service.account.beans.SessionEntry; import net.runelite.http.service.account.beans.SessionEntry;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@@ -65,8 +66,8 @@ public class LootTrackerController
response.setStatus(HttpStatusCodes.STATUS_CODE_OK); response.setStatus(HttpStatusCodes.STATUS_CODE_OK);
} }
@RequestMapping @GetMapping
public Collection<LootRecord> getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count) throws IOException public Collection<LootRecord> getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count, @RequestParam(value = "start", defaultValue = "0") int start) throws IOException
{ {
SessionEntry e = auth.handle(request, response); SessionEntry e = auth.handle(request, response);
if (e == null) if (e == null)
@@ -75,7 +76,7 @@ public class LootTrackerController
return null; return null;
} }
return service.get(e.getUser(), count); return service.get(e.getUser(), count, start);
} }
@DeleteMapping @DeleteMapping
@@ -49,7 +49,7 @@ public class LootTrackerService
+ " `type` enum('NPC', 'PLAYER', 'EVENT', 'UNKNOWN') NOT NULL,\n" + " `type` enum('NPC', 'PLAYER', 'EVENT', 'UNKNOWN') NOT NULL,\n"
+ " `eventId` VARCHAR(255) NOT NULL,\n" + " `eventId` VARCHAR(255) NOT NULL,\n"
+ " PRIMARY KEY (id),\n" + " PRIMARY KEY (id),\n"
+ " FOREIGN KEY (accountId) REFERENCES sessions(user) ON DELETE CASCADE,\n" + " FOREIGN KEY (accountId) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE,\n"
+ " INDEX idx_acc (accountId, time)," + " INDEX idx_acc (accountId, time),"
+ " INDEX idx_time (time)" + " INDEX idx_time (time)"
+ ") ENGINE=InnoDB"; + ") ENGINE=InnoDB";
@@ -66,7 +66,7 @@ public class LootTrackerService
private static final String INSERT_KILL_QUERY = "INSERT INTO kills (accountId, type, eventId) VALUES (:accountId, :type, :eventId)"; private static final String INSERT_KILL_QUERY = "INSERT INTO kills (accountId, type, eventId) VALUES (:accountId, :type, :eventId)";
private static final String INSERT_DROP_QUERY = "INSERT INTO drops (killId, itemId, itemQuantity) VALUES (LAST_INSERT_ID(), :itemId, :itemQuantity)"; private static final String INSERT_DROP_QUERY = "INSERT INTO drops (killId, itemId, itemQuantity) VALUES (LAST_INSERT_ID(), :itemId, :itemQuantity)";
private static final String SELECT_LOOT_QUERY = "SELECT killId,time,type,eventId,itemId,itemQuantity FROM kills JOIN drops ON drops.killId = kills.id WHERE accountId = :accountId ORDER BY TIME DESC LIMIT :limit"; private static final String SELECT_LOOT_QUERY = "SELECT killId,time,type,eventId,itemId,itemQuantity FROM kills JOIN drops ON drops.killId = kills.id WHERE accountId = :accountId ORDER BY TIME DESC LIMIT :limit OFFSET :offset";
private static final String DELETE_LOOT_ACCOUNT = "DELETE FROM kills WHERE accountId = :accountId"; private static final String DELETE_LOOT_ACCOUNT = "DELETE FROM kills WHERE accountId = :accountId";
private static final String DELETE_LOOT_ACCOUNT_EVENTID = "DELETE FROM kills WHERE accountId = :accountId AND eventId = :eventId"; private static final String DELETE_LOOT_ACCOUNT_EVENTID = "DELETE FROM kills WHERE accountId = :accountId AND eventId = :eventId";
@@ -119,7 +119,7 @@ public class LootTrackerService
} }
} }
public Collection<LootRecord> get(int accountId, int limit) public Collection<LootRecord> get(int accountId, int limit, int offset)
{ {
List<LootResult> lootResults; List<LootResult> lootResults;
@@ -128,6 +128,7 @@ public class LootTrackerService
lootResults = con.createQuery(SELECT_LOOT_QUERY) lootResults = con.createQuery(SELECT_LOOT_QUERY)
.addParameter("accountId", accountId) .addParameter("accountId", accountId)
.addParameter("limit", limit) .addParameter("limit", limit)
.addParameter("offset", offset)
.executeAndFetch(LootResult.class); .executeAndFetch(LootResult.class);
} }
@@ -141,7 +142,7 @@ public class LootTrackerService
{ {
if (!gameItems.isEmpty()) if (!gameItems.isEmpty())
{ {
LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems); LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems, current.getTime());
lootRecords.add(lootRecord); lootRecords.add(lootRecord);
gameItems = new ArrayList<>(); gameItems = new ArrayList<>();
@@ -156,7 +157,7 @@ public class LootTrackerService
if (!gameItems.isEmpty()) if (!gameItems.isEmpty())
{ {
LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems); LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems, current.getTime());
lootRecords.add(lootRecord); lootRecords.add(lootRecord);
} }
@@ -29,23 +29,24 @@ import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/osb/ge") @RequestMapping("/osb/ge")
public class GrandExchangeController public class OSBGrandExchangeController
{ {
private final GrandExchangeService grandExchangeService; private final OSBGrandExchangeService grandExchangeService;
@Autowired @Autowired
public GrandExchangeController(GrandExchangeService grandExchangeService) public OSBGrandExchangeController(OSBGrandExchangeService grandExchangeService)
{ {
this.grandExchangeService = grandExchangeService; this.grandExchangeService = grandExchangeService;
} }
@RequestMapping @GetMapping
public ResponseEntity<GrandExchangeEntry> get(@RequestParam("itemId") int itemId) throws ExecutionException public ResponseEntity<GrandExchangeEntry> get(@RequestParam("itemId") int itemId) throws ExecutionException
{ {
GrandExchangeEntry grandExchangeEntry = grandExchangeService.get(itemId); GrandExchangeEntry grandExchangeEntry = grandExchangeService.get(itemId);
@@ -40,7 +40,7 @@ import org.sql2o.Sql2o;
@Service @Service
@Slf4j @Slf4j
public class GrandExchangeService public class OSBGrandExchangeService
{ {
private static final String CREATE_GRAND_EXCHANGE_PRICES = "CREATE TABLE IF NOT EXISTS `osb_ge` (\n" private static final String CREATE_GRAND_EXCHANGE_PRICES = "CREATE TABLE IF NOT EXISTS `osb_ge` (\n"
+ " `item_id` int(11) NOT NULL,\n" + " `item_id` int(11) NOT NULL,\n"
@@ -56,7 +56,7 @@ public class GrandExchangeService
private final Sql2o sql2o; private final Sql2o sql2o;
@Autowired @Autowired
public GrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o) public OSBGrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o)
{ {
this.sql2o = sql2o; this.sql2o = sql2o;
@@ -31,6 +31,7 @@ import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -55,7 +56,7 @@ public class SpriteController
} }
}); });
@RequestMapping(produces = "image/png") @GetMapping(produces = "image/png")
public ResponseEntity<byte[]> getSprite( public ResponseEntity<byte[]> getSprite(
@RequestParam int spriteId, @RequestParam int spriteId,
@RequestParam(defaultValue = "0") int frameId @RequestParam(defaultValue = "0") int frameId
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -45,7 +46,7 @@ public class WorldController
private WorldResult worldResult; private WorldResult worldResult;
@RequestMapping @GetMapping
public ResponseEntity<WorldResult> listWorlds() throws IOException public ResponseEntity<WorldResult> listWorlds() throws IOException
{ {
return ResponseEntity.ok() return ResponseEntity.ok()
@@ -1,100 +0,0 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.ws;
import com.google.gson.Gson;
import java.util.UUID;
import javax.websocket.CloseReason;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.runelite.http.api.ws.WebsocketGsonFactory;
import net.runelite.http.api.ws.WebsocketMessage;
import net.runelite.http.api.ws.messages.Handshake;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ServerEndpoint("/ws")
public class WSService
{
private static final Logger logger = LoggerFactory.getLogger(WSService.class);
private static final Gson gson = WebsocketGsonFactory.build();
private Session session;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private UUID uuid;
public void send(WebsocketMessage message)
{
String json = gson.toJson(message, WebsocketMessage.class);
logger.debug("Sending {}", json);
session.getAsyncRemote().sendText(json);
}
@OnOpen
public void onOpen(Session session, EndpointConfig config)
{
this.session = session;
logger.debug("New session {}", session);
}
@OnClose
public void onClose(Session session, CloseReason resaon)
{
SessionManager.remove(this);
logger.debug("Close session {}", session);
}
@OnError
public void onError(Session session, Throwable ex)
{
SessionManager.remove(this);
logger.debug("Error in session {}", session, ex);
}
@OnMessage
public void onMessage(Session session, String text)
{
WebsocketMessage message = gson.fromJson(text, WebsocketMessage.class);
logger.debug("Got message: {}", message);
if (message instanceof Handshake)
{
Handshake hs = (Handshake) message;
SessionManager.changeSessionUID(this, hs.getSession());
}
}
}
@@ -38,6 +38,8 @@ public interface XpMapper
XpData xpEntityToXpData(XpEntity xpEntity); XpData xpEntityToXpData(XpEntity xpEntity);
@Mapping(target = "time", ignore = true)
@Mapping(source = "attack.experience", target = "attack_xp") @Mapping(source = "attack.experience", target = "attack_xp")
@Mapping(source = "defence.experience", target = "defence_xp") @Mapping(source = "defence.experience", target = "defence_xp")
@Mapping(source = "strength.experience", target = "strength_xp") @Mapping(source = "strength.experience", target = "strength_xp")
@@ -28,6 +28,7 @@ import java.time.Instant;
import net.runelite.http.api.xp.XpData; import net.runelite.http.api.xp.XpData;
import net.runelite.http.service.xp.beans.XpEntity; import net.runelite.http.service.xp.beans.XpEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -39,13 +40,13 @@ public class XpTrackerController
@Autowired @Autowired
private XpTrackerService xpTrackerService; private XpTrackerService xpTrackerService;
@RequestMapping("/update") @GetMapping("/update")
public void update(@RequestParam String username) public void update(@RequestParam String username)
{ {
xpTrackerService.tryUpdate(username); xpTrackerService.tryUpdate(username);
} }
@RequestMapping("/get") @GetMapping("/get")
public XpData get(@RequestParam String username, @RequestParam(required = false) Instant time) public XpData get(@RequestParam String username, @RequestParam(required = false) Instant time)
{ {
if (time == null) if (time == null)
@@ -29,8 +29,8 @@ import com.google.common.hash.Funnels;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayDeque;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreEndpoint;
@@ -50,8 +50,8 @@ import org.sql2o.Sql2o;
@Slf4j @Slf4j
public class XpTrackerService public class XpTrackerService
{ {
private static final int QUEUE_LIMIT = 100_000; private static final int QUEUE_LIMIT = 32768;
private static final Duration UPDATE_TIME = Duration.ofMinutes(5); private static final int BLOOMFILTER_EXPECTED_INSERTIONS = 100_000;
@Autowired @Autowired
@Qualifier("Runelite XP Tracker SQL2O") @Qualifier("Runelite XP Tracker SQL2O")
@@ -60,7 +60,7 @@ public class XpTrackerService
@Autowired @Autowired
private HiscoreService hiscoreService; private HiscoreService hiscoreService;
private final Queue<String> usernameUpdateQueue = new ConcurrentLinkedDeque<>(); private final Queue<String> usernameUpdateQueue = new ArrayDeque<>();
private BloomFilter<String> usernameFilter = createFilter(); private BloomFilter<String> usernameFilter = createFilter();
public void update(String username) throws ExecutionException public void update(String username) throws ExecutionException
@@ -76,6 +76,21 @@ public class XpTrackerService
return; return;
} }
try (Connection con = sql2o.open())
{
PlayerEntity playerEntity = findOrCreatePlayer(con, username);
Duration frequency = updateFrequency(playerEntity);
Instant now = Instant.now();
Duration timeSinceLastUpdate = Duration.between(playerEntity.getLast_updated(), now);
if (timeSinceLastUpdate.toMillis() < frequency.toMillis())
{
log.debug("User {} updated too recently", username);
usernameFilter.put(username);
return;
}
synchronized (usernameUpdateQueue)
{
if (usernameUpdateQueue.size() >= QUEUE_LIMIT) if (usernameUpdateQueue.size() >= QUEUE_LIMIT)
{ {
log.warn("Username update queue is full ({})", QUEUE_LIMIT); log.warn("Username update queue is full ({})", QUEUE_LIMIT);
@@ -83,6 +98,9 @@ public class XpTrackerService
} }
usernameUpdateQueue.add(username); usernameUpdateQueue.add(username);
}
}
usernameFilter.put(username); usernameFilter.put(username);
} }
@@ -104,13 +122,6 @@ public class XpTrackerService
log.debug("Hiscore for {} already up to date", username); log.debug("Hiscore for {} already up to date", username);
return; return;
} }
Duration difference = Duration.between(currentXp.getTime(), now);
if (difference.compareTo(UPDATE_TIME) <= 0)
{
log.debug("Updated {} too recently", username);
return;
}
} }
con.createQuery("insert into xp (player,attack_xp,defence_xp,strength_xp,hitpoints_xp,ranged_xp,prayer_xp,magic_xp,cooking_xp,woodcutting_xp," con.createQuery("insert into xp (player,attack_xp,defence_xp,strength_xp,hitpoints_xp,ranged_xp,prayer_xp,magic_xp,cooking_xp,woodcutting_xp,"
@@ -172,6 +183,11 @@ public class XpTrackerService
.addParameter("construction_rank", hiscoreResult.getConstruction().getRank()) .addParameter("construction_rank", hiscoreResult.getConstruction().getRank())
.addParameter("overall_rank", hiscoreResult.getOverall().getRank()) .addParameter("overall_rank", hiscoreResult.getOverall().getRank())
.executeUpdate(); .executeUpdate();
con.createQuery("update player set rank = :rank, last_updated = CURRENT_TIMESTAMP where id = :id")
.addParameter("id", playerEntity.getId())
.addParameter("rank", hiscoreResult.getOverall().getRank())
.executeUpdate();
} }
} }
@@ -197,6 +213,7 @@ public class XpTrackerService
playerEntity.setId(id); playerEntity.setId(id);
playerEntity.setName(username); playerEntity.setName(username);
playerEntity.setTracked_since(now); playerEntity.setTracked_since(now);
playerEntity.setLast_updated(now);
return playerEntity; return playerEntity;
} }
@@ -220,18 +237,21 @@ public class XpTrackerService
@Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 1000)
public void update() throws ExecutionException public void update() throws ExecutionException
{ {
String next = usernameUpdateQueue.poll(); String next;
synchronized (usernameUpdateQueue)
{
next = usernameUpdateQueue.poll();
}
if (next == null) if (next == null)
{ {
return; return;
} }
HiscoreResult hiscoreResult = hiscoreService.lookupUsername(next, HiscoreEndpoint.NORMAL); update(next);
update(next, hiscoreResult);
} }
@Scheduled(fixedDelay = 3 * 60 * 60 * 1000) // 3 hours @Scheduled(fixedDelay = 6 * 60 * 60 * 1000) // 6 hours
public void clearFilter() public void clearFilter()
{ {
usernameFilter = createFilter(); usernameFilter = createFilter();
@@ -241,14 +261,47 @@ public class XpTrackerService
{ {
final BloomFilter<String> filter = BloomFilter.create( final BloomFilter<String> filter = BloomFilter.create(
Funnels.stringFunnel(Charset.defaultCharset()), Funnels.stringFunnel(Charset.defaultCharset()),
100_000 BLOOMFILTER_EXPECTED_INSERTIONS
); );
synchronized (usernameUpdateQueue)
{
for (String toUpdate : usernameUpdateQueue) for (String toUpdate : usernameUpdateQueue)
{ {
filter.put(toUpdate); filter.put(toUpdate);
} }
}
return filter; return filter;
} }
/**
* scale how often to check hiscore updates for players based on their rank
* @param playerEntity
* @return
*/
private static Duration updateFrequency(PlayerEntity playerEntity)
{
Integer rank = playerEntity.getRank();
if (rank == null || rank == -1)
{
return Duration.ofDays(7);
}
else if (rank < 10_000)
{
return Duration.ofHours(6);
}
else if (rank < 50_000)
{
return Duration.ofDays(2);
}
else if (rank < 100_000)
{
return Duration.ofDays(5);
}
else
{
return Duration.ofDays(7);
}
}
} }
@@ -33,4 +33,6 @@ public class PlayerEntity
private Integer id; private Integer id;
private String name; private String name;
private Instant tracked_since; private Instant tracked_since;
private Instant last_updated;
private Integer rank;
} }
@@ -30,6 +30,7 @@ import net.runelite.http.api.xtea.XteaKey;
import net.runelite.http.api.xtea.XteaRequest; import net.runelite.http.api.xtea.XteaRequest;
import net.runelite.http.service.util.exception.NotFoundException; import net.runelite.http.service.util.exception.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -49,7 +50,7 @@ public class XteaController
xteaService.submit(xteaRequest); xteaService.submit(xteaRequest);
} }
@RequestMapping @GetMapping
public List<XteaKey> get() public List<XteaKey> get()
{ {
return xteaService.get().stream() return xteaService.get().stream()
@@ -57,7 +58,7 @@ public class XteaController
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@RequestMapping("/{region}") @GetMapping("/{region}")
public XteaKey getRegion(@PathVariable int region) public XteaKey getRegion(@PathVariable int region)
{ {
XteaEntry xteaRegion = xteaService.getRegion(region); XteaEntry xteaRegion = xteaService.getRegion(region);
@@ -0,0 +1,31 @@
# Enable debug logging
debug: true
logging.level.net.runelite: DEBUG
# Development data sources
datasource:
runelite:
jndiName:
driverClassName: org.mariadb.jdbc.Driver
type: org.mariadb.jdbc.MariaDbDataSource
url: jdbc:mariadb://localhost:3306/runelite
username: runelite
password: runelite
runelite-cache:
jndiName:
driverClassName: org.mariadb.jdbc.Driver
type: org.mariadb.jdbc.MariaDbDataSource
url: jdbc:mariadb://localhost:3306/cache
username: runelite
password: runelite
runelite-tracker:
jndiName:
driverClassName: org.mariadb.jdbc.Driver
type: org.mariadb.jdbc.MariaDbDataSource
url: jdbc:mariadb://localhost:3306/xptracker
username: runelite
password: runelite
# Development oauth callback (without proxy)
oauth:
callback: http://localhost:8080/account/callback
@@ -0,0 +1,41 @@
datasource:
runelite:
jndiName: java:comp/env/jdbc/runelite
runelite-cache:
jndiName: java:comp/env/jdbc/runelite-cache2
runelite-tracker:
jndiName: java:comp/env/jdbc/runelite-tracker
# By default Spring tries to register the datasource as an MXBean,
# so if multiple apis are deployed on one web container with
# shared datasource it tries to register it multiples times and
# fails when starting the 2nd api
spring.jmx.enabled: false
# Google OAuth client
oauth:
client-id:
client-secret:
callback: https://api.runelite.net/oauth/
# Minio client storage for cache
minio:
endpoint: http://localhost:9000
accesskey: AM54M27O4WZK65N6F8IP
secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP
bucket: runelite
# Redis client for temporary data storage
redis:
pool.size: 10
host: http://localhost:6379
mongo:
host: mongodb://localhost:27017
# Twitter client for feed
runelite:
twitter:
consumerkey:
secretkey:
listid: 968949795153948673
@@ -1,8 +1,8 @@
-- MySQL dump 10.16 Distrib 10.2.9-MariaDB, for Linux (x86_64) -- MySQL dump 10.16 Distrib 10.2.18-MariaDB, for Linux (x86_64)
-- --
-- Host: localhost Database: xptracker -- Host: localhost Database: xptracker
-- ------------------------------------------------------ -- ------------------------------------------------------
-- Server version 10.2.9-MariaDB -- Server version 10.2.18-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -26,6 +26,8 @@ CREATE TABLE `player` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL, `name` varchar(32) NOT NULL,
`tracked_since` timestamp NOT NULL DEFAULT current_timestamp(), `tracked_since` timestamp NOT NULL DEFAULT current_timestamp(),
`last_updated` timestamp NOT NULL DEFAULT current_timestamp(),
`rank` int(11) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -116,7 +118,7 @@ CREATE TABLE `xp` (
`overall_rank` int(11) NOT NULL, `overall_rank` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `player_time` (`player`,`time`), UNIQUE KEY `player_time` (`player`,`time`),
INDEX `idx_time` (`time`), KEY `idx_time` (`time`),
CONSTRAINT `fk_player` FOREIGN KEY (`player`) REFERENCES `player` (`id`) CONSTRAINT `fk_player` FOREIGN KEY (`player`) REFERENCES `player` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -130,4 +132,4 @@ CREATE TABLE `xp` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-01-20 18:37:09 -- Dump completed on 2019-02-15 21:01:17
@@ -0,0 +1,110 @@
{{#info}}
# {{title}}
{{join schemes " | "}}://{{host}}{{basePath}}
{{description}}
{{#contact}}
[**Contact the developer**](mailto:{{email}})
{{/contact}}
**Version** {{version}}
{{#if termsOfService}}
[**Terms of Service**]({{termsOfService}})
{{/if}}
{{/info}}
{{#if consumes}}__Consumes:__ {{join consumes ", "}}{{/if}}
{{#if produces}}__Produces:__ {{join produces ", "}}{{/if}}
{{#if securityDefinitions}}
# Security Definitions
{{> security}}
{{/if}}
<details>
<summary><b>Table Of Contents</b></summary>
[toc]
</details>
# APIs
{{#each paths}}
## {{@key}}
{{#this}}
{{#get}}
### GET
{{> operation}}
{{/get}}
{{#put}}
### PUT
{{> operation}}
{{/put}}
{{#post}}
### POST
{{> operation}}
{{/post}}
{{#delete}}
### DELETE
{{> operation}}
{{/delete}}
{{#option}}
### OPTION
{{> operation}}
{{/option}}
{{#patch}}
### PATCH
{{> operation}}
{{/patch}}
{{#head}}
### HEAD
{{> operation}}
{{/head}}
{{/this}}
{{/each}}
# Definitions
{{#each definitions}}
## <a name="/definitions/{{key}}">{{@key}}</a>
<table>
<tr>
<th>name</th>
<th>type</th>
<th>required</th>
<th>description</th>
<th>example</th>
</tr>
{{#each this.properties}}
<tr>
<td>{{@key}}</td>
<td>
{{#ifeq type "array"}}
{{#items.$ref}}
{{type}}[<a href="{{items.$ref}}">{{basename items.$ref}}</a>]
{{/items.$ref}}
{{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}}
{{else}}
{{#$ref}}<a href="{{$ref}}">{{basename $ref}}</a>{{/$ref}}
{{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}}
{{/ifeq}}
</td>
<td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
<td>{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}</td>
<td>{{example}}</td>
</tr>
{{/each}}
</table>
{{/each}}
@@ -0,0 +1,71 @@
{{#deprecated}}-deprecated-{{/deprecated}}
<a id="{{operationId}}">{{summary}}</a>
{{description}}
{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}})
{{/if}}
{{#if security}}
#### Security
{{/if}}
{{#security}}
{{#each this}}
* {{@key}}
{{#this}} * {{this}}
{{/this}}
{{/each}}
{{/security}}
#### Request
{{#if consumes}}__Content-Type:__ {{join consumes ", "}}{{/if}}
##### Parameters
{{#if parameters}}
<table>
<tr>
<th>Name</th>
<th>Located in</th>
<th>Required</th>
<th>Description</th>
<th>Default</th>
<th>Schema</th>
</tr>
{{/if}}
{{#parameters}}
<tr>
<th>{{name}}</th>
<td>{{in}}</td>
<td>{{#if required}}yes{{else}}no{{/if}}</td>
<td>{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}</td>
<td> - </td>
{{#ifeq in "body"}}
<td>
{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}
{{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}}
</td>
{{else}}
{{#ifeq type "array"}}
<td>Array[{{items.type}}] ({{collectionFormat}})</td>
{{else}}
<td>{{type}} {{#format}}({{format}}){{/format}}</td>
{{/ifeq}}
{{/ifeq}}
</tr>
{{/parameters}}
{{#if parameters}}
</table>
{{/if}}
#### Response
{{#if produces}}__Content-Type:__ {{join produces ", "}}{{/if}}
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}|
{{/each}}
@@ -0,0 +1,88 @@
{{#each securityDefinitions}}
### {{@key}}
{{#this}}
{{#ifeq type "oauth2"}}
<table>
<tr>
<th>type</th>
<th colspan="2">{{type}}</th>
</tr>
{{#if description}}
<tr>
<th>description</th>
<th colspan="2">{{description}}</th>
</tr>
{{/if}}
{{#if authorizationUrl}}
<tr>
<th>authorizationUrl</th>
<th colspan="2">{{authorizationUrl}}</th>
</tr>
{{/if}}
{{#if flow}}
<tr>
<th>flow</th>
<th colspan="2">{{flow}}</th>
</tr>
{{/if}}
{{#if tokenUrl}}
<tr>
<th>tokenUrl</th>
<th colspan="2">{{tokenUrl}}</th>
</tr>
{{/if}}
{{#if scopes}}
<tr>
<td rowspan="3">scopes</td>
{{#each scopes}}
<td>{{@key}}</td>
<td>{{this}}</td>
</tr>
<tr>
{{/each}}
</tr>
{{/if}}
</table>
{{/ifeq}}
{{#ifeq type "apiKey"}}
<table>
<tr>
<th>type</th>
<th colspan="2">{{type}}</th>
</tr>
{{#if description}}
<tr>
<th>description</th>
<th colspan="2">{{description}}</th>
</tr>
{{/if}}
{{#if name}}
<tr>
<th>name</th>
<th colspan="2">{{name}}</th>
</tr>
{{/if}}
{{#if in}}
<tr>
<th>in</th>
<th colspan="2">{{in}}</th>
</tr>
{{/if}}
</table>
{{/ifeq}}
{{#ifeq type "basic"}}
<table>
<tr>
<th>type</th>
<th colspan="2">{{type}}</th>
</tr>
{{#if description}}
<tr>
<th>description</th>
<th colspan="2">{{description}}</th>
</tr>
{{/if}}
</table>
{{/ifeq}}
{{/this}}
{{/each}}
@@ -0,0 +1,49 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css"/>
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
.markdown-body table {
display: table;
}
</style>
<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/JanLoebel/showdown-toc/src/showdown-toc.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var markdown = document.querySelector('noscript').innerText
var converter = new showdown.Converter({emoji: true, extensions: ['toc']})
converter.setFlavor('github')
var html = converter.makeHtml(markdown)
document.body.innerHTML = html
})
</script>
<title>{{info.title}} {{info.version}}</title>
</head>
<body class="markdown-body">
<noscript>{{>markdown}}</noscript>
</body>
</html>
@@ -1,80 +0,0 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import javax.naming.NamingException;
import net.runelite.http.service.util.InstantConverter;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.sql2o.Sql2o;
import org.sql2o.converters.Converter;
import org.sql2o.quirks.NoQuirks;
@SpringBootApplication
@EnableScheduling
public class SpringBootWebApplicationTest
{
@Bean("Runelite SQL2O")
Sql2o sql2o()
{
Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter());
return new Sql2o("jdbc:mysql://192.168.1.2/runelite", "runelite", "runelite", new NoQuirks(converters));
}
@Bean("Runelite Cache SQL2O")
Sql2o cacheSql2o() throws NamingException
{
Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter());
return new Sql2o("jdbc:mysql://192.168.1.2/cache", "runelite", "runelite", new NoQuirks(converters));
}
@Bean("Runelite XP Tracker SQL2O")
Sql2o xpSql2o() throws NamingException
{
Map<Class, Converter> converters = new HashMap<>();
converters.put(Instant.class, new InstantConverter());
return new Sql2o("jdbc:mysql://192.168.1.2/xptracker", "runelite", "runelite", new NoQuirks(converters));
}
@Test
@Ignore
public void test() throws InterruptedException
{
SpringApplication.run(SpringBootWebApplicationTest.class, new String[0]);
for (;;)
{
Thread.sleep(100L);
}
}
}
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.config;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.service.account.AuthFilter;
import net.runelite.http.service.account.beans.SessionEntry;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@WebMvcTest(ConfigController.class)
@Slf4j
@ActiveProfiles("test")
public class ConfigControllerTest
{
@Autowired
private MockMvc mockMvc;
@MockBean
private ConfigService configService;
@MockBean
private AuthFilter authFilter;
@Before
public void before() throws IOException
{
when(authFilter.handle(any(HttpServletRequest.class), any(HttpServletResponse.class)))
.thenReturn(mock(SessionEntry.class));
}
@Test
public void testSetKey() throws Exception
{
mockMvc.perform(put("/config/key")
.content("value")
.contentType(MediaType.TEXT_PLAIN))
.andExpect(status().isOk());
verify(configService).setKey(anyInt(), eq("key"), eq("value"));
}
}
@@ -26,7 +26,6 @@
package net.runelite.http.service.hiscore; package net.runelite.http.service.hiscore;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException;
import net.runelite.http.api.hiscore.HiscoreResult; import net.runelite.http.api.hiscore.HiscoreResult;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
@@ -0,0 +1,94 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.loottracker;
import java.io.IOException;
import java.time.Instant;
import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import net.runelite.http.api.loottracker.GameItem;
import net.runelite.http.api.loottracker.LootRecord;
import net.runelite.http.api.loottracker.LootRecordType;
import net.runelite.http.service.account.AuthFilter;
import net.runelite.http.service.account.beans.SessionEntry;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@WebMvcTest(LootTrackerController.class)
@Slf4j
@ActiveProfiles("test")
public class LootTrackerControllerTest
{
@Autowired
private MockMvc mockMvc;
@MockBean
private LootTrackerService lootTrackerService;
@MockBean
private AuthFilter authFilter;
@Before
public void before() throws IOException
{
when(authFilter.handle(any(HttpServletRequest.class), any(HttpServletResponse.class)))
.thenReturn(mock(SessionEntry.class));
}
@Test
public void storeLootRecord() throws Exception
{
LootRecord lootRecord = new LootRecord();
lootRecord.setType(LootRecordType.NPC);
lootRecord.setTime(Instant.now());
lootRecord.setDrops(Collections.singletonList(new GameItem(4151, 1)));
String data = RuneLiteAPI.GSON.toJson(lootRecord);
mockMvc.perform(post("/loottracker").content(data).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
verify(lootTrackerService).store(eq(lootRecord), anyInt());
}
}
@@ -0,0 +1,17 @@
# Use in-memory database for tests
datasource:
runelite:
jndiName:
driverClassName: org.h2.Driver
type: org.h2.jdbcx.JdbcDataSource
url: jdbc:h2:mem:runelite
runelite-cache:
jndiName:
driverClassName: org.h2.Driver
type: org.h2.jdbcx.JdbcDataSource
url: jdbc:h2:mem:cache
runelite-tracker:
jndiName:
driverClassName: org.h2.Driver
type: org.h2.jdbcx.JdbcDataSource
url: jdbc:h2:mem:xptracker
@@ -1,11 +0,0 @@
oauth.client-id=moo
oauth.client-secret=cow
minio.endpoint=http://10.96.22.171:9000
minio.accesskey=AM54M27O4WZK65N6F8IP
minio.secretkey=/PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP
minio.bucket=runelite
runelite.twitter.consumerkey=moo
runelite.twitter.secretkey=cow
runelite.twitter.listid=968949795153948673
logging.level.net.runelite=DEBUG
spring.jackson.serialization.indent_output=true
+7 -2
View File
@@ -28,7 +28,7 @@
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>RuneLite</name> <name>RuneLite</name>
@@ -43,7 +43,7 @@
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
<checkstyle.skip>true</checkstyle.skip> <checkstyle.skip>true</checkstyle.skip>
<rs.version>177</rs.version> <rs.version>178</rs.version>
</properties> </properties>
<licenses> <licenses>
@@ -186,6 +186,10 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version> <version>3.0.0-M1</version>
<configuration>
<!-- Fix Javadoc on Java 11+ - JDK-8212233 -->
<source>8</source>
</configuration>
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id> <id>attach-javadocs</id>
@@ -219,6 +223,7 @@
<configLocation>checkstyle.xml</configLocation> <configLocation>checkstyle.xml</configLocation>
<!-- exclude generated sources from checkstyle https://stackoverflow.com/a/30406454/7189686 --> <!-- exclude generated sources from checkstyle https://stackoverflow.com/a/30406454/7189686 -->
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
+1 -1
View File
@@ -29,7 +29,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<artifactId>protocol-api</artifactId> <artifactId>protocol-api</artifactId>
@@ -25,8 +25,10 @@
package net.runelite.protocol.api.handshake; package net.runelite.protocol.api.handshake;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class LoginHandshakePacket extends HandshakePacket public class LoginHandshakePacket extends HandshakePacket
{ {
@@ -26,9 +26,11 @@ package net.runelite.protocol.api.handshake;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@Data @Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class UpdateHandshakePacket extends HandshakePacket public class UpdateHandshakePacket extends HandshakePacket
+1 -1
View File
@@ -29,7 +29,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<artifactId>protocol</artifactId> <artifactId>protocol</artifactId>
+1 -1
View File
@@ -29,7 +29,7 @@
<parent> <parent>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId> <artifactId>runelite-parent</artifactId>
<version>1.5.12-SNAPSHOT</version> <version>1.5.18-SNAPSHOT</version>
</parent> </parent>
<artifactId>runelite-api</artifactId> <artifactId>runelite-api</artifactId>
@@ -27,6 +27,7 @@ package net.runelite.api;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import javax.annotation.Nullable;
import net.runelite.api.annotations.VisibleForDevtools; import net.runelite.api.annotations.VisibleForDevtools;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea; import net.runelite.api.coords.WorldArea;
@@ -175,6 +176,7 @@ public interface Actor extends Renderable
* @param zOffset the z-axis offset * @param zOffset the z-axis offset
* @return the text drawing location * @return the text drawing location
*/ */
@Nullable
Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset); Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset);
/** /**
@@ -236,5 +238,12 @@ public interface Actor extends Renderable
* *
* @return the overhead text * @return the overhead text
*/ */
String getOverhead(); String getOverheadText();
/**
* Sets the overhead text that is displayed above the actor
*
* @param overheadText the overhead text
*/
void setOverheadText(String overheadText);
} }
@@ -33,6 +33,7 @@ package net.runelite.api;
public final class AnimationID public final class AnimationID
{ {
public static final int IDLE = -1; public static final int IDLE = -1;
public static final int HERBLORE_PESTLE_AND_MORTAR = 364;
public static final int WOODCUTTING_BRONZE = 879; public static final int WOODCUTTING_BRONZE = 879;
public static final int WOODCUTTING_IRON = 877; public static final int WOODCUTTING_IRON = 877;
public static final int WOODCUTTING_STEEL = 875; public static final int WOODCUTTING_STEEL = 875;
@@ -123,6 +124,7 @@ public final class AnimationID
public static final int HERBLORE_POTIONMAKING = 363; //used for both herb and secondary public static final int HERBLORE_POTIONMAKING = 363; //used for both herb and secondary
public static final int MAGIC_CHARGING_ORBS = 726; public static final int MAGIC_CHARGING_ORBS = 726;
public static final int MAGIC_MAKE_TABLET = 4068; public static final int MAGIC_MAKE_TABLET = 4068;
public static final int MAGIC_ENCHANTING_JEWELRY = 931;
public static final int BURYING_BONES = 827; public static final int BURYING_BONES = 827;
public static final int USING_GILDED_ALTAR = 3705; public static final int USING_GILDED_ALTAR = 3705;
public static final int LOOKING_INTO = 832; public static final int LOOKING_INTO = 832;
@@ -44,4 +44,11 @@ public interface ChatLineBuffer
* @return the length * @return the length
*/ */
int getLength(); int getLength();
/**
* Removes a message node
*
* @param node the {@link MessageNode} to remove
*/
void removeMessageNode(MessageNode node);
} }
@@ -634,20 +634,10 @@ public interface Client extends GameEngine
int[] getVarps(); int[] getVarps();
/** /**
* Gets an array of all integer client variables. * Gets an array of all client variables.
*
* @return local variables
*/ */
@VisibleForDevtools @VisibleForDevtools
int[] getIntVarcs(); Map<Integer, Object> getVarcMap();
/**
* Gets an array of all string client variables.
*
* @return local variables
*/
@VisibleForDevtools
String[] getStrVarcs();
/** /**
* Gets the value corresponding to the passed player variable. * Gets the value corresponding to the passed player variable.
@@ -782,6 +772,13 @@ public interface Client extends GameEngine
*/ */
int getSkillExperience(Skill skill); int getSkillExperience(Skill skill);
/**
* Get the total experience of the player
*
* @return
*/
long getOverallExperience();
/** /**
* Gets the game drawing mode. * Gets the game drawing mode.
* *
@@ -1055,6 +1052,20 @@ public interface Client extends GameEngine
*/ */
ClanMember[] getClanMembers(); ClanMember[] getClanMembers();
/**
* Gets the clan owner of the currently joined clan chat
*
* @return
*/
String getClanOwner();
/**
* Gets the clan chat name of the currently joined clan chat
*
* @return
*/
String getClanChatName();
/** /**
* Gets an array of players in the friends list. * Gets an array of players in the friends list.
* *
@@ -1569,4 +1580,16 @@ public interface Client extends GameEngine
int getRasterizer3D_clipMidY2(); int getRasterizer3D_clipMidY2();
void checkClickbox(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash); void checkClickbox(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash);
/**
* Sets if a widget is in target mode
*/
void setSpellSelected(boolean selected);
/**
* Returns client item composition cache
*/
NodeCache getItemCompositionCache();
EnumComposition getEnum(int id);
} }
@@ -38,6 +38,7 @@ public interface DecorativeObject extends TileObject
* @see net.runelite.api.model.Jarvis * @see net.runelite.api.model.Jarvis
*/ */
Polygon getConvexHull(); Polygon getConvexHull();
Polygon getConvexHull2();
Renderable getRenderable(); Renderable getRenderable();
Renderable getRenderable2(); Renderable getRenderable2();
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
public interface EnumComposition
{
int[] getKeys();
int[] getIntVals();
String[] getStringVals();
int getIntValue(int key);
String getStringValue(int key);
}
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2019, Shaun Dreclin <https://github.com/ShaunDreclin>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
/**
* Utility class used for mapping enum IDs.
* <p>
* Note: This class is not complete and may be missing mapped IDs.
*/
public final class EnumID
{
public static final int MUSIC_TRACK_NAMES = 812;
public static final int MUSIC_TRACK_IDS = 819;
}
@@ -26,6 +26,7 @@ package net.runelite.api;
public class GraphicID public class GraphicID
{ {
public static final int SPLASH = 85;
public static final int TELEPORT = 111; public static final int TELEPORT = 111;
public static final int GREY_BUBBLE_TELEPORT = 86; public static final int GREY_BUBBLE_TELEPORT = 86;
public static final int ENTANGLE = 179; public static final int ENTANGLE = 179;
@@ -6494,7 +6494,7 @@ public final class ItemID
public static final int ZAMORAK_CHAPS = 10372; public static final int ZAMORAK_CHAPS = 10372;
public static final int ZAMORAK_COIF = 10374; public static final int ZAMORAK_COIF = 10374;
public static final int GUTHIX_BRACERS = 10376; public static final int GUTHIX_BRACERS = 10376;
public static final int GUTHIX_DRAGONHIDE = 10378; public static final int GUTHIX_DHIDE = 10378;
public static final int GUTHIX_CHAPS = 10380; public static final int GUTHIX_CHAPS = 10380;
public static final int GUTHIX_COIF = 10382; public static final int GUTHIX_COIF = 10382;
public static final int SARADOMIN_BRACERS = 10384; public static final int SARADOMIN_BRACERS = 10384;
@@ -6801,7 +6801,7 @@ public final class ItemID
public static final int GUTHIX_ROBE_TOP_10788 = 10788; public static final int GUTHIX_ROBE_TOP_10788 = 10788;
public static final int ZAMORAK_DHIDE_10790 = 10790; public static final int ZAMORAK_DHIDE_10790 = 10790;
public static final int SARADOMIN_DHIDE_10792 = 10792; public static final int SARADOMIN_DHIDE_10792 = 10792;
public static final int GUTHIX_DRAGONHIDE_10794 = 10794; public static final int GUTHIX_DRAGONHIDE = 10794;
public static final int ROBIN_HOOD_HAT_10796 = 10796; public static final int ROBIN_HOOD_HAT_10796 = 10796;
public static final int RUNE_PLATEBODY_G_10798 = 10798; public static final int RUNE_PLATEBODY_G_10798 = 10798;
public static final int RUNE_PLATEBODY_T_10800 = 10800; public static final int RUNE_PLATEBODY_T_10800 = 10800;
@@ -10637,5 +10637,17 @@ public final class ItemID
public static final int ALCHEMICAL_HYDRA_HEAD = 23081; public static final int ALCHEMICAL_HYDRA_HEAD = 23081;
public static final int ANTIQUE_LAMP_23082 = 23082; public static final int ANTIQUE_LAMP_23082 = 23082;
public static final int BRIMSTONE_KEY = 23083; public static final int BRIMSTONE_KEY = 23083;
public static final int ORNATE_GLOVES = 23091;
public static final int ORNATE_BOOTS = 23093;
public static final int ORNATE_LEGS = 23095;
public static final int ORNATE_TOP = 23097;
public static final int ORNATE_CAPE = 23099;
public static final int ORNATE_HELM = 23101;
public static final int BIRTHDAY_CAKE = 23108;
public static final int MYSTIC_SET_LIGHT = 23110;
public static final int MYSTIC_SET_BLUE = 23113;
public static final int MYSTIC_SET_DARK = 23116;
public static final int MYSTIC_SET_DUSK = 23119;
public static final int OILY_PEARL_FISHING_ROD = 23122;
/* This file is automatically generated. Do not edit. */ /* This file is automatically generated. Do not edit. */
} }
@@ -63,14 +63,14 @@ public interface NPCComposition
* *
* @return the mini-map visible state * @return the mini-map visible state
*/ */
boolean isMinimapVisable(); boolean isMinimapVisible();
/** /**
* Gets whether the NPC is visible. * Gets whether the NPC is visible.
* *
* @return the visible state * @return the visible state
*/ */
boolean isVisable(); boolean isVisible();
/** /**
* Gets the ID of the NPC. * Gets the ID of the NPC.
@@ -1033,8 +1033,6 @@ public final class NpcID
public static final int ANGRY_BEAR = 1060; public static final int ANGRY_BEAR = 1060;
public static final int ANGRY_UNICORN = 1061; public static final int ANGRY_UNICORN = 1061;
public static final int ANGRY_GIANT_RAT = 1062; public static final int ANGRY_GIANT_RAT = 1062;
public static final int ANGRY_GIANT_RAT_1063 = 1063;
public static final int ANGRY_GIANT_RAT_1064 = 1064;
public static final int ANGRY_GOBLIN = 1065; public static final int ANGRY_GOBLIN = 1065;
public static final int FEAR_REAPER = 1066; public static final int FEAR_REAPER = 1066;
public static final int CONFUSION_BEAST = 1067; public static final int CONFUSION_BEAST = 1067;
@@ -2685,7 +2683,7 @@ public final class NpcID
public static final int BAT = 2827; public static final int BAT = 2827;
public static final int DRYAD = 2828; public static final int DRYAD = 2828;
public static final int FAIRY_2829 = 2829; public static final int FAIRY_2829 = 2829;
public static final int LEPRECHAUN = 2830; public static final int MYSTERIOUS_OLD_MAN = 2830;
public static final int LIZARD_MAN = 2831; public static final int LIZARD_MAN = 2831;
public static final int ORC = 2832; public static final int ORC = 2832;
public static final int TROLL_2833 = 2833; public static final int TROLL_2833 = 2833;
@@ -6186,7 +6184,7 @@ public final class NpcID
public static final int EVIL_CHICKEN_6739 = 6739; public static final int EVIL_CHICKEN_6739 = 6739;
public static final int SHADE_6740 = 6740; public static final int SHADE_6740 = 6740;
public static final int ZOMBIE_6741 = 6741; public static final int ZOMBIE_6741 = 6741;
public static final int MYSTERIOUS_OLD_MAN = 6742; public static final int MYSTERIOUS_OLD_MAN_6742 = 6742;
public static final int SERGEANT_DAMIEN_6743 = 6743; public static final int SERGEANT_DAMIEN_6743 = 6743;
public static final int FLIPPA_6744 = 6744; public static final int FLIPPA_6744 = 6744;
public static final int LEO = 6745; public static final int LEO = 6745;
@@ -6209,6 +6207,7 @@ public final class NpcID
public static final int SPAWN_6768 = 6768; public static final int SPAWN_6768 = 6768;
public static final int OSTEN = 6769; public static final int OSTEN = 6769;
public static final int ARCIS = 6770; public static final int ARCIS = 6770;
public static final int DREW = 6771;
public static final int LOVADA = 6772; public static final int LOVADA = 6772;
public static final int DOOMSAYER = 6773; public static final int DOOMSAYER = 6773;
public static final int DOOMSAYER_6774 = 6774; public static final int DOOMSAYER_6774 = 6774;
@@ -6218,6 +6217,7 @@ public final class NpcID
public static final int MAZE_GUARDIAN_6779 = 6779; public static final int MAZE_GUARDIAN_6779 = 6779;
public static final int PILIAR = 6780; public static final int PILIAR = 6780;
public static final int SHAYDA = 6781; public static final int SHAYDA = 6781;
public static final int FISHING_SPOT_6784 = 6784;
public static final int HOSA = 6785; public static final int HOSA = 6785;
public static final int HELLRAT_BEHEMOTH = 6793; public static final int HELLRAT_BEHEMOTH = 6793;
public static final int MONKEY_ARCHER_6794 = 6794; public static final int MONKEY_ARCHER_6794 = 6794;
@@ -7838,5 +7838,6 @@ public final class NpcID
public static final int VEOS_8630 = 8630; public static final int VEOS_8630 = 8630;
public static final int SEAMAN_MORRIS = 8631; public static final int SEAMAN_MORRIS = 8631;
public static final int ALCHEMICAL_HYDRA_8634 = 8634; public static final int ALCHEMICAL_HYDRA_8634 = 8634;
public static final int DODGY_GEEZER = 8644;
/* This file is automatically generated. Do not edit. */ /* This file is automatically generated. Do not edit. */
} }
@@ -12267,5 +12267,26 @@ public final class NullItemID
public static final int NULL_23088 = 23088; public static final int NULL_23088 = 23088;
public static final int NULL_23089 = 23089; public static final int NULL_23089 = 23089;
public static final int NULL_23090 = 23090; public static final int NULL_23090 = 23090;
public static final int NULL_23092 = 23092;
public static final int NULL_23094 = 23094;
public static final int NULL_23096 = 23096;
public static final int NULL_23098 = 23098;
public static final int NULL_23100 = 23100;
public static final int NULL_23102 = 23102;
public static final int NULL_23103 = 23103;
public static final int NULL_23104 = 23104;
public static final int NULL_23105 = 23105;
public static final int NULL_23106 = 23106;
public static final int NULL_23107 = 23107;
public static final int NULL_23109 = 23109;
public static final int NULL_23111 = 23111;
public static final int NULL_23112 = 23112;
public static final int NULL_23114 = 23114;
public static final int NULL_23115 = 23115;
public static final int NULL_23117 = 23117;
public static final int NULL_23118 = 23118;
public static final int NULL_23120 = 23120;
public static final int NULL_23121 = 23121;
public static final int NULL_23123 = 23123;
/* This file is automatically generated. Do not edit. */ /* This file is automatically generated. Do not edit. */
} }
@@ -1184,6 +1184,7 @@ public final class NullObjectID
public static final int NULL_2566 = 2566; public static final int NULL_2566 = 2566;
public static final int NULL_2567 = 2567; public static final int NULL_2567 = 2567;
public static final int NULL_2568 = 2568; public static final int NULL_2568 = 2568;
public static final int NULL_2630 = 2630;
public static final int NULL_2637 = 2637; public static final int NULL_2637 = 2637;
public static final int NULL_2638 = 2638; public static final int NULL_2638 = 2638;
public static final int NULL_2639 = 2639; public static final int NULL_2639 = 2639;
@@ -4639,6 +4640,7 @@ public final class NullObjectID
public static final int NULL_11016 = 11016; public static final int NULL_11016 = 11016;
public static final int NULL_11026 = 11026; public static final int NULL_11026 = 11026;
public static final int NULL_11027 = 11027; public static final int NULL_11027 = 11027;
public static final int NULL_11040 = 11040;
public static final int NULL_11045 = 11045; public static final int NULL_11045 = 11045;
public static final int NULL_11046 = 11046; public static final int NULL_11046 = 11046;
public static final int NULL_11047 = 11047; public static final int NULL_11047 = 11047;
@@ -6203,6 +6205,7 @@ public final class NullObjectID
public static final int NULL_14425 = 14425; public static final int NULL_14425 = 14425;
public static final int NULL_14426 = 14426; public static final int NULL_14426 = 14426;
public static final int NULL_14427 = 14427; public static final int NULL_14427 = 14427;
public static final int NULL_14428 = 14428;
public static final int NULL_14429 = 14429; public static final int NULL_14429 = 14429;
public static final int NULL_14430 = 14430; public static final int NULL_14430 = 14430;
public static final int NULL_14432 = 14432; public static final int NULL_14432 = 14432;
@@ -9329,6 +9332,7 @@ public final class NullObjectID
public static final int NULL_20869 = 20869; public static final int NULL_20869 = 20869;
public static final int NULL_20874 = 20874; public static final int NULL_20874 = 20874;
public static final int NULL_20875 = 20875; public static final int NULL_20875 = 20875;
public static final int NULL_20877 = 20877;
public static final int NULL_20879 = 20879; public static final int NULL_20879 = 20879;
public static final int NULL_20880 = 20880; public static final int NULL_20880 = 20880;
public static final int NULL_20881 = 20881; public static final int NULL_20881 = 20881;
@@ -11438,7 +11442,6 @@ public final class NullObjectID
public static final int NULL_24552 = 24552; public static final int NULL_24552 = 24552;
public static final int NULL_24553 = 24553; public static final int NULL_24553 = 24553;
public static final int NULL_24554 = 24554; public static final int NULL_24554 = 24554;
public static final int NULL_24558 = 24558;
public static final int NULL_24570 = 24570; public static final int NULL_24570 = 24570;
public static final int NULL_24604 = 24604; public static final int NULL_24604 = 24604;
public static final int NULL_24623 = 24623; public static final int NULL_24623 = 24623;
@@ -12310,6 +12313,8 @@ public final class NullObjectID
public static final int NULL_26195 = 26195; public static final int NULL_26195 = 26195;
public static final int NULL_26196 = 26196; public static final int NULL_26196 = 26196;
public static final int NULL_26197 = 26197; public static final int NULL_26197 = 26197;
public static final int NULL_26200 = 26200;
public static final int NULL_26204 = 26204;
public static final int NULL_26208 = 26208; public static final int NULL_26208 = 26208;
public static final int NULL_26209 = 26209; public static final int NULL_26209 = 26209;
public static final int NULL_26245 = 26245; public static final int NULL_26245 = 26245;
@@ -16101,5 +16106,13 @@ public final class NullObjectID
public static final int NULL_34651 = 34651; public static final int NULL_34651 = 34651;
public static final int NULL_34652 = 34652; public static final int NULL_34652 = 34652;
public static final int NULL_34662 = 34662; public static final int NULL_34662 = 34662;
public static final int NULL_34678 = 34678;
public static final int NULL_34679 = 34679;
public static final int NULL_34680 = 34680;
public static final int NULL_34707 = 34707;
public static final int NULL_34708 = 34708;
public static final int NULL_34709 = 34709;
public static final int NULL_34710 = 34710;
public static final int NULL_34711 = 34711;
/* This file is automatically generated. Do not edit. */ /* This file is automatically generated. Do not edit. */
} }
@@ -1452,7 +1452,6 @@ public final class ObjectID
public static final int DOOR_2627 = 2627; public static final int DOOR_2627 = 2627;
public static final int DOOR_2628 = 2628; public static final int DOOR_2628 = 2628;
public static final int WALL_2629 = 2629; public static final int WALL_2629 = 2629;
public static final int FISHING_SPOT_2630 = 2630;
public static final int DOOR_2631 = 2631; public static final int DOOR_2631 = 2631;
public static final int CHEST_2632 = 2632; public static final int CHEST_2632 = 2632;
public static final int CHEST_2633 = 2633; public static final int CHEST_2633 = 2633;
@@ -6405,7 +6404,6 @@ public final class ObjectID
public static final int WALL_11037 = 11037; public static final int WALL_11037 = 11037;
public static final int WALL_11038 = 11038; public static final int WALL_11038 = 11038;
public static final int WALL_11039 = 11039; public static final int WALL_11039 = 11039;
public static final int RUBBLE_11040 = 11040;
public static final int LADDER_11041 = 11041; public static final int LADDER_11041 = 11041;
public static final int LADDER_11042 = 11042; public static final int LADDER_11042 = 11042;
public static final int STONE_LADDER = 11043; public static final int STONE_LADDER = 11043;
@@ -8228,7 +8226,6 @@ public final class ObjectID
public static final int MYSTERIOUS_RUINS_14413 = 14413; public static final int MYSTERIOUS_RUINS_14413 = 14413;
public static final int MYSTERIOUS_RUINS_14414 = 14414; public static final int MYSTERIOUS_RUINS_14414 = 14414;
public static final int STUDY_DESK_14415 = 14415; public static final int STUDY_DESK_14415 = 14415;
public static final int FISHING_SPOT_14428 = 14428;
public static final int RIFT_14431 = 14431; public static final int RIFT_14431 = 14431;
public static final int GAS_BUBBLE = 14434; public static final int GAS_BUBBLE = 14434;
public static final int CAVE_ENTRANCE_14436 = 14436; public static final int CAVE_ENTRANCE_14436 = 14436;
@@ -11551,7 +11548,6 @@ public final class ObjectID
public static final int COMPOST_BIN_20872 = 20872; public static final int COMPOST_BIN_20872 = 20872;
public static final int CAGE_20873 = 20873; public static final int CAGE_20873 = 20873;
public static final int DUNGEON_ENTRANCE_20876 = 20876; public static final int DUNGEON_ENTRANCE_20876 = 20876;
public static final int DUNGEON_ENTRANCE_20877 = 20877;
public static final int EXIT_20878 = 20878; public static final int EXIT_20878 = 20878;
public static final int LOG_BALANCE_20882 = 20882; public static final int LOG_BALANCE_20882 = 20882;
public static final int LOG_BALANCE_20884 = 20884; public static final int LOG_BALANCE_20884 = 20884;
@@ -13122,8 +13118,9 @@ public final class ObjectID
public static final int DISPLAY_CASE_24551 = 24551; public static final int DISPLAY_CASE_24551 = 24551;
public static final int SPECIMEN_TABLE_24555 = 24555; public static final int SPECIMEN_TABLE_24555 = 24555;
public static final int SPECIMEN_TABLE_24556 = 24556; public static final int SPECIMEN_TABLE_24556 = 24556;
public static final int ROCKS_24557 = 24557; public static final int DIG_SITE_SPECIMEN_ROCKS = 24557;
public static final int DIG_SITE_SPECIMEN_ROCKS = 24559; public static final int DIG_SITE_SPECIMEN_ROCKS_24558 = 24558;
public static final int DIG_SITE_SPECIMEN_ROCKS_24559 = 24559;
public static final int GATE_24560 = 24560; public static final int GATE_24560 = 24560;
public static final int GATE_24561 = 24561; public static final int GATE_24561 = 24561;
public static final int GAP_24562 = 24562; public static final int GAP_24562 = 24562;
@@ -13892,14 +13889,11 @@ public final class ObjectID
public static final int CHEST_26193 = 26193; public static final int CHEST_26193 = 26193;
public static final int LEVER_26194 = 26194; public static final int LEVER_26194 = 26194;
public static final int BIRTHDAY_CAKE = 26198; public static final int BIRTHDAY_CAKE = 26198;
public static final int BIRTHDAY_CAKE_26199 = 26199; public static final int GRINDER = 26199;
public static final int BIRTHDAY_CAKE_26200 = 26200;
public static final int TABLE_26201 = 26201; public static final int TABLE_26201 = 26201;
public static final int TABLE_26202 = 26202; public static final int TABLE_26202 = 26202;
public static final int TABLE_26203 = 26203; public static final int TABLE_26203 = 26203;
public static final int PRESENT = 26204; public static final int DOOR_26205 = 26205;
public static final int PRESENT_26205 = 26205;
public static final int TABLE_26206 = 26206;
public static final int LARGE_DOOR_26207 = 26207; public static final int LARGE_DOOR_26207 = 26207;
public static final int WOODEN_BENCH_26210 = 26210; public static final int WOODEN_BENCH_26210 = 26210;
public static final int OAK_BENCH_26211 = 26211; public static final int OAK_BENCH_26211 = 26211;
@@ -17884,12 +17878,12 @@ public final class ObjectID
public static final int POTATO_CACTUS_33746 = 33746; public static final int POTATO_CACTUS_33746 = 33746;
public static final int POTATO_CACTUS_33747 = 33747; public static final int POTATO_CACTUS_33747 = 33747;
public static final int POTATO_CACTUS_33748 = 33748; public static final int POTATO_CACTUS_33748 = 33748;
public static final int DISEASED_POATO_CACTUS = 33749; public static final int DISEASED_POTATO_CACTUS = 33749;
public static final int DISEASED_POATO_CACTUS_33750 = 33750; public static final int DISEASED_POTATO_CACTUS_33750 = 33750;
public static final int DISEASED_POATO_CACTUS_33751 = 33751; public static final int DISEASED_POTATO_CACTUS_33751 = 33751;
public static final int DISEASED_POATO_CACTUS_33752 = 33752; public static final int DISEASED_POTATO_CACTUS_33752 = 33752;
public static final int DISEASED_POATO_CACTUS_33753 = 33753; public static final int DISEASED_POTATO_CACTUS_33753 = 33753;
public static final int DISEASED_POATO_CACTUS_33754 = 33754; public static final int DISEASED_POTATO_CACTUS_33754 = 33754;
public static final int DEAD_POTATO_CACTUS = 33755; public static final int DEAD_POTATO_CACTUS = 33755;
public static final int DEAD_POTATO_CACTUS_33756 = 33756; public static final int DEAD_POTATO_CACTUS_33756 = 33756;
public static final int DEAD_POTATO_CACTUS_33757 = 33757; public static final int DEAD_POTATO_CACTUS_33757 = 33757;
@@ -18545,10 +18539,31 @@ public final class ObjectID
public static final int ALCHEMICAL_TOPIARY = 34654; public static final int ALCHEMICAL_TOPIARY = 34654;
public static final int MYSTERIOUS_PIPE = 34655; public static final int MYSTERIOUS_PIPE = 34655;
public static final int CHEMICAL_WASTE_PIPE = 34656; public static final int CHEMICAL_WASTE_PIPE = 34656;
public static final int GANGPLANK_34657 = 34657;
public static final int GANGPLANK_34658 = 34658;
public static final int THE_SHEARED_RAM = 34659; public static final int THE_SHEARED_RAM = 34659;
public static final int BRIMSTONE_CHEST = 34660; public static final int BRIMSTONE_CHEST = 34660;
public static final int BRIMSTONE_CHEST_34661 = 34661; public static final int BRIMSTONE_CHEST_34661 = 34661;
public static final int RUBBLE_34663 = 34663;
public static final int RUBBLE_34664 = 34664;
public static final int RUBBLE_34665 = 34665;
public static final int RUBBLE_34666 = 34666;
public static final int GANGPLANK_34667 = 34667;
public static final int GANGPLANK_34668 = 34668;
public static final int GANGPLANK_34669 = 34669;
public static final int GANGPLANK_34670 = 34670;
public static final int GANGPLANK_34671 = 34671;
public static final int GANGPLANK_34672 = 34672;
public static final int VERZIK_VITUR_DISPLAY = 34677;
public static final int MAKING_FRIENDS_WITH_MY_ARM_DISPLAY = 34681;
public static final int FIRE_34682 = 34682;
public static final int MAGIC_MIRROR = 34683;
public static final int ALCHEMICAL_HYDRA_DISPLAY_34684 = 34684;
public static final int ATTAS_PLANT_DISPLAY = 34685;
public static final int LEATHER_SHIELDS = 34686;
public static final int BRYOPHYTA_DISPLAY = 34687;
public static final int BANNER_34688 = 34688;
public static final int BLOOMING_HESPORI_SPROUT = 34705;
public static final int SHRIVELLED_PLANT = 34706;
public static final int TWISTED_BUSH = 34712;
public static final int DUNGEON_ENTRANCE_34713 = 34713;
/* This file is automatically generated. Do not edit. */ /* This file is automatically generated. Do not edit. */
} }
@@ -379,7 +379,7 @@ public class Perspective
@Nullable String text, @Nullable String text,
int zOffset) int zOffset)
{ {
if (text == null || "".equals(text)) if (text == null)
{ {
return null; return null;
} }
@@ -45,6 +45,29 @@ public final class ScriptID
*/ */
public static final int CHATBOX_INPUT = 96; public static final int CHATBOX_INPUT = 96;
/**
* Rebuilds the chatbox
*/
public static final int BUILD_CHATBOX = 216;
/**
* Opens the Private Message chat interface
*
* Jagex refers to this script as {@code meslayer_mode6}
* <ul>
* <li> String Player to send private message to</li>
* </ul>
*/
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
/**
* Rebuilds the text input widget inside the chat interface
* <ul>
* <li> String Message Prefix. Only used inside the GE search interfaces
* </ul>
*/
public static final int CHAT_TEXT_INPUT_REBUILD = 222;
/** /**
* Layouts the bank widgets * Layouts the bank widgets
* *
@@ -93,15 +116,6 @@ public final class ScriptID
*/ */
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523; public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
/**
* Initializes the chatbox input to use RuneLite callbacks
* <ul>
* <li> String Prompt text </li>
* <li> String Default value </li>
* </ul>
*/
public static final int RUNELITE_CHATBOX_INPUT_INIT = 10001;
/** /**
* Does nothing * Does nothing
* *
@@ -1172,7 +1172,7 @@ public final class SpriteID
public static final int MINIMAP_ORB_XP_ACTIVATED = 1197; public static final int MINIMAP_ORB_XP_ACTIVATED = 1197;
public static final int MINIMAP_ORB_XP_HOVERED = 1198; public static final int MINIMAP_ORB_XP_HOVERED = 1198;
public static final int MINIMAP_ORB_XP_ACTIVATED_HOVERED = 1199; public static final int MINIMAP_ORB_XP_ACTIVATED_HOVERED = 1199;
public static final int UNKNOWN_BLACK_BLOBS = 1200; public static final int MINIMAP_CLICK_MASK = 1200;
public static final int OPTIONS_ZOOM_SLIDER_THUMB = 1201; public static final int OPTIONS_ZOOM_SLIDER_THUMB = 1201;
public static final int EMOTE_SIT_UP = 1202; public static final int EMOTE_SIT_UP = 1202;
public static final int EMOTE_STAR_JUMP = 1203; public static final int EMOTE_STAR_JUMP = 1203;

Some files were not shown because too many files have changed in this diff Show More