Skip to content

Commit 84c5d12

Browse files
committed
refactor: move statics from RSRuntimeException
1 parent dfe9b24 commit 84c5d12

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

src/main/java/org/runejs/client/Game.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,8 @@ else if(x > 764)
13151315
MovedStatics.crossType = 0;
13161316
}
13171317
if(GameInterface.atInventoryInterfaceType != 0) {
1318-
RSRuntimeException.anInt1651++;
1319-
if(RSRuntimeException.anInt1651 >= 15) {
1318+
GameInterface.anInt1651++;
1319+
if(GameInterface.anInt1651 >= 15) {
13201320
if(GameInterface.atInventoryInterfaceType == 2)
13211321
GameInterface.redrawTabArea = true;
13221322
if(GameInterface.atInventoryInterfaceType == 3)
@@ -1336,9 +1336,9 @@ else if(x > 764)
13361336
GameInterface.redrawTabArea = true;
13371337
GameInterface.activeInterfaceType = 0;
13381338
if(MovedStatics.lastItemDragged && Buffer.lastItemDragTime >= 5) {
1339-
RSRuntimeException.lastActiveInvInterface = -1;
1339+
GameInterface.lastActiveInvInterface = -1;
13401340
MovedStatics.processRightClick();
1341-
if(RSRuntimeException.lastActiveInvInterface == GameInterface.modifiedWidgetId && mouseInvInterfaceIndex != GameInterface.selectedInventorySlot) {
1341+
if(GameInterface.lastActiveInvInterface == GameInterface.modifiedWidgetId && mouseInvInterfaceIndex != GameInterface.selectedInventorySlot) {
13421342
GameInterface childInterface = GameInterface.getInterface(GameInterface.modifiedWidgetId);
13431343
int moveItemInsertionMode = 0;
13441344
if(MovedStatics.bankInsertMode == 1 && childInterface.contentType == 206)
@@ -1382,7 +1382,7 @@ else if(x > 764)
13821382
else if(MovedStatics.menuActionRow > 0)
13831383
GameInterface.processMenuActions(MovedStatics.menuActionRow - 1);
13841384
}
1385-
RSRuntimeException.anInt1651 = 10;
1385+
GameInterface.anInt1651 = 10;
13861386
MouseHandler.clickType = 0;
13871387
}
13881388
}

src/main/java/org/runejs/client/Landscape.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static void loadRegion() {
246246
MovedStatics.processGameStatus(30);
247247
method973();
248248
OutgoingPackets.buffer.putPacket(178);
249-
RSRuntimeException.method1057(126);
249+
MovedStatics.method1057();
250250
} else
251251
MovedStatics.anInt1634 = 2;
252252
} else

src/main/java/org/runejs/client/MovedStatics.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ public static void handleInterfaceActions(GameInterfaceArea area, int mouseX, in
10411041
i_8_ += gameInterface.imageX[i_4_];
10421042
}
10431043
if(mouseX >= i_7_ && i_8_ <= mouseY && i_7_ + 32 > mouseX && mouseY < 32 + i_8_) {
1044-
RSRuntimeException.lastActiveInvInterface = gameInterface.id;
1044+
GameInterface.lastActiveInvInterface = gameInterface.id;
10451045
Game.mouseInvInterfaceIndex = i_4_;
10461046
if(gameInterface.items[i_4_] > 0) {
10471047
ItemDefinition itemDefinition = ItemDefinition.forId(-1 + gameInterface.items[i_4_], 10);
@@ -3276,4 +3276,13 @@ public static void processMenuClick() {
32763276
determineMenuSize();
32773277
}
32783278
}
3279+
3280+
public static void method1057() {
3281+
SceneCluster.gameTimer.reset();
3282+
for(int i = 0; i < 32; i++)
3283+
GameShell.tickSamples[i] = 0L;
3284+
for(int i = 0; i < 32; i++)
3285+
tickSamples[i] = 0L;
3286+
ticksPerLoop = 0;
3287+
}
32793288
}
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
package org.runejs.client;
22

3-
import org.runejs.client.scene.SceneCluster;
4-
53
public class RSRuntimeException extends RuntimeException {
6-
public static int lastActiveInvInterface = 0;
7-
public static int anInt1651 = 0;
84
public Throwable aThrowable1652;
95
public String aString1653;
106

117
public RSRuntimeException(Throwable arg0, String arg1) {
128
aString1653 = arg1;
139
aThrowable1652 = arg0;
1410
}
15-
16-
public static void method1057(int arg0) {
17-
SceneCluster.gameTimer.reset();
18-
for(int i = 0; i < 32; i++)
19-
GameShell.tickSamples[i] = 0L;
20-
for(int i = 0; i < 32; i++)
21-
MovedStatics.tickSamples[i] = 0L;
22-
if(arg0 <= 67)
23-
lastActiveInvInterface = -3;
24-
MovedStatics.ticksPerLoop = 0;
25-
}
2611
}

src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ public class GameInterface extends CachedNode {
9393
public static int activeInterfaceType = 0;
9494
public static int modifiedWidgetId = 0;
9595
public static int walkableWidgetId = -1;
96+
public static int lastActiveInvInterface = 0;
97+
/**
98+
* Some kind of timer for item-on-widget clicks (e.g. triggered when taking items from bank)
99+
*/
100+
public static int anInt1651 = 0;
96101
/**
97102
* The lightened edge (top and left) color of the scroll indicator chip.
98103
*/
@@ -609,7 +614,7 @@ public static void processMenuActions(int arg1) {
609614

610615
atInventoryInterfaceType = 2;
611616
anInt1233 = i;
612-
RSRuntimeException.anInt1651 = 0;
617+
anInt1651 = 0;
613618
if(gameScreenInterfaceId == i_10_ >> 16) {
614619
atInventoryInterfaceType = 1;
615620
}
@@ -732,7 +737,7 @@ public static void processMenuActions(int arg1) {
732737
);
733738

734739
anInt704 = i_10_;
735-
RSRuntimeException.anInt1651 = 0;
740+
anInt1651 = 0;
736741
anInt1233 = i;
737742
atInventoryInterfaceType = 2;
738743
if(i_10_ >> 16 == gameScreenInterfaceId) {
@@ -758,7 +763,7 @@ public static void processMenuActions(int arg1) {
758763

759764
anInt1233 = i;
760765
atInventoryInterfaceType = 2;
761-
RSRuntimeException.anInt1651 = 0;
766+
anInt1651 = 0;
762767
anInt704 = i_10_;
763768
if(i_10_ >> 16 == gameScreenInterfaceId) {
764769
atInventoryInterfaceType = 1;
@@ -799,7 +804,7 @@ public static void processMenuActions(int arg1) {
799804

800805
anInt1233 = i;
801806
anInt704 = i_10_;
802-
RSRuntimeException.anInt1651 = 0;
807+
anInt1651 = 0;
803808
atInventoryInterfaceType = 2;
804809
if(i_10_ >> 16 == gameScreenInterfaceId) {
805810
atInventoryInterfaceType = 1;
@@ -936,7 +941,7 @@ public static void processMenuActions(int arg1) {
936941
if(chatboxInterfaceId == i_10_ >> 16) {
937942
atInventoryInterfaceType = 3;
938943
}
939-
RSRuntimeException.anInt1651 = 0;
944+
anInt1651 = 0;
940945
}
941946
if(action == ActionRowType.MESSAGE_FRIEND.getId()) {
942947
String class1 = MovedStatics.menuActionTexts[arg1];
@@ -1085,7 +1090,7 @@ public static void processMenuActions(int arg1) {
10851090
);
10861091

10871092
anInt704 = i_10_;
1088-
RSRuntimeException.anInt1651 = 0;
1093+
anInt1651 = 0;
10891094
anInt1233 = i;
10901095
atInventoryInterfaceType = 2;
10911096
if(gameScreenInterfaceId == i_10_ >> 16) {
@@ -1151,7 +1156,7 @@ public static void processMenuActions(int arg1) {
11511156
anInt1233 = i;
11521157
atInventoryInterfaceType = 2;
11531158
anInt704 = i_10_;
1154-
RSRuntimeException.anInt1651 = 0;
1159+
anInt1651 = 0;
11551160
if(gameScreenInterfaceId == i_10_ >> 16) {
11561161
atInventoryInterfaceType = 1;
11571162
}
@@ -1266,7 +1271,7 @@ public static void processMenuActions(int arg1) {
12661271
ChatBox.addChatMessage("", gameInterface.itemAmounts[i] + Native.amountSeparatorX + ItemDefinition.forId(npcIdx, 10).name, 0);
12671272
}
12681273
anInt1233 = i;
1269-
RSRuntimeException.anInt1651 = 0;
1274+
anInt1651 = 0;
12701275
anInt704 = i_10_;
12711276
atInventoryInterfaceType = 2;
12721277
if(i_10_ >> 16 == gameScreenInterfaceId) {
@@ -1324,7 +1329,7 @@ public static void processMenuActions(int arg1) {
13241329
)
13251330
);
13261331

1327-
RSRuntimeException.anInt1651 = 0;
1332+
anInt1651 = 0;
13281333
atInventoryInterfaceType = 2;
13291334
if(gameScreenInterfaceId == i_10_ >> 16) {
13301335
atInventoryInterfaceType = 1;
@@ -1355,7 +1360,7 @@ public static void processMenuActions(int arg1) {
13551360
if(i_10_ >> 16 == chatboxInterfaceId) {
13561361
atInventoryInterfaceType = 3;
13571362
}
1358-
RSRuntimeException.anInt1651 = 0;
1363+
anInt1651 = 0;
13591364
}
13601365
if(action == ActionRowType.INTERACT_WITH_PLAYER_OPTION_5.getId()) {
13611366
Player otherPlayer = Player.trackedPlayers[npcIdx];
@@ -1422,7 +1427,7 @@ public static void processMenuActions(int arg1) {
14221427
)
14231428
);
14241429

1425-
RSRuntimeException.anInt1651 = 0;
1430+
anInt1651 = 0;
14261431
atInventoryInterfaceType = 2;
14271432
if(gameScreenInterfaceId == i_10_ >> 16) {
14281433
atInventoryInterfaceType = 1;
@@ -1476,7 +1481,7 @@ public static void processMenuActions(int arg1) {
14761481
);
14771482

14781483
anInt704 = i_10_;
1479-
RSRuntimeException.anInt1651 = 0;
1484+
anInt1651 = 0;
14801485
anInt1233 = i;
14811486
atInventoryInterfaceType = 2;
14821487
if(gameScreenInterfaceId == i_10_ >> 16) {
@@ -1550,7 +1555,7 @@ public static void processMenuActions(int arg1) {
15501555
);
15511556

15521557
anInt1233 = i;
1553-
RSRuntimeException.anInt1651 = 0;
1558+
anInt1651 = 0;
15541559
atInventoryInterfaceType = 2;
15551560
anInt704 = i_10_;
15561561
if(i_10_ >> 16 == gameScreenInterfaceId) {

0 commit comments

Comments
 (0)