PDA

View Full Version : Alotic Include



rj
04-11-2015, 05:53 AM
I have now begun working on a include to bot on the private server 'Alotic' since everyone requests scripts for it..

This include is based off the original soulsplit include that I had https://github.com/officerBarbrady/SSInclude (that I attempted to write in 2012, then rewrote in 2014..). As you can see it looked like crap and the API was hard to use. The new Alotic include will be straight forward and be somewhat similar to SRL-6


The include is located at: https://github.com/officerBarbrady/Alotic if you want to contribute..





Current features

*Cute little custom debug box that goes right under the Alotic Client

http://i.imgur.com/dNfGXuP.png
*Uses CTS settings library thing from SRL-6
*Compiles




Future features

(Besides basic include functions like choose option, uptext, health etc etc)


Red = Only going to happen if somebody thats not me works on it (AKA the smart people)
Yellow = Will be added in the future or is currently being worked on
green = finished

SPS
OpenGL hooking (supposedly works for any game right?)
Use TMufasaLayer to easily draw over canvas
Include updater


*Doubt it will ever work because of the way Alotic has to be loaded


Credits

Most credits should be in the include but it's not very well documented so i'll go ahead and name people
Olly: Couple of files are completely ripped from SRL-6(wrappers.simba, drawing.simba, datatypes.simba), also TMufasaLayer
Zyt3x: SRL-6 datatypes
Janilabo: Box functions, CTS library, string functions
Brandon: Socks include


I will use this thread to add latest include updates. If you want any functions added because you want to include me then bug me on this thread

rj
04-15-2015, 02:55 AM
Drawing added:

http://i.imgur.com/ZuGRNvy.png

rj
04-30-2015, 10:36 PM
Include Installer:

Copy and paste into simba and run.
{$loadlib prosocks}


(*
Alotic include updater written by rj,
string functions by Janilabo, github page grabber by Brandon
*)

const
BASE_URL = 'https://raw.githubusercontent.com/officerBarbrady/Alotic/master/';
INCLUDE_PATH = 'C:\Simba\Includes\Alotic\';

type
TFileFormat = (FILE_PATH, WEB_PATH, DIRECTORY_PATH);

function mInc(var x: Integer; N: Integer = 1): Integer;
begin
Result := x;
x := (x + N);
end;

function mIncrease(var x: Integer; N: Integer = 1): Integer;
begin
x := (x + N);
Result := x;
end;

function mExplode(str: string; d: Char): TStringArray;
var
a, b, l, p, r, s: Integer;
begin
l := Length(str);
SetLength(Result, 1);
if (l > 0) then
begin
b := 1;
a := 1;
p := 0;
r := 0;
s := 0;
while (mInc(p) < l) do
if (str[p] = d) then
begin
Result[mInc(r)] := Copy(str, a, s);
if (b <= r) then
SetLength(Result, mIncrease(b, b));
a := (p + 1);
s := 0;
end else
s := (s + 1);
SetLength(Result, (r + 1));
Result[r] := Copy(str, a, s);
end else
Result[0] := str;
end;

function mLines(str: string): TStringArray;
begin
if (Length(str) = 0) then
begin
SetLength(Result, 1);
Result[0] := str;
end else
Result := mExplode(str, #10);
end;

function Before(s, str: string): string;
var
p: Integer;
begin
if (Length(s) < Length(str)) then
begin
p := Pos(s, str);
if (p > 1) then
Result := Copy(str, 1, (p - 1))
else
Result := '';
end else
Result := '';
end;

function lastBefore(s, str: string): string;
var
l, p, lp: Integer;
begin
l := Length(str);
if (Length(s) <= l) then
begin
repeat
p := PosEx(s, str, (p + 1));
if (p > 0) then
lp := p;
until (p <= 0);
if (lp > 0) then
Result := Copy(str, 1, (lp - 1))
else
Result := '';
end else
Result := '';
end;

function formatPath(s:string;formatType:TFileFormat):string ;
var
base, fileType:string;
begin
case formatType of
FILE_PATH:
begin
fileType := between('[', ']', s);
base := before('[', s);
result := INCLUDE_PATH + base + '.' + fileType;
end;
WEB_PATH:
begin
s := replace(s, '\', '/', [rfReplaceall]);
fileType := between('[', ']', s);
base := before('[', s);
result := base + '.' + fileType;
end;
DIRECTORY_PATH:
begin
result := INCLUDE_PATH + lastBefore('\', s);
if (result[length(result)] <> '\') then
result := result + '\';
end;
end;
end;

Function GetPageEx(URL: String): String;
var
S: SSLSocket;
res: ProMemoryStruct;
begin
Pro_InitSocket(S, nil, nil, nil, nil);
Pro_CreateSocket(S, '');
Pro_SetSSL(S, false, false, true);
Pro_SetURL(S, URL);
Pro_DoGetEx(S, res);

{$IFDEF LAPE}
SetLength(Result, res.size);
MemMove(res.memory^, Result[1], res.size);
{$ELSE}
Result := res.memory;
{$ENDIF}
try
Pro_FreeSocket(S);
except
WriteLn('Unable to Free ' + URL + ' ProSocks Error');
end;
end;

procedure updateInclude();
var
i, c, tmpFile:integer;
p:string;
filePaths:TStringArray;
fileContents:string;
begin
writeln('Scanning for files to update..');
p := getPageEx(BASE_URL + 'Files.txt');
filePaths := mLines(p);
for i := 0 to high(filePaths) do
begin
if (filePaths[i] <> '') then
begin
if (formatPath(filePaths[i], DIRECTORY_PATH) <> '') then
begin
if (not directoryExists(formatPath(filePaths[i], DIRECTORY_PATH))) then
begin
Writeln('Created new forder ', formatPath(filePaths[i], DIRECTORY_PATH));
createDirectory(formatPath(filePaths[i], DIRECTORY_PATH));
end;
end;
p := '';
p := getPageEx(BASE_URL + formatPath(filePaths[i], WEB_PATH));
try
if (not fileExists(formatPath(filePaths[i], FILE_PATH))) then
begin
tmpFile := createFile(formatPath(filePaths[i], FILE_PATH));
closeFile(tmpFile);
tmpFile := reWriteFile(formatPath(filePaths[i], FILE_PATH), false);
if writeFileString(tmpFile, p) then
begin
writeln('Created new file ' , formatPath(filePaths[i], FILE_PATH));
c := c + 1;
end;
closeFile(tmpFile);
end else
begin
tmpFile := openFile(formatPath(filePaths[i], FILE_PATH), false);
readFileString(tmpFile, fileContents, fileSize(tmpFile));
closeFile(tmpFile);
if (length(fileContents) <> length(p)) then
begin
tmpFile := reWriteFile(formatPath(filePaths[i], FILE_PATH), false);
if writeFileString(tmpFile, p) then
begin
c := c + 1;
writeln('Updated ', formatPath(filePaths[i], FILE_PATH));
end;
closeFile(tmpFile);
end;
end;
except
writeln('Could not write file');
end;
end;
end;
writeln('Updated ' , c , ' Files');
end;

begin
updateInclude();
end.

KeepBotting
05-01-2015, 12:05 AM
Include Installer:

Copy and paste into simba and run.
{$loadlib prosocks}


(*
Alotic include updater written by rj,
string functions by Janilabo, github page grabber by Brandon
*)

const
BASE_URL = 'https://raw.githubusercontent.com/officerBarbrady/Alotic/master/';
INCLUDE_PATH = 'C:\Simba\Includes\Alotic\';

type
TFileFormat = (FILE_PATH, WEB_PATH, DIRECTORY_PATH);

function mInc(var x: Integer; N: Integer = 1): Integer;
begin
Result := x;
x := (x + N);
end;

function mIncrease(var x: Integer; N: Integer = 1): Integer;
begin
x := (x + N);
Result := x;
end;

function mExplode(str: string; d: Char): TStringArray;
var
a, b, l, p, r, s: Integer;
begin
l := Length(str);
SetLength(Result, 1);
if (l > 0) then
begin
b := 1;
a := 1;
p := 0;
r := 0;
s := 0;
while (mInc(p) < l) do
if (str[p] = d) then
begin
Result[mInc(r)] := Copy(str, a, s);
if (b <= r) then
SetLength(Result, mIncrease(b, b));
a := (p + 1);
s := 0;
end else
s := (s + 1);
SetLength(Result, (r + 1));
Result[r] := Copy(str, a, s);
end else
Result[0] := str;
end;

function mLines(str: string): TStringArray;
begin
if (Length(str) = 0) then
begin
SetLength(Result, 1);
Result[0] := str;
end else
Result := mExplode(str, #10);
end;

function Before(s, str: string): string;
var
p: Integer;
begin
if (Length(s) < Length(str)) then
begin
p := Pos(s, str);
if (p > 1) then
Result := Copy(str, 1, (p - 1))
else
Result := '';
end else
Result := '';
end;

function lastBefore(s, str: string): string;
var
l, p, lp: Integer;
begin
l := Length(str);
if (Length(s) <= l) then
begin
repeat
p := PosEx(s, str, (p + 1));
if (p > 0) then
lp := p;
until (p <= 0);
if (lp > 0) then
Result := Copy(str, 1, (lp - 1))
else
Result := '';
end else
Result := '';
end;

function formatPath(s:string;formatType:TFileFormat):string ;
var
base, fileType:string;
begin
case formatType of
FILE_PATH:
begin
fileType := between('[', ']', s);
base := before('[', s);
result := INCLUDE_PATH + base + '.' + fileType;
end;
WEB_PATH:
begin
s := replace(s, '\', '/', [rfReplaceall]);
fileType := between('[', ']', s);
base := before('[', s);
result := base + '.' + fileType;
end;
DIRECTORY_PATH:
begin
result := INCLUDE_PATH + lastBefore('\', s);
if (result[length(result)] <> '\') then
result := result + '\';
end;
end;
end;

Function GetPageEx(URL: String): String;
var
S: SSLSocket;
res: ProMemoryStruct;
begin
Pro_InitSocket(S, nil, nil, nil, nil);
Pro_CreateSocket(S, '');
Pro_SetSSL(S, false, false, true);
Pro_SetURL(S, URL);
Pro_DoGetEx(S, res);

{$IFDEF LAPE}
SetLength(Result, res.size);
MemMove(res.memory^, Result[1], res.size);
{$ELSE}
Result := res.memory;
{$ENDIF}
try
Pro_FreeSocket(S);
except
WriteLn('Unable to Free ' + URL + ' ProSocks Error');
end;
end;

procedure updateInclude();
var
i, c, tmpFile:integer;
p:string;
filePaths:TStringArray;
fileContents:string;
begin
writeln('Scanning for files to update..');
p := getPageEx(BASE_URL + 'Files.txt');
filePaths := mLines(p);
for i := 0 to high(filePaths) do
begin
if (filePaths[i] <> '') then
begin
if (formatPath(filePaths[i], DIRECTORY_PATH) <> '') then
begin
if (not directoryExists(formatPath(filePaths[i], DIRECTORY_PATH))) then
begin
Writeln('Created new forder ', formatPath(filePaths[i], DIRECTORY_PATH));
createDirectory(formatPath(filePaths[i], DIRECTORY_PATH));
end;
end;
p := '';
p := getPageEx(BASE_URL + formatPath(filePaths[i], WEB_PATH));
try
if (not fileExists(formatPath(filePaths[i], FILE_PATH))) then
begin
tmpFile := createFile(formatPath(filePaths[i], FILE_PATH));
closeFile(tmpFile);
tmpFile := reWriteFile(formatPath(filePaths[i], FILE_PATH), false);
if writeFileString(tmpFile, p) then
begin
writeln('Created new file ' , formatPath(filePaths[i], FILE_PATH));
c := c + 1;
end;
closeFile(tmpFile);
end else
begin
tmpFile := openFile(formatPath(filePaths[i], FILE_PATH), false);
readFileString(tmpFile, fileContents, fileSize(tmpFile));
closeFile(tmpFile);
if (length(fileContents) <> length(p)) then
begin
tmpFile := reWriteFile(formatPath(filePaths[i], FILE_PATH), false);
if writeFileString(tmpFile, p) then
begin
c := c + 1;
writeln('Updated ', formatPath(filePaths[i], FILE_PATH));
end;
closeFile(tmpFile);
end;
end;
except
writeln('Could not write file');
end;
end;
end;
writeln('Updated ' , c , ' Files');
end;

begin
updateInclude();
end.

Awesome work :P very interesting to see an installer that's not bundled with a plugin :)