···
17
17
game:
18
18
roofsEnabled: true
19
19
freeTeleports: true
20
20
+
debugContext: true
···
9
9
import java.net.MalformedURLException;
10
10
import java.net.Socket;
11
11
import java.net.URL;
12
12
+
import java.text.MessageFormat;
12
13
import java.util.Calendar;
13
14
import java.util.Date;
14
15
import java.util.zip.CRC32;
···
496
497
private int menuScreenArea;
497
498
private int menuOffsetX;
498
499
private int menuOffsetY;
499
499
-
private int anInt1307;
500
500
-
private int anInt1308;
500
500
+
private int menuWidth;
501
501
+
private int menuHeight;
501
502
private static int drawCycle;
502
503
private int[] anIntArray1310;
503
504
private int[] anIntArray1311;
···
3662
3663
opcode = -1;
3663
3664
for (int j = 0; j < Model.resourceCount; j++) {
3664
3665
int k = Model.anIntArray1709[j];
3665
3665
-
int l = k & 0x7f;
3666
3666
-
int i1 = k >> 7 & 0x7f;
3666
3666
+
int x = k & 0x7f;
3667
3667
+
int y = k >> 7 & 0x7f;
3667
3668
int j1 = k >> 29 & 3;
3668
3669
int k1 = k >> 14 & 0x7fff;
3669
3670
if (k == i)
3670
3671
continue;
3671
3672
i = k;
3672
3672
-
if (j1 == 2 && currentScene.method271(plane, l, i1, k) >= 0) {
3673
3673
-
GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(k1);
3674
3674
-
if (gameObjectDefinition.childrenIds != null)
3675
3675
-
gameObjectDefinition = gameObjectDefinition.getChildDefinition();
3676
3676
-
if (gameObjectDefinition == null)
3673
3673
+
if (j1 == 2 && currentScene.method271(plane, x, y, k) >= 0) {
3674
3674
+
GameObjectDefinition gameObject = GameObjectDefinition.getDefinition(k1);
3675
3675
+
if (gameObject.childrenIds != null)
3676
3676
+
gameObject = gameObject.getChildDefinition();
3677
3677
+
if (gameObject == null)
3677
3678
continue;
3678
3679
if (itemSelected == 1) {
3679
3679
-
menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @cya@" + gameObjectDefinition.name;
3680
3680
+
menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @cya@" + gameObject.name;
3680
3681
menuActionTypes[menuActionRow] = 467;
3681
3682
selectedMenuActions[menuActionRow] = k;
3682
3682
-
firstMenuOperand[menuActionRow] = l;
3683
3683
-
secondMenuOperand[menuActionRow] = i1;
3683
3683
+
firstMenuOperand[menuActionRow] = x;
3684
3684
+
secondMenuOperand[menuActionRow] = y;
3684
3685
menuActionRow++;
3685
3686
} else if (widgetSelected == 1) {
3686
3687
if ((anInt1173 & 4) == 4) {
3687
3687
-
menuActionTexts[menuActionRow] = selectedWidgetName + " @cya@" + gameObjectDefinition.name;
3688
3688
+
menuActionTexts[menuActionRow] = selectedWidgetName + " @cya@" + gameObject.name;
3688
3689
menuActionTypes[menuActionRow] = 376;
3689
3690
selectedMenuActions[menuActionRow] = k;
3690
3690
-
firstMenuOperand[menuActionRow] = l;
3691
3691
-
secondMenuOperand[menuActionRow] = i1;
3691
3691
+
firstMenuOperand[menuActionRow] = x;
3692
3692
+
secondMenuOperand[menuActionRow] = y;
3692
3693
menuActionRow++;
3693
3694
}
3694
3695
} else {
3695
3695
-
if (gameObjectDefinition.options != null) {
3696
3696
+
if (gameObject.options != null) {
3696
3697
for (int l1 = 4; l1 >= 0; l1--)
3697
3697
-
if (gameObjectDefinition.options[l1] != null) {
3698
3698
-
menuActionTexts[menuActionRow] = gameObjectDefinition.options[l1] + " @cya@"
3699
3699
-
+ gameObjectDefinition.name;
3698
3698
+
if (gameObject.options[l1] != null) {
3699
3699
+
menuActionTexts[menuActionRow] = gameObject.options[l1] + " @cya@"
3700
3700
+
+ gameObject.name;
3700
3701
if (l1 == 0)
3701
3702
menuActionTypes[menuActionRow] = 35; // packet 181
3702
3703
if (l1 == 1)
···
3708
3709
if (l1 == 4)
3709
3710
menuActionTypes[menuActionRow] = 1280; // packet 55
3710
3711
selectedMenuActions[menuActionRow] = k;
3711
3711
-
firstMenuOperand[menuActionRow] = l;
3712
3712
-
secondMenuOperand[menuActionRow] = i1;
3712
3712
+
firstMenuOperand[menuActionRow] = x;
3713
3713
+
secondMenuOperand[menuActionRow] = y;
3713
3714
menuActionRow++;
3714
3715
}
3715
3716
3716
3717
}
3717
3717
-
menuActionTexts[menuActionRow] = "Examine @cya@" + gameObjectDefinition.name;
3718
3718
+
StringBuilder examineText = new StringBuilder();
3719
3719
+
examineText.append(MessageFormat.format("Examine <col=00ffff>{0}</col>", gameObject.name));
3720
3720
+
if (DEBUG_CONTEXT) {
3721
3721
+
examineText.append(" <col=00ff00>(</col>");
3722
3722
+
examineText.append(
3723
3723
+
MessageFormat.format("<col=ffffff>{0}</col>",
3724
3724
+
Integer.toString(gameObject.id)
3725
3725
+
)
3726
3726
+
);
3727
3727
+
examineText.append("<col=00ff00>) (</col>");
3728
3728
+
examineText.append(
3729
3729
+
MessageFormat.format("<col=ffffff>{0}, {1}</col>",
3730
3730
+
Integer.toString(x + nextTopLeftTileX),
3731
3731
+
Integer.toString(y + nextTopRightTileY)
3732
3732
+
)
3733
3733
+
);
3734
3734
+
examineText.append("<col=00ff00>)</col>");
3735
3735
+
3736
3736
+
3737
3737
+
}
3738
3738
+
menuActionTexts[menuActionRow] = examineText.toString();
3718
3739
menuActionTypes[menuActionRow] = 1412;
3719
3719
-
selectedMenuActions[menuActionRow] = gameObjectDefinition.id << 14;
3720
3720
-
firstMenuOperand[menuActionRow] = l;
3721
3721
-
secondMenuOperand[menuActionRow] = i1;
3740
3740
+
selectedMenuActions[menuActionRow] = gameObject.id << 14;
3741
3741
+
firstMenuOperand[menuActionRow] = x;
3742
3742
+
secondMenuOperand[menuActionRow] = y;
3722
3743
menuActionRow++;
3723
3744
}
3724
3745
}
···
3734
3755
&& npc1.npcDefinition.boundaryDimension == 1
3735
3756
&& npc1.worldX == npc.worldX
3736
3757
&& npc1.worldY == npc.worldY)
3737
3737
-
method82(npc1.npcDefinition, i1, l, npcIds[i2]);
3758
3758
+
method82(npc1.npcDefinition, y, x, npcIds[i2]);
3738
3759
}
3739
3760
3740
3761
for (int k2 = 0; k2 < localPlayerCount; k2++) {
···
3742
3763
if (player != null
3743
3764
&& player.worldX == npc.worldX
3744
3765
&& player.worldY == npc.worldY)
3745
3745
-
method38(playerList[k2], i1, l, player);
3766
3766
+
method38(playerList[k2], y, x, player);
3746
3767
}
3747
3768
3748
3769
}
3749
3749
-
method82(npc.npcDefinition, i1, l, k1);
3770
3770
+
method82(npc.npcDefinition, y, x, k1);
3750
3771
}
3751
3772
if (j1 == 0) {
3752
3773
Player player1 = players[k1];
···
3758
3779
&& npc.npcDefinition.boundaryDimension == 1
3759
3780
&& npc.worldX == player1.worldX
3760
3781
&& npc.worldY == player1.worldY)
3761
3761
-
method82(npc.npcDefinition, i1, l, npcIds[j2]);
3782
3782
+
method82(npc.npcDefinition, y, x, npcIds[j2]);
3762
3783
}
3763
3784
3764
3785
for (int l2 = 0; l2 < localPlayerCount; l2++) {
···
3767
3788
&& player != player1
3768
3789
&& player.worldX == player1.worldX
3769
3790
&& player.worldY == player1.worldY)
3770
3770
-
method38(playerList[l2], i1, l, player);
3791
3791
+
method38(playerList[l2], y, x, player);
3771
3792
}
3772
3793
3773
3794
}
3774
3774
-
method38(k1, i1, l, player1);
3795
3795
+
method38(k1, y, x, player1);
3775
3796
}
3776
3797
if (j1 == 3) {
3777
3777
-
LinkedList itemList = groundItems.getTile(plane, l, i1);
3798
3798
+
LinkedList itemList = groundItems.getTile(plane, x, y);
3778
3799
if (itemList != null) {
3779
3800
for (Item item = (Item) itemList.last(); item != null; item = (Item) itemList
3780
3801
.previous()) {
···
3783
3804
menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDefinition.name;
3784
3805
menuActionTypes[menuActionRow] = 100;
3785
3806
selectedMenuActions[menuActionRow] = item.itemId;
3786
3786
-
firstMenuOperand[menuActionRow] = l;
3787
3787
-
secondMenuOperand[menuActionRow] = i1;
3807
3807
+
firstMenuOperand[menuActionRow] = x;
3808
3808
+
secondMenuOperand[menuActionRow] = y;
3788
3809
menuActionRow++;
3789
3810
} else if (widgetSelected == 1) {
3790
3811
if ((anInt1173 & 1) == 1) {
3791
3812
menuActionTexts[menuActionRow] = selectedWidgetName + " @lre@" + itemDefinition.name;
3792
3813
menuActionTypes[menuActionRow] = 199;
3793
3814
selectedMenuActions[menuActionRow] = item.itemId;
3794
3794
-
firstMenuOperand[menuActionRow] = l;
3795
3795
-
secondMenuOperand[menuActionRow] = i1;
3815
3815
+
firstMenuOperand[menuActionRow] = x;
3816
3816
+
secondMenuOperand[menuActionRow] = y;
3796
3817
menuActionRow++;
3797
3818
}
3798
3819
} else {
···
3810
3831
if (i3 == 4)
3811
3832
menuActionTypes[menuActionRow] = 270;
3812
3833
selectedMenuActions[menuActionRow] = item.itemId;
3813
3813
-
firstMenuOperand[menuActionRow] = l;
3814
3814
-
secondMenuOperand[menuActionRow] = i1;
3834
3834
+
firstMenuOperand[menuActionRow] = x;
3835
3835
+
secondMenuOperand[menuActionRow] = y;
3815
3836
menuActionRow++;
3816
3837
} else if (i3 == 2) {
3817
3838
menuActionTexts[menuActionRow] = "Take @lre@" + itemDefinition.name;
3818
3839
menuActionTypes[menuActionRow] = 684;
3819
3840
selectedMenuActions[menuActionRow] = item.itemId;
3820
3820
-
firstMenuOperand[menuActionRow] = l;
3821
3821
-
secondMenuOperand[menuActionRow] = i1;
3841
3841
+
firstMenuOperand[menuActionRow] = x;
3842
3842
+
secondMenuOperand[menuActionRow] = y;
3822
3843
menuActionRow++;
3823
3844
}
3824
3824
-
3825
3825
-
menuActionTexts[menuActionRow] = "Examine @lre@" + itemDefinition.name;
3845
3845
+
StringBuilder examineText = new StringBuilder();
3846
3846
+
examineText.append(MessageFormat.format("Examine <col=ff9040>{0}</col>", itemDefinition.name));
3847
3847
+
if (DEBUG_CONTEXT) {
3848
3848
+
examineText.append(" <col=00ff00>(</col>");
3849
3849
+
examineText.append(
3850
3850
+
MessageFormat.format("<col=ffffff>{0}</col>",
3851
3851
+
Integer.toString(itemDefinition.id)
3852
3852
+
)
3853
3853
+
);
3854
3854
+
examineText.append("<col=00ff00>)</col>");
3855
3855
+
}
3856
3856
+
menuActionTexts[menuActionRow] = examineText.toString();
3826
3857
menuActionTypes[menuActionRow] = 1564;
3827
3858
selectedMenuActions[menuActionRow] = item.itemId;
3828
3828
-
firstMenuOperand[menuActionRow] = l;
3829
3829
-
secondMenuOperand[menuActionRow] = i1;
3859
3859
+
firstMenuOperand[menuActionRow] = x;
3860
3860
+
secondMenuOperand[menuActionRow] = y;
3830
3861
menuActionRow++;
3831
3862
}
3832
3863
}
···
4150
4181
x -= 17;
4151
4182
y -= 357;
4152
4183
}
4153
4153
-
if (x < menuOffsetX - 10 || x > menuOffsetX + anInt1307 + 10 || y < menuOffsetY - 10
4154
4154
-
|| y > menuOffsetY + anInt1308 + 10) {
4184
4184
+
if (x < menuOffsetX - 10 || x > menuOffsetX + menuWidth + 10 || y < menuOffsetY - 10
4185
4185
+
|| y > menuOffsetY + menuHeight + 10) {
4155
4186
menuOpen = false;
4156
4187
if (menuScreenArea == 1)
4157
4188
redrawTabArea = true;
···
4162
4193
if (meta == 1) {
4163
4194
int menuX = menuOffsetX;
4164
4195
int menuY = menuOffsetY;
4165
4165
-
int dx = anInt1307;
4196
4196
+
int dx = menuWidth;
4166
4197
int x = super.clickX;
4167
4198
int y = super.clickY;
4168
4199
if (menuScreenArea == 0) {
···
5536
5567
}
5537
5568
5538
5569
}
5539
5539
-
menuActionTexts[menuActionRow] = "Examine @lre@" + definition.name;
5570
5570
+
StringBuilder examineText = new StringBuilder();
5571
5571
+
examineText.append(MessageFormat.format("Examine <col=ff9040>{0}</col>", definition.name));
5572
5572
+
if (DEBUG_CONTEXT) {
5573
5573
+
examineText.append(" <col=00ff00>(</col>");
5574
5574
+
examineText.append(
5575
5575
+
MessageFormat.format("<col=ffffff>{0}</col>",
5576
5576
+
Integer.toString(definition.id)
5577
5577
+
)
5578
5578
+
);
5579
5579
+
examineText.append("<col=00ff00>)</col>");
5580
5580
+
}
5581
5581
+
menuActionTexts[menuActionRow] = examineText.toString();
5540
5582
menuActionTypes[menuActionRow] = Actions.EXAMINE_ITEM;
5541
5583
selectedMenuActions[menuActionRow] = definition.id;
5542
5584
firstMenuOperand[menuActionRow] = l2;
···
5943
5985
if (activeInterfaceType == 2)
5944
5986
redrawTabArea = true;
5945
5987
if (redrawTabArea) {
5946
5946
-
method134();
5988
5988
+
drawTabArea();
5947
5989
redrawTabArea = false;
5948
5990
}
5949
5991
if (openChatboxWidgetId == -1 && inputType == 0) {
···
6774
6816
return;
6775
6817
if (!actorDefinition.clickable)
6776
6818
return;
6777
6777
-
String s = actorDefinition.name;
6819
6819
+
String name = actorDefinition.name;
6778
6820
if (actorDefinition.combatLevel != 0)
6779
6779
-
s = s + getCombatLevelColour(localPlayer.combatLevel, actorDefinition.combatLevel) + " (level-" + actorDefinition.combatLevel + ")";
6821
6821
+
name = name + getCombatLevelColour(localPlayer.combatLevel, actorDefinition.combatLevel) + " (level-" + actorDefinition.combatLevel + ")";
6780
6822
if (itemSelected == 1) {
6781
6781
-
menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
6823
6823
+
menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @yel@" + name;
6782
6824
menuActionTypes[menuActionRow] = 347;
6783
6825
selectedMenuActions[menuActionRow] = k;
6784
6826
firstMenuOperand[menuActionRow] = j;
···
6788
6830
}
6789
6831
if (widgetSelected == 1) {
6790
6832
if ((anInt1173 & 2) == 2) {
6791
6791
-
menuActionTexts[menuActionRow] = selectedWidgetName + " @yel@" + s;
6833
6833
+
menuActionTexts[menuActionRow] = selectedWidgetName + " @yel@" + name;
6792
6834
menuActionTypes[menuActionRow] = 67;
6793
6835
selectedMenuActions[menuActionRow] = k;
6794
6836
firstMenuOperand[menuActionRow] = j;
···
6799
6841
if (actorDefinition.actions != null) {
6800
6842
for (int l = 4; l >= 0; l--)
6801
6843
if (actorDefinition.actions[l] != null && !actorDefinition.actions[l].equalsIgnoreCase("attack")) {
6802
6802
-
menuActionTexts[menuActionRow] = actorDefinition.actions[l] + " @yel@" + s;
6844
6844
+
menuActionTexts[menuActionRow] = actorDefinition.actions[l] + " @yel@" + name;
6803
6845
if (l == 0)
6804
6846
menuActionTypes[menuActionRow] = 318; // packet 112
6805
6847
if (l == 1)
···
6823
6865
char c = '\0';
6824
6866
if (actorDefinition.combatLevel > localPlayer.combatLevel)
6825
6867
c = '\u07D0';
6826
6826
-
menuActionTexts[menuActionRow] = actorDefinition.actions[i1] + " @yel@" + s;
6868
6868
+
menuActionTexts[menuActionRow] = actorDefinition.actions[i1] + " @yel@" + name;
6827
6869
if (i1 == 0)
6828
6870
menuActionTypes[menuActionRow] = 318 + c;
6829
6871
if (i1 == 1)
···
6841
6883
}
6842
6884
6843
6885
}
6844
6844
-
menuActionTexts[menuActionRow] = "Examine @yel@" + s;
6886
6886
+
StringBuilder examineText = new StringBuilder();
6887
6887
+
examineText.append(MessageFormat.format("Examine <col=ffff00>{0}</col>", name));
6888
6888
+
if (DEBUG_CONTEXT) {
6889
6889
+
examineText.append(" <col=00ff00>(</col>");
6890
6890
+
examineText.append(
6891
6891
+
MessageFormat.format("<col=ffffff>{0}</col>",
6892
6892
+
Long.toString(actorDefinition.id)
6893
6893
+
)
6894
6894
+
);
6895
6895
+
examineText.append("<col=00ff00>)</col>");
6896
6896
+
}
6897
6897
+
menuActionTexts[menuActionRow] = examineText.toString();
6845
6898
menuActionTypes[menuActionRow] = 1668;
6846
6899
selectedMenuActions[menuActionRow] = k;
6847
6900
firstMenuOperand[menuActionRow] = j;
···
8318
8371
menuScreenArea = 0;
8319
8372
menuOffsetX = x;
8320
8373
menuOffsetY = y;
8321
8321
-
anInt1307 = width;
8322
8322
-
anInt1308 = height + 1;
8374
8374
+
menuWidth = width;
8375
8375
+
menuHeight = height + 1;
8323
8376
}
8324
8377
8325
8378
if (super.clickX > 553 && super.clickY > 205 && super.clickX < 743 && super.clickY < 466) {
···
8341
8394
menuScreenArea = 1;
8342
8395
menuOffsetX = x;
8343
8396
menuOffsetY = y;
8344
8344
-
anInt1307 = width;
8345
8345
-
anInt1308 = height + 1;
8397
8397
+
menuWidth = width;
8398
8398
+
menuHeight = height + 1;
8346
8399
}
8347
8400
8348
8401
if (super.clickX > 17 && super.clickY > 357 && super.clickX < 496 && super.clickY < 453) {
···
8364
8417
menuScreenArea = 2;
8365
8418
menuOffsetX = x;
8366
8419
menuOffsetY = y;
8367
8367
-
anInt1307 = width;
8368
8368
-
anInt1308 = height + 1;
8420
8420
+
menuWidth = width;
8421
8421
+
menuHeight = height + 1;
8369
8422
}
8370
8423
}
8371
8424
···
10144
10197
private void drawMenu() {
10145
10198
int offsetX = menuOffsetX;
10146
10199
int offsetY = menuOffsetY;
10147
10147
-
int width = anInt1307;
10148
10148
-
int height = anInt1308;
10200
10200
+
int width = menuWidth;
10201
10201
+
int height = menuHeight;
10149
10202
int colour = 0x5d5447;
10150
10150
-
Rasterizer.drawFilledRectangle(offsetX, offsetY, width, height, colour);
10203
10203
+
Rasterizer.drawFilledRectangleAlpha(offsetX, offsetY, width, height, colour, 120);
10151
10204
Rasterizer.drawFilledRectangle(offsetX + 1, offsetY + 1, width - 2, 16, 0);
10152
10205
Rasterizer.drawUnfilledRectangle(offsetX + 1, offsetY + 18, width - 2, height - 19, 0);
10153
10206
fontBold.drawString("Choose Option", offsetX + 3, offsetY + 14, colour);
···
10734
10787
}
10735
10788
}
10736
10789
10737
10737
-
private void method134() {
10790
10790
+
private void drawTabArea() {
10738
10791
tabImageProducer.createRasterizer();
10739
10792
Rasterizer3D.lineOffsets = sidebarOffsets;
10740
10793
inventoryBackgroundImage.drawImage(0, 0);
···
11084
11137
else
11085
11138
Rasterizer.drawUnfilledRectangle(k2, l2, child.width, child.height, j3);
11086
11139
} else if (child.filled)
11087
11087
-
Rasterizer.drawFilledRectangleAlhpa(k2, l2, child.width, child.height, j3,
11140
11140
+
Rasterizer.drawFilledRectangleAlpha(k2, l2, child.width, child.height, j3,
11088
11141
256 - (child.alpha & 0xff));
11089
11142
else
11090
11143
Rasterizer.drawUnfilledRectangleAlpha(k2, l2, child.width, child.height, j3,
···
122
122
}
123
123
124
124
public int getStringEffectWidth(String string) {
125
125
-
if (string == null)
126
126
-
return 0;
127
127
-
int width = 0;
128
128
-
for (int character = 0; character < string.length(); character++)
129
129
-
if (string.charAt(character) == '@' && character + 4 < string.length() && string.charAt(character + 4) == '@')
130
130
-
character += 4;
131
131
-
else
132
132
-
width += characterScreenWidths[string.charAt(character)];
133
133
-
134
134
-
return width;
125
125
+
return getDisplayedWidth(string);
135
126
}
136
127
137
128
public final int getDisplayedWidth(String string) {
···
349
340
if (code.equals("yel"))
350
341
return 0xffff00;
351
342
if (code.equals("cya"))
352
352
-
return 65535;
343
343
+
return 0x00ffff;
353
344
if (code.equals("mag"))
354
345
return 0xff00ff;
355
346
if (code.equals("whi"))
···
35
35
PASSWORD = (String) login.get("password");
36
36
ROOFS_ENABLED = (boolean) game.get("roofsEnabled");
37
37
FREE_TELEPORTS = (boolean) game.get("freeTeleports");
38
38
+
DEBUG_CONTEXT = (boolean) game.get("debugContextMenu");
38
39
39
40
if(USERNAME == null) {
40
41
USERNAME = "";
···
120
121
* Always light up teleports
121
122
*/
122
123
public static boolean FREE_TELEPORTS = true;
124
124
+
125
125
+
/**
126
126
+
* When rightclicking objects show id and location
127
127
+
*/
128
128
+
public static boolean DEBUG_CONTEXT = true;
123
129
124
130
125
131
}
···
74
74
75
75
}
76
76
77
77
-
public static void drawFilledRectangleAlhpa(int x, int y, int width, int height, int colour, int alpha) {
77
77
+
public static void drawFilledRectangleAlpha(int x, int y, int width, int height, int colour, int alpha) {
78
78
if (x < topX) {
79
79
width -= topX - x;
80
80
x = topX;