-
Notifications
You must be signed in to change notification settings - Fork 5
/
Reflection.simba
124 lines (114 loc) · 4.05 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
{$define smart}
{$DEFINE REFLECTION}
{$i ./Core/Constants.simba}
{$i ./Core/Hooks.simba}
{$i ./Core/TileCore.simba}
{$i ./Core/Nodes.simba}
{$i ./Core/Text.simba}
{$i ./Core/NPCs.simba}
{$i ./Core/Players.simba}
{$i ./Core/MMWalk.simba}
{$i ./Core/Objects.simba}
{$i ./Core/Interfaces.simba}
{$i ./Core/Inventory.simba}
{$i ./Core/Equipment.simba}
{$i ./Core/Bank.simba}
{$i ./Core/Chat.simba}
{$i ./Core/GroundItems.simba}
{$i ./Core/Other.simba}
{$i ./Core/GameTab.simba}
{$i ./Core/Items.simba}
{$i ./Core/Antirandoms\Pillory.simba}
{$i ./Core/Antirandoms\Prison.simba} // Not solved yet technically
{$i ./Core/Antirandoms\Certer.simba}
{$i ./Core/Antirandoms\Abyss.simba}
{$i ./Core/Antirandoms\Quiz.simba}
{$i ./Core/Antirandoms\Pinball.simba}
{$i ./Core/Antirandoms\ScapeRune.simba}
{$i ./Core/Antirandoms\Arnav.simba}
{$i ./Core/Antirandoms\Mordaut.simba}
{$i ./Core/Antirandoms\Gravedigger.simba}
{$i ./Core/Antirandoms\Maze.simba}
{$i ./Core/Antirandoms\Frog.simba}
{$i ./Core/Antirandoms\Mime.simba}
{$i ./Core/Antirandoms\Molly.simba}
{$i ./Core/Antirandoms\Beekeeper.simba}
{$i ./Core/Antirandoms\Demon.simba}
{$i ./Core/Antirandoms\Forester.simba}
{$i ./Core/Antirandoms\Sandwich.simba}
{$i ./Core/Antirandoms\Rewards.simba}
{$i ./Core/Antirandoms\Antirandoms.simba}
var R_UpdateKill: boolean;
Procedure UpdateHooks(terminate: boolean);
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://reflection.harry.lu/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 (terminate) 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/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;
{*******************************************************************************
Procedure SetupReflectionEx(Update: Boolean);
By: Reflection development team
Description: Sets up reflection constants, and checks if hooks are outdated.
Will try to update if outdated.
*******************************************************************************}
Procedure SetupReflectionEx(Update: Boolean);
begin
SetupConstants;
If Update then
UpdateHooks(R_UpdateKill)
else
begin
if(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
Writeln('[Reflection] Hooks outdated!');
if (R_UpdateKill) then
TerminateScript;
end;
end;
end;
{*******************************************************************************
Procedure SetupReflection;
By: Reflection development team
Description: Sets up reflection constants, and checks if hooks are outdated.
Will try to update if outdated.
*******************************************************************************}
Procedure SetupReflection;
begin
SetupReflectionEx(True);
end;