Skip to content

Commit 6bcf895

Browse files
committed
fix: read notes
- changed item colors to be client independent - resizable mm2ms projection improvements, still not perfect but should be on par with fixed mode now
1 parent 479f336 commit 6bcf895

File tree

11 files changed

+133
-189
lines changed

11 files changed

+133
-189
lines changed

osrs/finders/itemfinder.simba

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ begin
3838
align := tBorder.Last - border.Last;
3939
border := border.Offset(align);
4040

41-
color := TRSItem.Border;
42-
4341
for pt in border do
4442
begin
4543
if pt.Y <= 8 then
4644
Continue; //stack number... Don't compare.
4745
if not img.InImage(pt.X, pt.Y) then
4846
Exit;
49-
if img.Pixel[pt.X, pt.Y] <> color then
47+
if img.Pixel[pt.X, pt.Y] <> $010000 then
5048
Exit;
5149
end;
5250

@@ -59,11 +57,18 @@ var
5957
bounds: TBox;
6058
align: TPoint;
6159
begin
62-
tBorder := image.FindColor(TRSItem.Border, 0).ExcludeBox([0,0,image.Width,8]);
63-
bBorder := template.FindColor(TRSItem.Border, 0).ExcludeBox([0,0,template.Width,8]);
60+
tBorder := image.FindColor($010000, 0).ExcludeBox([0,0,image.Width,8]);
61+
bBorder := template.FindColor(ITEM_BORDER, 0).ExcludeBox([0,0,template.Width,8]);
62+
63+
if ITEM_BORDER <> $010000 then
64+
begin
65+
template.DrawColor := $010000;
66+
template.DrawTPA(bBorder);
67+
end;
6468

6569
if tBorder = [] then
6670
Exit;
71+
6772
if not Self._AlignHelper(image, tBorder, bBorder, align) then
6873
Exit;
6974

@@ -83,11 +88,11 @@ begin
8388

8489
template.DrawTPA(image.FindColor($0, 0));
8590

86-
tpa := image.FindColor(TRSItem.Shadow, 0);
91+
tpa := image.FindColor($202030, 0);
8792
for stack := Low(ERSStack) to High(ERSStack) do
8893
tpa += template.FindColor(stack.Color, 0);
8994

90-
tpa += template.FindColor(TRSItem.Border, 0);
95+
tpa += template.FindColor($010000, 0);
9196
image.DrawTPA(tpa);
9297
template.DrawTPA(tpa);
9398
end;
@@ -443,7 +448,7 @@ var
443448
tpa: TPointArray;
444449
border: TImage;
445450
begin
446-
tpa := img.FindColor(TRSItem.Border, 0, [0, 9, 35, 31]);
451+
tpa := img.FindColor(ITEM_BORDER, 0, [0, 9, 35, 31]);
447452
if tpa = [] then Exit;
448453
border := new TImage(36, 32);
449454
border.DrawColor := $FFFFFF;
@@ -460,11 +465,20 @@ begin
460465
hash := Self.GetBorderHash(img);
461466
if hash = '' then Exit;
462467

463-
bg := Self.GetMask(hash).FindColor($0, 0);
468+
bg := Self.GetMask(hash).FindColor(Colors.BLACK, 0);
464469

465-
img.DrawColor := $0;
470+
if ITEM_BORDER <> $010000 then
471+
begin
472+
img.DrawColor := $010000;
473+
img.DrawAlpha := $FF;
474+
img.DrawTPA(img.FindColor(ITEM_BORDER, 0));
475+
end;
476+
477+
img.DrawColor := Colors.BLACK;
466478
img.DrawTPA(bg);
479+
467480
Result := HashData(EHashAlgo.CRC32, img.Data, 4608);
481+
WriteLn Result;
468482
end;
469483

470484
var

osrs/interfaces/gametabs/achievements.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ Internal method used to count the available tabs on the {ref}`Achievements` game
378378
*)
379379
function TRSAchievements.CountTabs(): Integer;
380380
begin
381-
Result := Length(Target.FindColor(TRSItem.Border, 0, Self.TabsArea).Cluster(1.5));
381+
Result := Length(Target.FindColor(TRSInterface.Border, 0, Self.TabsArea).Cluster(1.5));
382382
end;
383383

384384
(*

osrs/interfaces/gametabs/inventory.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function TRSInventory.IsSelected(slot: TBox): Boolean;
126126
begin
127127
if not Self.Open() then Exit;
128128
slot.Y1 += 8;
129-
Result := Target.HasColor(TRSItem.BorderWhite, 1, 1, slot);
129+
Result := Target.HasColor(ITEM_BORDER_WHITE, 1, 1, slot);
130130
end;
131131

132132
function TRSInventory.IsSelected(slot: Integer): Boolean; overload;

osrs/interfaces/mainscreen/bank.simba

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ var
134134
b: TBox;
135135
stack: ERSStack;
136136
begin
137-
final := Target.FindColor(TRSItem.Border, 1, Self.SlotsArea);
137+
final := Target.FindColor(ITEM_BORDER, 1, Self.SlotsArea);
138138
if final = [] then Exit;
139139

140140
for stack := Low(ERSStack) to High(ERSStack) do
@@ -439,7 +439,7 @@ var
439439
i: Integer;
440440
begin
441441
for i := 9 downto 1 do
442-
if Target.HasColor(TRSItem.Border, 0, 1, Self.Tabs[i]) then
442+
if Target.HasColor(ITEM_BORDER, 0, 1, Self.Tabs[i]) then
443443
Exit(i);
444444
end;
445445

osrs/interfaces/mainscreen/depositbox.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var
3737
b: TBox;
3838
stack: ERSStack;
3939
begin
40-
final := Target.FindColor(TRSItem.Border, 1, Self.SlotsArea);
40+
final := Target.FindColor(ITEM_BORDER, 1, Self.SlotsArea);
4141
if final = [] then Exit;
4242

4343
for stack := Low(ERSStack) to High(ERSStack) do

osrs/interfaces/mainscreen/grandexchange/grandexchange_chat.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ begin
6969
if i = 0 then Exit;
7070
Continue;
7171
end;
72-
tpa += Target.FindColor(TRSItem.Border, 8.5, b);
72+
tpa += Target.FindColor(ITEM_BORDER, 8.5, b);
7373

7474
if tpa = [] then Continue;
7575

osrs/interfaces/mainscreen/grandexchange/grandexchange_offer.simba

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,8 @@ begin
812812
if not Self.IsOpen() then Exit;
813813
if Self.OfferInterface <> EGEOfferInterface.STATUS then Exit;
814814

815-
Result := Target.HasColor(TRSItem.Border, 0, 1, Self.CollectBounds.Left) or
816-
Target.HasColor(TRSItem.Border, 0, 1, Self.CollectBounds.Right);
815+
Result := Target.HasColor(ITEM_BORDER, 0, 1, Self.CollectBounds.Left) or
816+
Target.HasColor(ITEM_BORDER, 0, 1, Self.CollectBounds.Right);
817817
end;
818818

819819

@@ -836,10 +836,10 @@ begin
836836

837837
if not Self.HasItems() then Exit(True);
838838

839-
if Target.HasColor(TRSItem.Border, 0, 1, Self.CollectBounds.Left) then
839+
if Target.HasColor(ITEM_BORDER, 0, 1, Self.CollectBounds.Left) then
840840
Mouse.Click(Self.CollectBounds.Left, EMouseButton.LEFT);
841841

842-
if Target.HasColor(TRSItem.Border, 0, 1, Self.CollectBounds.Right) then
842+
if Target.HasColor(ITEM_BORDER, 0, 1, Self.CollectBounds.Right) then
843843
Mouse.Click(Self.CollectBounds.Right, EMouseButton.LEFT);
844844

845845
Result := SleepUntil(not Self.HasItems(), 200, 2000);

osrs/interfaces/mm2ms_projector.simba

Lines changed: 21 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,28 @@ real time, e.g.:
7272
{$I WaspLib/osrs.simba}
7373

7474
begin
75+
Map.Setup([Chunk(Box(44,58,46,56), 0)]);
7576
while True do
7677
begin
7778
Options.GetZoomLevel(False);
7879

79-
if Keyboard.IsKeyDown(EKeyCode.NUM_1) then
80-
MM2MS.Projector.ViewEye.X += 1;
80+
if Keyboard.IsKeyDown(EKeyCode.Q) then
81+
EYE_Y_RESIZABLE[Options.ZoomLevel] += 1;
8182

82-
if Keyboard.IsKeyDown(EKeyCode.NUM_2) then
83-
MM2MS.Projector.ViewEye.X -= 1;
83+
if Keyboard.IsKeyDown(EKeyCode.W) then
84+
EYE_Y_RESIZABLE[Options.ZoomLevel] -= 1;
8485

85-
//basically TMM2MSProjector.UpdateViewMatrix:
86-
MM2MS.Projector.ViewMatrix := TMatrix4.LookAtRH(
87-
MM2MS.Projector.ViewEye, MM2MS.Projector.ViewTarget, MM2MS.Projector.ViewUp
88-
);
86+
if Keyboard.IsKeyDown(EKeyCode.A) then
87+
EYE_Z_RESIZABLE[Options.ZoomLevel] += 1;
8988

90-
Minimap.DebugTiles();
89+
if Keyboard.IsKeyDown(EKeyCode.S) then
90+
EYE_Z_RESIZABLE[Options.ZoomLevel] -= 1;
91+
92+
WriteLn('EYE_Y_RESIZABLE: array [0..100] of Single = ' + ToStr(EYE_Y_RESIZABLE) + ';');
93+
WriteLn('EYE_Z_RESIZABLE: array [0..100] of Single = ' + ToStr(EYE_Z_RESIZABLE) + ';');
94+
95+
MM2MS.Projector.UpdateZoom(Options.ZoomLevel);
96+
Map.DebugHeight();
9197
end;
9298
end.
9399
```
@@ -96,88 +102,12 @@ end.
96102
```
97103
*)
98104

99-
const
100-
ZOOM2RSZOOM: array [0..100] of Single = [
101-
0.0000, 0.0025, 0.0065, 0.0100, 0.0130,
102-
0.0165, 0.0205, 0.0235, 0.0280, 0.0310,
103-
0.0350, 0.0390, 0.0430, 0.0430, 0.0465,
104-
0.0515, 0.0555, 0.0605, 0.0645, 0.0690,
105-
0.0740, 0.0785, 0.0835, 0.0885, 0.0935,
106-
0.0990, 0.1045, 0.1095, 0.1150, 0.1205,
107-
0.1260, 0.1325, 0.1385, 0.1455, 0.1505,
108-
0.1585, 0.1635, 0.1635, 0.1705, 0.1775,
109-
0.1845, 0.1925, 0.1995, 0.2055, 0.2145,
110-
0.2215, 0.2305, 0.2365, 0.2465, 0.2545,
111-
0.2635, 0.2725, 0.2825, 0.2905, 0.3005,
112-
0.3105, 0.3195, 0.3285, 0.3405, 0.3555,
113-
0.3615, 0.3705, 0.3825, 0.3825, 0.3945,
114-
0.4065, 0.4185, 0.4305, 0.4425, 0.4575,
115-
0.4695, 0.4815, 0.4980, 0.5115, 0.5265,
116-
0.5385, 0.5535, 0.5685, 0.5835, 0.5985,
117-
0.6165, 0.6315, 0.6495, 0.6645, 0.6825,
118-
0.7035, 0.7215, 0.7215, 0.7395, 0.7575,
119-
0.7815, 0.7995, 0.8175, 0.8355, 0.8595,
120-
0.8835, 0.9015, 0.9255, 0.9495, 0.9735,
121-
1.000
122-
];
123-
124-
EYE_Y_FIXED: array [0..100] of Single = [
125-
-29, -28, -28, -29, -28, -28, -28, -28, -28, -28,
126-
-28, -27, -28, -26, -26, -26, -26, -26, -26, -26,
127-
-26, -26, -26, -26, -26.5, -27, -27, -27, -27, -27,
128-
-27, -28, -27, -27, -27, -27, -27, -26, -26, -26,
129-
-25, -26, -26, -25, -25, -26, -25, -25, -25, -25.5,
130-
-26, -27, -27, -27, -25, -27, -26, -26, -25, -25,
131-
-26, -26, -26, -26, -25, -25, -25, -26, -25, -26,
132-
-26, -25, -25, -26, -25, -24, -26, -25, -24, -24,
133-
-26, -24, -24, -25, -26, -24, -25, -24, -25, -25,
134-
-25, -25, -25, -25, -26, -25, -25, -26, -25, -25,
135-
-25
136-
];
137-
138-
EYE_Z_FIXED: array [0..100] of Single = [
139-
58, 58, 58, 58, 58, 58, 59, 58, 59, 58,
140-
58, 58, 58, 57, 57, 57, 57, 57, 57, 57,
141-
57, 58, 57, 57, 57.5, 58, 58, 58, 58, 59,
142-
58, 58, 59, 58, 58, 59, 58, 57, 57, 57,
143-
57, 56, 58, 57, 57, 57, 57, 57, 58, 58,
144-
58, 57, 59, 58, 59, 58, 58, 59, 59, 59,
145-
59, 59, 59, 57, 58, 58, 57, 56, 57, 56,
146-
56, 58, 59, 57, 58, 59, 58, 60, 59, 60,
147-
59, 59, 59, 60, 58, 59, 61, 58, 57, 58,
148-
58, 57, 58, 56, 56, 58, 56, 56, 58, 59,
149-
60
150-
];
151-
152-
EYE_Y_RESIZABLE: array [0..100] of Single = [
153-
-35, -35, -35, -35, -35, -36, -35, -35, -35, -35,
154-
-34, -34, -34, -33, -33, -33, -34, -33, -33, -33,
155-
-33, -33, -33, -33, -33.5, -34, -35, -34, -34, -34,
156-
-34, -34, -34, -35, -34, -34, -35, -33, -32, -33,
157-
-33, -32, -33, -33, -32, -33, -33, -33, -33, -33.5,
158-
-34, -30, -34, -34, -33, -34, -34, -34, -34, -34,
159-
-32, -34, -33, -32, -32, -32, -32, -33, -32, -32,
160-
-34, -32, -32, -34, -34.5, -35, -34, -34, -35, -30,
161-
-34, -35, -36, -34, -34, -35, -34, -34, -35, -35,
162-
-34, -35, -36, -35, -33, -35, -36, -32, -35, -34.5,
163-
-34
164-
];
165-
166-
EYE_Z_RESIZABLE: array [0..100] of Single = [
167-
73, 71, 72, 73, 72, 72, 73, 72, 72, 73,
168-
72, 71, 72, 71, 70, 71, 71, 70, 70, 71,
169-
70, 70, 70, 70, 71, 72, 72, 72, 72, 71,
170-
72, 71, 71, 71, 71, 73, 71, 70, 72, 71,
171-
70, 71, 71, 70, 71, 70, 70, 69, 70, 70.5,
172-
71, 74, 72, 71, 70, 72, 71, 71, 72, 72,
173-
72, 72, 71, 71, 71, 70, 70, 70, 70, 69,
174-
70, 70, 71, 70, 70, 70, 71, 71, 70, 73,
175-
71, 69, 69, 71, 70, 69, 71, 68, 68, 68,
176-
68, 69, 67, 68, 70, 68, 67, 70, 69, 71,
177-
73
178-
];
179-
180-
105+
var
106+
ZOOM2RSZOOM: array [0..100] of Single = [0.0000,0.0025,0.0065,0.0100,0.0130,0.0165,0.0205,0.0235,0.0280,0.0310,0.0350,0.0390,0.0430,0.0430,0.0465,0.0515,0.0555,0.0605,0.0645,0.0690,0.0740,0.0785,0.0835,0.0885,0.0935,0.0990,0.1045,0.1095,0.1150,0.1205,0.1260,0.1325,0.1385,0.1455,0.1505,0.1585,0.1635,0.1635,0.1705,0.1775,0.1845,0.1925,0.1995,0.2055,0.2145,0.2215,0.2305,0.2365,0.2465,0.2545,0.2635,0.2725,0.2825,0.2905,0.3005,0.3105,0.3195,0.3285,0.3405,0.3555,0.3615,0.3705,0.3825,0.3825,0.3945,0.4065,0.4185,0.4305,0.4425,0.4575,0.4695,0.4815,0.4980,0.5115,0.5265,0.5385,0.5535,0.5685,0.5835,0.5985,0.6165,0.6315,0.6495,0.6645,0.6825,0.7035,0.7215,0.7215,0.7395,0.7575,0.7815,0.7995,0.8175,0.8355,0.8595,0.8835,0.9015,0.9255,0.9495,0.9735,1.000];
107+
EYE_Y_FIXED: array [0..100] of Single = [-29,-28,-28,-29,-28,-28,-28,-28,-28,-28,-28,-27,-28,-26,-26,-26,-26,-26,-26,-26,-26,-26,-26,-26,-26.5,-27,-27,-27,-27,-27,-27,-28,-27,-27,-27,-27,-27,-26,-26,-26,-25,-26,-26,-25,-25,-26,-25,-25,-25,-25.5,-26,-27,-27,-27,-25,-27,-26,-26,-25,-25,-26,-26,-26,-26,-25,-25,-25,-26,-25,-26,-26,-25,-25,-26,-25,-24,-26,-25,-24,-24,-26,-24,-24,-25,-26,-24,-25,-24,-25,-25,-25,-25,-25,-25,-26,-25,-25,-26,-25,-25,-25];
108+
EYE_Z_FIXED: array [0..100] of Single = [58,58,58,58,58,58,59,58,59,58,58,58,58,57,57,57,57,57,57,57,57,58,57,57,57.5,58,58,58,58,59,58,58,59,58,58,59,58,57,57,57,57,56,58,57,57,57,57,57,58,58,58,57,59,58,59,58,58,59,59,59,59,59,59,57,58,58,57,56,57,56,56,58,59,57,58,59,58,60,59,60,59,59,59,60,58,59,61,58,57,58,58,57,58,56,56,58,56,56,58,59,60];
109+
EYE_Y_RESIZABLE: array [0..100] of Single = [-18,-22,-22,-20,-22,-22,-22,-22,-22,-22,-22,-17,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-19,-15,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22,-22];
110+
EYE_Z_RESIZABLE: array [0..100] of Single = [53,59,59,53,59,59,59,59,59,59,59,68,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,67,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59];
181111

182112
function TMM2MSProjector._InvertProjection(matrix: TMatrix4): TMatrix4;
183113
begin

osrs/interfaces/slotinterface.simba

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ begin
318318
Exit;
319319
slots := Self.Boxes();
320320
for i := 0 to High(slots) do
321-
if Target.HasColor(TRSItem.Border, 8.5, 1, slots[i]) or
322-
Target.HasColor(TRSItem.BorderWhite, 0, 1, slots[i]) then
321+
if Target.HasColor(ITEM_BORDER, 8.5, 1, slots[i]) or
322+
Target.HasColor(ITEM_BORDER_WHITE, 0, 1, slots[i]) then
323323
Result += i;
324324
end;
325325

@@ -352,8 +352,8 @@ begin
352352
Exit;
353353
slots := Self.Boxes();
354354
for i := 0 to High(slots) do
355-
if not Target.HasColor(TRSItem.Border, 8.5, 1, slots[i]) and
356-
not Target.HasColor(TRSItem.BorderWhite, 0, 1, slots[i]) then
355+
if not Target.HasColor(ITEM_BORDER, 8.5, 1, slots[i]) and
356+
not Target.HasColor(ITEM_BORDER_WHITE, 0, 1, slots[i]) then
357357
Result += i;
358358
end;
359359

osrs/rsclient.simba

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ begin
6363
with GetSimbaTargetWindow() do
6464
begin
6565
case GetClassName() of
66-
'JagRenderView', 'JagWindow': Exit(ERSClient.OFFICIAL);
66+
'JagRenderView', 'JagWindow':
67+
begin
68+
ITEM_SHADOW := $323232;
69+
ITEM_SHADOW_GRAY := $323232;
70+
ITEM_BORDER := $000000;
71+
ITEM_BORDER_WHITE := $FEFEFE;
72+
Exit(ERSClient.OFFICIAL);
73+
end;
6774
end;
6875

6976
case GetRootWindow().GetTitle() of

0 commit comments

Comments
 (0)