forked from Drags111/Reflection_Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reflection.simba
102 lines (80 loc) · 2.88 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
(*
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/Characters.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/mapwalk/MapWalk.simba}
{$i ./lib/gametab/GameTab.simba}
{$i ./lib/gametab/Inventory.simba}
{$i ./lib/gametab/Equipment.simba}
{$i ./lib/bank/Bank.simba}
{$i ./lib/antirandoms/Antirandoms.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/Hooks.simba');
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;