SRL Archive - Newly Added to Reflection

SetupReflection


Naike

2010-11-17 12:18:15

Some new functions added to reflection.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;

As you can see, SetupReflectionEx does NOT do the same thing it used to do.
However, this is not a problem.

I'm well aware of the fact that the first two functions can be combined, I did not do so for obvious reasons.

Enjoy ~ Reflection development team!

Cstrike

2010-11-17 12:34:42

Now that is nice :)
Great job on these <3