Skip to content

Commit e541732

Browse files
authored
Merge branch 'WaspScripts:main' into feat/geImprovements
2 parents 77bbd18 + 4590ce2 commit e541732

File tree

19 files changed

+389
-199
lines changed

19 files changed

+389
-199
lines changed

examples/misc_form.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var
55
tab: TLazTabSheet;
66
begin
77
form.Setup();
8+
form.CreateMiscTab();
89
tab := form.CreateTab('My Settings');
9-
form.CreateAntibanTab();
1010
form.Run();
1111
end.

osrs.simba

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ less confusing way.
1313
```pascal
1414
{$DEFINE WL_DEBUG_MOUSE}
1515
{$DEFINE WL_DISABLE_FAKE_INPUT}
16-
{$DEFINE WL_DISABLE_WASPINPUT}
1716
{$DEFINE WL_KEYBINDS_DEBUG}
1817
{$DEFINE WL_DEBUG_UPTEXT}
1918
{$DEFINE WL_DEBUG_INTERFACES}

osrs/interfaces/gametabs/achievements.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ var
254254
slot: TRSDiarySlot;
255255
begin
256256
for slot in Self.GetSlots() do
257-
if OCR.Locate(slot.Name, Self.Names[diary], [RSFonts.RED, RSFonts.YELLOW, RSFonts.GREEN, RSFonts.WHITE], 0, RSFonts.PLAIN_11) > 0.9 then
257+
if OCR.Locate(slot.Name, Self.Names[diary], [RSFonts.RED, RSFonts.YELLOW, RSFonts.LIGHT_GREEN, RSFonts.WHITE], 0, RSFonts.PLAIN_11) > 0.9 then
258258
Exit(slot);
259259
end;
260260

osrs/interfaces/mainscreen/anvil.simba

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var
6767
i: Integer;
6868
begin
6969
for i := 0 to High(Self.SlotBoxes) do
70-
if Target.HasColor($00FF00, 0, 1, Self.SlotBoxes[i]) or Target.HasColor($1F98FF, 0, 1, Self.SlotBoxes[i]) then
70+
if Target.HasColor(RSFonts.GREEN, 0, 1, Self.SlotBoxes[i]) or Target.HasColor(RSFonts.ORANGE, 0, 1, Self.SlotBoxes[i]) then
7171
Result += Self.SlotBoxes[i];
7272
end;
7373

@@ -100,9 +100,9 @@ begin
100100
Self.SlotsArea.X2 := Self.Bounds.X2 - 50;
101101
Self.SlotsArea.Y2 := Self.Bounds.Y2 - 4;
102102

103-
Self.SlotBoxes := TBoxArray.Create(Self.Bounds.TopLeft + [10, 36], 6, 5, 54, 54, [26, 1]);
103+
Self.SlotBoxes := TBoxArray.Create(Self.Bounds.TopLeft + [6, 36], 6, 5, 75, 54, [1, 1]);
104104
for i in [5, 11, 17, 23, 29] do
105-
Self.SlotBoxes[i] := Self.SlotBoxes[i].Offset([-15, 0]);
105+
Self.SlotBoxes[i].X2 := Self.SlotBoxes[i].X1 + 67;
106106

107107
Self.Slots.Setup('Anvil.Slots', Self.SlotBoxes, @Self.GetSlotBoxes);
108108
Self.Items.Setup('Anvil.Items', @Self.Slots, [0, 0]);

osrs/interfaces/setup.simba

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ begin
116116
raise GetDebugLn('WaspLib', 'Failed to create path: ' + WLEnv.LogsDir);
117117
if not DirCreate(WLEnv.AssetsDir) then
118118
raise GetDebugLn('WaspLib', 'Failed to create path: ' + WLEnv.AssetsDir);
119+
if not DirCreate(WLEnv.VideosDir) then
120+
raise GetDebugLn('WaspLib', 'Failed to create path: ' + WLEnv.VideosDir);
119121

120122
WaspClient.Setup();
121123
WLAssets.Update();

osrs/miscform.simba

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ mentioned on this page because they are internal methods you shouldn't touch.
2323
Do feel free to read the source code though if you so desire.
2424
*)
2525
TMiscFormHelper = record
26+
LoginPanel, ClientPanel: TLazPanel;
27+
EmailEdit, PasswordEdit: TLazEdit;
28+
RecorderLength: TLazSpinEdit;
29+
RecorderLengthLbl1, RecorderLengthLbl2: TLazLabel;
2630
Config: TConfigJSON;
2731
end;
2832

@@ -31,6 +35,161 @@ begin
3135
Self.Config.Setup('misc' + PATH_SEP + ToStr(ProfileIndex));
3236
end;
3337

38+
39+
procedure TMiscFormHelper.OnLogin(sender: TLazObject);
40+
begin
41+
WaspClient.Login(Self.EmailEdit.Text, Self.PasswordEdit.Text);
42+
43+
if WaspClient.LoggedIn then
44+
TLazButton(sender).Parent.Hide();
45+
end;
46+
47+
procedure TMiscFormHelper.OnLogout(sender: TLazObject);
48+
begin
49+
WaspClient.Login(Self.EmailEdit.Text, Self.PasswordEdit.Text);
50+
51+
if WaspClient.LoggedIn then
52+
TLazButton(sender).Parent.Hide();
53+
end;
54+
55+
56+
procedure TMiscFormHelper.SetupLoginPanel(parent: TLazComponent);
57+
var
58+
info: TLazLabel;
59+
btn: TLazButton;
60+
begin
61+
Self.LoginPanel := TLazPanel.CreateEx(parent, TLazTabSheet(parent).Width div 2 - 240, 20, 480, 220);
62+
Self.LoginPanel.BevelWidth := 0;
63+
64+
info := TLazLabel.CreateEx(Self.LoginPanel, '', '', 60, 20, 0, 90);
65+
info.Caption := 'You are currently not logged into WaspScripts.' + LINE_SEP + LINE_SEP +
66+
'To submit stats you can either login below' + LINE_SEP +
67+
'or relaunch the script from wasp-launcher.';
68+
info.Alignment := ELazAlignment.Center;
69+
info.Font.Name := 'Courier New';
70+
71+
Self.EmailEdit := TLazEdit.CreateEx(Self.LoginPanel, 'Email:', 'Username to login to WaspScripts', 20, info.Bottom + 20, 200);
72+
Self.PasswordEdit := TLazEdit.CreateEx(Self.LoginPanel, 'Password:', 'Password to login to WaspScripts', Self.EmailEdit.Right + 20, Self.EmailEdit.Top, 200);
73+
Self.PasswordEdit.PasswordChar := '*';
74+
75+
btn := TLazButton.CreateEx(Self.LoginPanel, 'Login', '', Self.LoginPanel.Width div 2 - 100, Self.EmailEdit.Bottom + 20, 200);
76+
btn.OnClick := @Self.OnLogin;
77+
78+
if WaspClient.LoggedIn then
79+
Self.LoginPanel.Hide();
80+
end;
81+
82+
procedure TMiscFormHelper.SetupClientPanel(parent: TLazComponent);
83+
var
84+
info: TLazLabel;
85+
btn: TLazButton;
86+
begin
87+
Self.ClientPanel := TLazPanel.CreateEx(parent, TLazTabSheet(parent).Width div 2 - 240, 20, 480, 220);
88+
Self.ClientPanel.BevelWidth := 0;
89+
90+
info := TLazLabel.CreateEx(Self.ClientPanel, 'You are logged in as ' + WaspClient.User.Username, '', 60, 20, 0, 90);
91+
info.Alignment := ELazAlignment.Center;
92+
info.Font.Name := 'Courier New';
93+
94+
btn := TLazButton.CreateEx(Self.LoginPanel, 'Login', '', Self.LoginPanel.Width div 2 - 100, Self.EmailEdit.Bottom + 20, 200);
95+
btn.OnClick := @Self.OnLogout;
96+
97+
if WaspClient.LoggedIn then
98+
Self.LoginPanel.Hide();
99+
end;
100+
101+
102+
103+
procedure TMiscFormHelper.OnRecorderEnabledChange(sender: TLazObject);
104+
begin
105+
if TLazCheckBox(sender).IsChecked() then
106+
begin
107+
SimbaRecorder.Enabled := True;
108+
Self.RecorderLengthLbl1.Enabled := True;
109+
Self.RecorderLength.Enabled := True;
110+
Self.RecorderLengthLbl2.Enabled := True;
111+
SimbaRecorder.BufferSeconds := Self.RecorderLength.Value;
112+
end
113+
else
114+
begin
115+
SimbaRecorder.Enabled := False;
116+
Self.RecorderLengthLbl1.Enabled := False;
117+
Self.RecorderLength.Enabled := False;
118+
Self.RecorderLengthLbl2.Enabled := False;
119+
end;
120+
121+
if Self.Config.Data.Has('recorder_enabled') then
122+
Self.Config.Data.Item['recorder_enabled'].AsBool := SimbaRecorder.Enabled
123+
else
124+
Self.Config.Data.AddBool('recorder_enabled', SimbaRecorder.Enabled);
125+
Self.Config.Save();
126+
end;
127+
128+
procedure TMiscFormHelper.OnRecorderLengthChange(sender: TLazObject);
129+
begin
130+
SimbaRecorder.BufferSeconds := TLazSpinEdit(sender).Value;
131+
if Self.Config.Data.Has('recorder_length') then
132+
Self.Config.Data.Item['recorder_length'].AsInt := SimbaRecorder.BufferSeconds
133+
else
134+
Self.Config.Data.AddInt('recorder_length', SimbaRecorder.BufferSeconds);
135+
Self.Config.Save();
136+
end;
137+
138+
139+
procedure TMiscFormHelper.SetupRecorderPanel(parent: TLazComponent);
140+
var
141+
panel: TLazPanel;
142+
check: TLazCheckBox;
143+
begin
144+
panel := TLazPanel.CreateEx(parent, TLazTabSheet(parent).Width div 2 - 120, 320, 240, 100);
145+
panel.BevelWidth := 0;
146+
147+
check := TLazCheckBox.CreateEx(panel, 'Record crashes', '', 20, 0);
148+
check.Hint := 'Simba recorder records the last X seconds of a script running.' + LINE_SEP +
149+
'This is great to analyze crashes and issues that shut down scripts' + LINE_SEP +
150+
'but uses a lot of RAM and will use more the longer the recording is.';
151+
check.ShowHint := True;
152+
check.OnChange := @Self.OnRecorderEnabledChange;
153+
154+
Self.RecorderLengthLbl1 := TLazLabel.CreateEx(panel, 'Record last', '', 20, 40);
155+
Self.RecorderLength := TLazSpinEdit.CreateEx(panel);
156+
Self.RecorderLength.AnchorHorizontally(Self.RecorderLengthLbl1, 10);
157+
Self.RecorderLength.Hint := check.Hint;
158+
Self.RecorderLength.ShowHint := True;
159+
Self.RecorderLength.Increment := 5;
160+
if Self.Config.Data.Has('recorder_length') then
161+
begin
162+
SimbaRecorder.BufferSeconds := Self.Config.Data.Item['recorder_length'].AsInt;
163+
Self.RecorderLength.Value := Self.Config.Data.Item['recorder_length'].AsInt;
164+
end
165+
else
166+
begin
167+
SimbaRecorder.BufferSeconds := 30;
168+
Self.RecorderLength.Value := 30;
169+
end;
170+
Self.RecorderLength.MinValue := 10;
171+
Self.RecorderLength.OnChange := @Self.OnRecorderLengthChange;
172+
173+
Self.RecorderLengthLbl2 := TLazLabel.CreateEx(panel, 'seconds');
174+
Self.RecorderLengthLbl2.AnchorHorizontally(Self.RecorderLength, 10);
175+
176+
if Self.Config.Data.Has('recorder_enabled') then
177+
begin
178+
check.SetChecked(Self.Config.Data.Item['recorder_enabled'].AsBool);
179+
Self.RecorderLengthLbl1.Enabled := Self.Config.Data.Item['recorder_enabled'].AsBool;
180+
Self.RecorderLength.Enabled := Self.Config.Data.Item['recorder_enabled'].AsBool;
181+
Self.RecorderLengthLbl2.Enabled := Self.Config.Data.Item['recorder_enabled'].AsBool;
182+
end
183+
else
184+
begin
185+
check.SetChecked(False);
186+
Self.RecorderLengthLbl1.Enabled := False;
187+
Self.RecorderLength.Enabled := False;
188+
Self.RecorderLengthLbl2.Enabled := False;
189+
end;
190+
end;
191+
192+
34193
var
35194
(*
36195
## MiscForm variable
@@ -65,4 +224,7 @@ begin
65224
Result := Self.CreateTab('Misc');
66225

67226
MiscForm.Setup();
227+
MiscForm.SetupLoginPanel(Result);
228+
MiscForm.SetupRecorderPanel(Result);
229+
MiscForm.Setup();
68230
end;

0 commit comments

Comments
 (0)