Simba Code:
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$i SRL/SRL/misc/reports.simba}
{$i SRL/SRL/misc/MouseHandler.simba}
Var
ActiveTrap_DTM,BadTrap_DTM,
GoodTrap_DTM,InvTrap_DTM,
HuntXP,ReportTimer,CCount,FCount,
ICount: Integer;
IdleTrap_DTM: Array [0..1] of Integer;
Procedure LoadVars;
begin
MarkTime(ReportTimer);
InvTrap_DTM := DTMFromString('mggAAAHicY2NgYMhhYmDIBuI8IE4C4hIo/wwjA8NeIL7KCGGfBuIbQOyVb8jQ5WjLkGqgC9TNBMciQBKGWZEwIw4MAQC/Owp3');
ActiveTrap_DTM := DTMFromString('mWAAAAHicY2FgYGBlZGBgAuLfQDY/kN4MpJcC8U4g3grEE10dGDrmRzJEtEQy9FzsZZAEiiFjZjQMAgAIzAoE');
BadTrap_DTM := DTMFromString('mWAAAAHicY2FgYGAFYj4gZmSAAC4oFoHyQzRUGfqu9DPo2egxWEpLgsXloPIgzIyGQQAAwusEPg==');
GoodTrap_DTM := DTMFromString('mbQAAAHicY2VgYDgCxHuA+CAQnwLifUD8DYi/APFbIP4MxH+AOKrdhsHIW5HBV1WJocvJjiFWR5NBBCiOjpmwYDAAANVGDQ4=');
IdleTrap_DTM[0] := DTMFromString('mrAAAAHic42BgYGBhhGBWIGYCYgYo5gRidqjcf6DQbyD+C8T/GBDqQHrcsvQY0sx0GNrdrRns4zUZ7GI1GSJarRjMglQYnFK0GSSBSvFhRgIYBgClWgvS');
IdleTrap_DTM[1] := DTMFromString('mggAAAHicY2NgYGAFYhYg5mKAADYonx2IuaF8EGaCyjtk6TGYhKsxOOUZMLiVGDG0hloxWMRqMsgB5USAmB9KwzAjDgwBAIuMBe4=');
end;
Procedure FreeGlobals;
Var
i: Integer;
begin
for i:=0 to High(IdleTrap_DTM) do
FreeDTm(IdleTrap_DTM[i]);
FreeDTm(InvTrap_DTM);
FreeDTm(ActiveTrap_DTM);
FreeDTm(BadTrap_DTM);
FreeDTm(GoodTrap_DTM);
end;
Procedure Report;
Var
HXPH: Integer;
begin
HuntXP := (CCount*350);
if (HuntXP < 1) then
HuntXP := 1;
HXPH := Round((HuntXP * 3600) / (GetTimeRunning / 1000));
ClearDebug;
SRLProgressReport(ResultDebugBox, 'Jadinko-Hunter', 'Flight', '0.01',
['Run time', 'Catches', 'Failed traps', 'Idle traps', 'Hunting XP',
'Hunting XP/Hr'],
[MsToTime(GetTimeRunning, Time_Abbrev), CCount, FCount, ICount, HuntXP, HXPH]);
MarkTime(ReportTimer);
end;
Function LoggedIn_F: Boolean;
var
x,y: Integer;
begin
Result := FindText(x, y, 'All', StatChars, 20, 480, 43, 498);
end;
Function FindTrapMessages: Boolean;
begin
Result := (FindBlackChatMessage('dismantle') Or
FindBlackChatMessage('ve caught') Or
ClickContinue(True,False));
end;
Function HandleTrap(Pnt: TPoint): Boolean;
var
X,Y: Integer;
label
ClickCTile;
begin
Result := False;
AL_MissMouse(Point(Pnt.X,Pnt.Y+3), 5, 0);
if WaitUptextMulti(['Shaking', 'Wilted'], 400) then
begin
AL_FastClick(mouse_right);
WaitOption('Walk', 500);
AL_MissMouse(Point(MSCX,MSCY+10), 5, 5);
if WaitFunc(@IsMoving, 10, 4000) then
begin
While IsMoving do
Wait(10);
ClickCTile:
AL_MissMouse(Point(MSCX,MSCY+10), 7, 3);
if WaitUptextMulti(['Shaking', 'Wilted'], 400) then
begin
AL_FastClick(mouse_right);
if not OptionsExist(['Check', 'Pick'], False) then
GoTo ClickCTile;
if OptionsExist(['Check'], False) then
if ChooseOption('Check') then
Inc(CCount)
else
GoTo ClickCTile;
if OptionsExist(['Pick'], False) then
if ChooseOption('Pick') then
Inc(FCount)
else
GoTo ClickCTile;
AL_MissMouse(Point(575,230), 15, 15);
WaitFunc(@FindTrapMessages, 10, 6000);
if not FindDTM(InvTrap_DTM, X, Y, MIX1, MIY1, MIX2, MIY2) then
Exit;
AL_MissMouse(Point(X,Y), 8, 8);
AL_FastClick(mouse_left);
if WaitFunc(@IsMoving, 10, 4000) then
begin
While IsMoving do
Wait(10);
Wait(RandomRange(350,675));
Result := True;
end;
end;
end;
end;
end;
Function FindTraps(TrapType: String): TPointArray;
var
tArr: Array [0..1] of TPointArray;
begin
Result := [];
Case TrapType of
'Active': FindDTMs(ActiveTrap_DTM,Result,MSCX-100,MSCY-100,MSCX+100,MSCY+100);
'Good': FindDTMs(GoodTrap_DTM,Result,MSCX-100,MSCY-100,MSCX+100,MSCY+100);
'Bad': FindDTMs(BadTrap_DTM,Result,MSCX-100,MSCY-100,MSCX+100,MSCY+100);
'Idle':
begin
FindDTMs(IdleTrap_DTM[0],tArr[0],MSCX-100,MSCY-100,MSCX+100,MSCY+100);
FindDTMs(IdleTrap_DTM[1],tArr[1],MSCX-100,MSCY-100,MSCX+100,MSCY+100);
Result := MergeATPA(tArr);
end;
end;
end;
Procedure CheckTraps;
var
iTraps,gTraps,bTraps: TPointArray;
begin
if not LoggedIn_F then Exit;
Repeat
iTraps := FindTraps('Idle');
if (Length(iTraps) > 0) then
begin
AL_MissMouse(iTraps[0], 5, 5);
if WaitUptext('Take', 400) then
begin
AL_FastClick(mouse_right);
if WaitOption('Lay', 500) then
Inc(ICount);
//Walk to the trap
if WaitFunc(@IsMoving, 10, 4000) then
begin
While IsMoving do
Wait(10);
end;
//Wait until the trap is set
if WaitFunc(@IsMoving, 10, 5000) then
begin
While IsMoving do
Wait(10);
end;
end;
end;
Until(Length(iTraps) = 0)
gTraps := FindTraps('Good');
if (Length(gTraps) > 0) then
HandleTrap(gTraps[0]);
bTraps := FindTraps('Bad');
if (Length(bTraps) > 0) then
HandleTrap(bTraps[0]);
end;
begin
SetupSRL;
LoadVars;
AddOnTerminate('FreeGlobals');
Repeat
if (TimeFromMark(ReportTimer)>=10000) then
Report;
FindNormalRandoms;
if not LoggedIn then Exit;
CheckTraps;
Until(False)
end.