forked from SRL/srl-reflection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReflection.simba
140 lines (123 loc) · 4.37 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
{$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}
{*******************************************************************************
function r_GetSVNClientVersion: Integer;
By: Naike
Description: Gets the newest hooks.simba svn clientversion!
*******************************************************************************}
function r_GetSVNClientVersion: Integer;
var
S: String;
I: Integer;
begin
S := GetPage('http://simbareflection.googlecode.com/svn/trunk/Core/Hooks.simba');
I := Pos('ClientVersion', S);
Delete(S, 1, I+15);
S := Copy(S, 1, Pos(';', S)-1);
Result := StrToIntDef(S, -1);
end;
{*******************************************************************************
function r_GetSVNHookRev: Integer;
By: Naike
Description: Gets the newest hooks.simba svn hook rev!
*******************************************************************************}
function r_GetSVNHookRev: Integer;
var
S: String;
I: Integer;
begin
S := GetPage('http://simbareflection.googlecode.com/svn/trunk/Core/Hooks.simba');
I := Pos('HookRev', S);
Delete(S, 1, I+9);
S := Copy(S, 1, Pos(';', S)-1);
Result := StrToIntDef(S, -1);
end;
{*******************************************************************************
Procedure UpdateHooks;
By: Naike
Description: Tries to update to new hooks!
*******************************************************************************}
Procedure UpdateHooks;
var
myFile, ClientRev, RevHook: Integer;
begin
ClientRev := r_GetSVNClientVersion;
RevHook := r_GetSVNHookRev;
If ((ClientRev = ClientVersion)and(RevHook = HookRev)) then
begin
Writeln('[Reflection] No new hooks have been uploaded, be patient!');
TerminateScript;
end;
Writeln('[Reflection] You''re using outdated hooks(' + ToStr(ClientVersion) + ', rev ' + ToStr(HookRev) + '), updating to ' + ToStr(ClientRev) + ', rev ' + ToStr(RevHook) + '!');
myFile := RewriteFile(AppPath + 'includes\reflection\core\hooks.simba', False);
WriteFileString(myFile, GetPage('http://simbareflection.googlecode.com/svn/trunk/Core/Hooks.simba'));
CloseFile(myFile);
Writeln('[Reflection] Updated to ' + ToStr(ClientRev) + ', rev ' + ToStr(RevHook) + ', please restart the script!');
TerminateScript;
end;
{*******************************************************************************
Procedure SetupReflectionEx(B: 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(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
Writeln('[Reflection] Hooks outdated!');
If Update then
UpdateHooks
else
TerminateScript;
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;