-
Notifications
You must be signed in to change notification settings - Fork 4
/
Reflection.simba
226 lines (186 loc) · 5.72 KB
/
Reflection.simba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
(*
Reflection 2
*)
{$DEFINE SMART}
{$DEFINE REFLECTION}
{$loadlib RefCalculationsLib.dll}
{$i ./lib/core/Hooks.simba}
{$i ./lib/core/Constants.simba}
{$i ./lib/core/Core.simba}
{$i ./lib/core/Tiles.simba}
{$i ./lib/core/Interfaces.simba}
{$i ./lib/core/Menu.simba}
{$i ./lib/animable/characters/MyPlayer.simba}
{$i ./lib/animable/characters/Players.simba}
{$i ./lib/animable/characters/NPCs.simba}
{$i ./lib/animable/objects/Objects.simba}
{$i ./lib/ground/GroundItems.simba}
{$i ./lib/chat/Chat.simba}
{$i ./lib/chat/NPCChat.simba}
{$i ./lib/misc/Timing.simba}
{$i ./lib/misc/Misc.simba}
{$i ./lib/gametab/GameTab.simba}
{$i ./lib/gametab/Inventory.simba}
{$i ./lib/gametab/Equipment.simba}
{$i ./lib/mapwalk/MapWalk.simba}
{$i ./lib/bank/Bank.simba}
{$i ./lib/antirandoms/Antirandoms.simba}
{$i ./lib/skills/Combat.simba}
{$i ./lib/gametab/Quests.simba}
(*
R_UpdateHooks
~~~~~~~~~~~~~
.. code-block:: pascal
procedure R_UpdateHooks;
Checks version of hooks vs current version online, and
attempts to update to latest version!
.. note::
by Naike, Harry
*)
procedure R_UpdateHooks;
var
MyFile, ClientRev, RevHook, I, ClientUp: Integer;
Src,S: String;
begin
ClientUp := InitializeHTTPClient(False, False);
SetHTTPUserAgent(ClientUp,'Simba Reflection/' + ToStr(ClientVersion) + '.' + ToStr(HookRev));
Src := GetHTTPPage(ClientUp,'http://pyroryan.googlecode.com/svn/trunk/SRL/Hooks.txt');
FreeHTTPClient(ClientUp);
S := Src;
I := Pos('ClientVersion', S);
Delete(S, 1, I+15);
S := Copy(S, 1, Pos(';', S)-1);
ClientRev := StrToIntDef(S, -1);
if ClientRev = -1 then
WriteLn('[Reflection] Failed to get Hook Revision!');
S := Src;
I := Pos('HookRev', S);
Delete(S, 1, I+9);
S := Copy(S, 1, Pos(';', S)-1);
RevHook := StrToIntDef(S, -1);
if RevHook = -1 then
WriteLn('[Reflection] Failed to get Hook Revision!');
If (ClientRev <= ClientVersion) and (RevHook <= HookRev) then
begin
if(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
WriteLn('[Reflection] No new hooks have been uploaded yet; please be patient!');
if not R_ContinueIfOutdated then
TerminateScript;
end;
end else
begin
WriteLn('[Reflection] You''re using outdated hooks (version ' + ToStr(ClientVersion) + '.' + ToStr(HookRev) + '); updating you to version ' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '!');
WriteLn('[Reflection] If you manually fixed your hooks, please make sure hookrevision values are greater than or equal to the online hooks to prevent overwriting.');
MyFile := RewriteFile(AppPath + 'includes/Reflection/lib/core/Hooks.simba', False);
WriteFileString(MyFile, Src);
CloseFile(MyFile);
WriteLn('[Reflection] Updated you to ' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '; please restart your script!');
TerminateScript;
end;
end;
(*
R_RSReady
~~~~~~~~~
.. code-block:: pascal
function R_RSReady: Boolean;
Waits until the client is ready using the LoginIndex.
.. note::
by Drags111
*)
function R_RSReady: Boolean;
var
LoginIndex, T: Integer;
begin
Result := False;
T := GetTimeRunning;
LoginIndex := SmartGetFieldInt(0, hook_static_LoginIndex);
if(LoginIndex = -1)then
Exit;
while(InRange(LoginIndex, 0, 2))do
begin
if((GetTimeRunning - T) >= 300000)then
Exit;
LoginIndex := SmartGetFieldInt(0, hook_static_LoginIndex);
Wait(1000);
end;
Result := True;
end;
(*
SetupReflection
~~~~~~~~~~~
.. code-block:: pascal
procedure SetupReflection;
Sets up Reflection and SRL.
.. note::
by Reflection Dev Team
*)
procedure SetupReflection;
var
T: Integer;
begin
SetupBoxes; //Sets up box variables in globals.scar
T := GetTimeRunning;
MouseSpeed := 15;
{$IFDEF UseLaptopMouse}LMouse_MissChance := 75;{$ENDIF}
CheckHPFirst := True;
Reincarnate := False;
TalkAfterRandoms := False;
RoadColor := 0;
WaterColor := 0;
BankColor := 0;
LampSkill := 'mining';
SetUpSRLReport;
LoadCosineArrays;
SymbolAccuracy:= 0.8;
LoadSRLBitMaps;
LoadSRLFonts;
LoadTeleRandoms;
SolveSRLRandoms := True;
SetupSRLAutoResponder;
UseFindMod := True;
LogoutOnMod := True;
UseFindTrade := True;
UseAutoResponder := True;
Screenshots := False;
GraphicsSet := False;
AllowPVP := False;
WarnSensitivity := -2;
SetupAutoColors;
{$IFDEF LoadExtraFonts}
srl_UpdateFonts(srl_FontsUp2date);
{$ENDIF}
{$IFDEF YourMom}
InitializeSRLLogFile;
{$ENDIF}
AddOnTerminate('FreeSRL');
SetSupressExceptions(True);
Writeln ('SRL Compiled in '+ IntToStr(GetTimeRunning - t) + ' msec');
{$IFDEF SRL_SMART}
if (Smart_Server = 0) then
begin
Smart_Server := RandomWorld(Smart_Members, False);
Smart_Signed := True;
Smart_SuperDetail := False;
end;
Writeln('SMART Initialized.' + #10 + 'Loaded: Server ' + IntToStr(Smart_Server) + ', Members: ' + BoolToStr(Smart_Members)
+ ', Signed: ' + BoolToStr(Smart_Signed) + ', Super Detail: ' + BoolToStr(Smart_SuperDetail) + '.');
SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
SetTargetArray(SmartImageArray, 765,503);
{$ELSE}
Smart_Server := 0;
Smart_Members := false;
Smart_Signed := True;
Smart_SuperDetail := false;
{$ENDIF}
T := GetTimeRunning;
R_UpdateHooks;
R_SetupRandoms;
Writeln ('Reflection Compiled in '+ IntToStr(GetTimeRunning - T) + ' msec');
if not R_RSReady then
begin
R_Debug('Runescape isn''t loading. Hooks may be outdated or there may be', 'Reflection');
R_Debug('other issues. Please try again later!', 'Reflection');
TerminateScript;
end;
end;