Simba Code:
program ColorGhouler;
{$DEFINE WALKER}
{$i AeroLib/AeroLib.Simba}
const
{---------------------------------------------------------}
{ USER INPUT }
{---------------------------------------------------------}
{} USER = ''; {}
{} PASS = ''; {}
{} PIN = ''; {}
{} {}
{} MOUSE_SPEED: TIntegerArray := {}
{} [19, 23]; {}
{} EAT_BETWEEN: TIntegerArray := {}
{} [19, 76]; {}
{} RUN_BETWEEN: TIntegerArray := {}
{} [15, 60]; {}
{---------------------------------------------------------}
DEBUG = false;
VERSION = '2.0';
BANK : Tbox := IntToBox(5840, 2507, 5867, 2553);
GHOULS : Tbox := IntToBox(5440, 2370, 5515, 2435);
type
_NPC = record
_TColors: array of TColEx;
_UpTexts: TStringArray;
_Options: TStringArray;
_Points: TPointArray;
end;
var
RSW: TRSWalker;
Fails: Integer;
Ghoul: _NPC;
TFood: TItem;
procedure DebugMsg(What: String; terminate: boolean = false);
begin
writeln(MsToTime(getTimeRunning, 3) + ' | ' + What);
if (terminate) then TerminateScript();
end;
procedure Ghoul.Init();
begin
self._TColors := [createCol(3883067, 11, 0.00, 0.17), createCol(8233378, 28, 0.03, 0.21)];
self._UpTexts := ['houl', 'hou', 'oul'];
self._Options := ['ttack Gho', 'ack Ghoul', 'k Ghoul'];
self._Points := [];
end;
procedure HealthRegen();
begin
Me.Integers[0] := iGaussRange(EAT_BETWEEN[0], EAT_BETWEEN[1]);
DebugMsg('Eating next at ' + IntToStr(Me.Integers[0]) + ' hp');
end;
procedure RunRegen();
begin
Me.Integers[1] := iGaussRange(RUN_BETWEEN[0], RUN_BETWEEN[1]);
DebugMsg('Running next at ' + IntToStr(Me.Integers[1]) + ' Energy');
end;
procedure FreeMemory;
begin
DebugMsg('Freeing memory...');
freeDTM(TFood.DTM);
RSW.Free();
end;
procedure Load();
begin
DebugMsg('Loading stuff...');
InitAL();
MouseSpeed := RandomRange(MOUSE_SPEED[0], MOUSE_SPEED[1]);
RSW.Init('WorldMap');
RSW.walkStyle := wsSPS;
RSW.anyAngle := True;
RSW.skipClose := 15;
Me.Active := True;
Me.Member := True;
Me.Name := USER;
Me.Pass := PASS;
Me.Pin := PIN;
Ghoul.Init();
with (TFood) do
begin
Name := 'Salmon';
DTM := DTMFromString('mbQAAAHicY2VgYMhmYmBIAuJkIC4G4nwg5mZkYOADYiEgZgdiNiC+7i7JcKAyh+FSZxXDcx8ZhgWmAgxyQP38aJgRCwYDAHgGCaM=');
end;
Setlength(Me.Integers, 2);
HealthRegen();
RunRegen();
addonterminate('FreeMemory');
DebugMsg('Starting Color Ghouler - v' + VERSION);
DebugMsg('Start the script logged in to define your player model');
end;
function TPointArray.Random(): TPoint;
begin
if (Length(Self)) < 1 then exit;
result := self[RandomRange(0, Length(self) - 1)];
end;
procedure CustomMouse(point: TPoint; RX, RY: Integer);
begin
RX := iGaussRange(0, RX);
RY := iGaussRange(0, RY);
case random(0, 15) of
0..5: BrakeMMouse(point, RX, RY, false);
6..7: MissMouse(point, RX, RY);
8..15: HumanMMouse(point, RX, RY);
end;
end;
procedure Antiban();
begin
if (not (isMouseInClient())) then exit;
DebugMsg('Performing antiban');
if ((not (isUsingRun())) and (getRunEnergy() >= Me.Integers[1])) then
begin
toggleRunning(true);
RunRegen();
end;
case random(0, 100) of
0..3: hoverSkill('hitpoints', false);
4..20: MMouseOffClient('Random'); //blaze it
21..45: SleepAndMoveMouse(200 + random(2000));
46..75: HumanRandomMouse();
76..100: setCompass(round(getCompassAngle()) + GaussRange(5 + random(100), 150 + random(200)));
end;
if (random(50) = 1) then
Antiban();
if (random(250) = 1) then
Sleep(GaussRandom(60000));
end;
{ Methodology borrowed from hoodz fighter,
modified to incorporate Entities +
better hitsplats detection }
function Me.SeeHitsplats(timeOut: Integer): Boolean;
var
TColArr: array of TColEx;
TPA: TpointArray;
t1, t2: timer;
i, loadTime: integer;
begin
Result := false;
TColArr := [createCol(13108739, 23, 0.02, 0.17), createCol(65941, 9, 0.00, 0.15)];
loadTime := 0;
t1.start();
while ((t1.timeElapsed() - loadTime) < timeOut) do
begin
t2.start();
self.Model.update();
loadTime := t2.timeElapsed();
TPA := TPAFromEllipse(self.Model.BasePnt.X, self.Model.BasePnt.Y, 14, 18);
FillEllipse(TPA);
if (DEBUG) then DebugTPA(TPA, '');
for i := 0 to High(TColArr) do
begin
if (TColArr[i].count(TPA.getBounds()) > 100) then
exit(true);
end;
end;
end;
function Ghoul.FindFree(): TPointArray;
var
ATPA, TPAs: T2DPointArray;
i, j: Integer;
b: TBox;
begin
result := [];
SetLength(TPAs, Length(Self._TColors));
for j := 0 to High(Self._TColors) do
begin
self._TColors[j].FindAllIn(Area_MS, TPAs[j]);
if length(TPAs[j]) < 1 then exit;
end;
AppendTPA(TPAs[0], TPAs[1]);
ATPA := FloodFillTPA(TPAs[0]);
FilterTPAsBetween(ATPA, 0, 100);
SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
if (length(ATPA) < 1) then exit;
for i := 0 to high(ATPA) do
begin
b := toBox(ATPA[i].getBounds().X1 - 30, ATPA[i].getBounds().Y1 - 30, ATPA[i].getBounds().X2 + 30, ATPA[i].getBounds().Y2 + 5);
if (not (foundHPBarIn(B))) then
begin
if (DEBUG) then debugTPA(ATPA[i], '');
exit(ATPA[i]);
end;
end;
end;
function Ghoul.Interact(): Boolean;
var
pnt: TPoint;
begin
result := false;
if (not (isLoggedIn())) then exit;
self._Points := Ghoul.findFree();
if self._Points = [] then exit;
if (DEBUG) then DebugTPA(self._Points, '');
case random(0, 20) of
0..15: pnt := self._Points.midPnt();
16..18: pnt := MedianTPA(self._Points);
19..20: pnt := self._Points.Random();
end;
if (Pnt.X < 1) then exit;
CustomMouse(Pnt, 3, 3);
if (waitUpTextMulti(self._UpTexts, 50 + random(100))) then
begin
if (random(0, 50) > 1) then
fastClick(MOUSE_LEFT)
else
begin
fastClick(MOUSE_RIGHT);
if (not (waitOptionMulti(self._Options, 50 + random(100)))) then exit;
end;
end else
begin
if (random(0, 5)) = 1 then
CustomMouse(Pnt, 100, 100);
if (Ghoul.Interact()) then
exit(true);
end;
if (not (didRedClick())) then exit;
result := (Me.SeeHitsplats(4250 + random(750)));
if (result) then
DebugMsg('Successfully interacted with ghoul')
else
DebugMsg('Failed to interact with ghoul');
end
Procedure Eat();
var
slots: TIntegerArray;
x, y, rand: Integer;
begin
if (not (gameTab(TAB_INV))) then exit;
sleep(GaussRandom(2000));
slots := TFood.getSlots();
if (length(slots) < 1) then exit;
if (random(0, 8) > 1) then
rand := low(slots)
else
rand := random(low(slots), length(slots) - 1);
GaussBox(x, y, invBox(slots[rand]).X1, invBox(slots[rand]).Y1, invBox(slots[rand]).X2, invBox(slots[rand]).Y2)
if (not (PointInBox(getMousePnt(), invBox(slots[rand])))) then
CustomMouse(Point(x, y), 0, 0);
if (random(0, 50) > 1) then
fastClick(MOUSE_LEFT)
else
begin
fastClick(MOUSE_RIGHT);
if (not (waitOptionMulti(['Eat', 'at'], 50 + random(100)))) then exit;
end;
HealthRegen();
end;
procedure WaitFight();
var
t: timer;
begin
t.Start();
while ((Me.SeeHitsplats(1650 + GaussRandom(250))) or (isPlayerWalking())) do
begin
if (t.timeElapsed > (28000 + random(3000))) then
break;
if (getCurrenthealth() <= Me.Integers[0]) then
Eat();
if (random(60) = 1) then
Antiban();
end;
end;
function Fighting(): Boolean;
begin
result := false;
if (not (Me.SeeHitsplats(1))) then
begin
if (Ghoul.Interact()) then
begin
result := true;
WaitFight();
end else
sleep(50);
end;
end;
function Banking(): Boolean;
begin
end;
function GetArea(): Integer;
var
i: Integer;
arr: TBoxArray;
begin
result := - 1;
arr := [GHOULS, BANK];
for i := 0 to high(arr) do
if (PointInBox(RSW.GetMyPos(), arr[i])) then
exit(i);
end;
function GetState(): Variant;
begin
if (not (isLoggedIn())) then
exit(0);
case (TFood.InInventory()) of
true: exit(1);
false: exit(2);
end;
end;
procedure Execute();
var
State: Variant;
Area: Integer;
begin
if (random(125) = 1) then
Antiban();
Area := GetArea();
case (GetState()) of
0: State := LoginPlayer(False);
1:
if (Area = 0) then
State := Fighting();
{else
State := walk to ghouls;}
2:
if (Area = 1) then
State := Banking();
{else
State := walk to bank;}
end;
if (not (State)) then
inc(fails)
else
fails := 0;
if (fails > 15) then
DebugMsg('Too many fails - TERMINATING', true);
end;
begin
Load();
while (not (IsLoggedIn())) do
sleep(2500);
definePlayerModel(35, 70);
if (not (Me.ModelSet)) then
terminateScript;
while (Me.Active) do
Execute();
end.