SCAR Code:
{------------------------------------------------------------------------------]
._________.
\____ \ __
/ / | | ____
/ / _____ ._______ | |____.___ ___.____\ /______
/ / / ___ \ ___ \ _ \ \/ / _ \/ ____/
./ /__\ ____/| ___/ | | |\ /| | \_/\____ \
\_________\______\| | |__| |__| \ / |__| /______/
|___| Ver 1.0 /__/ Karamja Fisher
By ZephyrsFury
[------------------------------------------------------------------------------]
[ >>>> DESCRIPTION <<<< ]
[------------------------------------------------------------------------------]
Will fish you Lobsters, Swordfish and Tuna in Karamja and bank in Draynor.
Uses Reflection - a new method of autoing that 'spies' on the RS client using
SMART to retrieve information that can be manipulated for our benefit.
[------------------------------------------------------------------------------]
[ >>>> CURRENT FEATURES <<<< ]
[------------------------------------------------------------------------------]
o Reflection - Uses Reflection.
o Antiban - Includes the most recent and effective antiban.
o Multi-player - Well whats the good of autoing with one char?
[------------------------------------------------------------------------------]
[ >>>> INSTRUCTIONS <<<< ]
[------------------------------------------------------------------------------]
1. Make sure you have the Reflection includes.
2. Start with the necessary fishing equipment plus coins in your inv.
3. Have extra fishing gear and coins in your bank.
4. Declare your players.
5. Place your players at the Bank/Port Sarim/Karamja Dock/Fishing Spots or
anywhere along the path. (Script will auto-detect your position).
6. Start the script!
[------------------------------------------------------------------------------]
[ >>>> ADDITIONAL CREDITS <<<< ]
[------------------------------------------------------------------------------]
o SRL Developers - For the best RS Cheating library and community.
o Jagex - Couldn't have done it without you or your game.
o Reflection Devs - Thanks for the Reflection includes.
[------------------------------------------------------------------------------]
[ I DO NOT AND WILL NOT TAKE RESPONSIBILITY FOR ANY ACTION TAKEN AGAINST YOUR ]
[ ACCOUNT(S) AS A RESULT OF USING MY SCRIPT. USE IT AT YOUR OWN RISK!!! ]
[ ]
[ PLEASE DON'T POST THIS SCRIPT ON ANY OTHER WEBSITES WITHOUT MY KNOWLEDGE ]
[ AND CONSENT. PM ZephyrsFury ON srl-forums.com. ]
[------------------------------------------------------------------------------}
program New;
{.include SRL/SRL/misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Reflection/Reflection.scar}
const
SmartWorldNo = 119; //The world on which you want to auto.
Signed = True; //Signed Java Client?
SRLStatsID = ''; //SRL Stats ID
SRLStatsPass = ''; //SRL Stats Password
procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name := ''; //Player username
Players[0].Pass := ''; //Player password
Players[0].Nick := ''; //4 - 5 chars to minimise probs with the autoresponder
Players[0].Active := True; //Is the player active (do you want to auto on this acc)?
Players[0].Pin := ''; //Bank Pink, leave as '' for no bank pin... MUST BE A STRING!
Players[0].Integers[0] := 5; //Loads before switching. Less loads = less randoms
Players[0].Strings[0] := 'Cage'; //'Cage', 'Harpoon' or 'Highest''
end;
{------------------------------------------------------------------------------]
[ ]
[ DON'T HAVE TO TOUCH ANYTHING BELOW HERE ]
[ ]
[------------------------------------------------------------------------------}
//Integers[10] := PlayerFishCount;
//Integers[11] := TotalLoadCount;
//Integers[12] := PlayerMins
type
TFishEquip = record
Name, Text: string;
Level, DTM, FishDTM: Integer;
end;
var
x, y, Sx, Sy, I, T, C: Integer;
FishEquip: TFishEquip;
Paths: array of T2DPointArray;
AntiBanMark, RunTime, TabsCountTo, TabsCounter: Integer;
FishCount, TotalFishCount, TotalLoads, LevelsGained, CurLoads: Integer;
TotalLobCount, TotalTunaCount, TotalSwordCount: Integer;
LobDTM, TunaDTM, SwordDTM, CoinBitmap: Integer;
TP: TPoint;
const
TestMode = False;
TakeScreenshots = False;
VerNumber = '1.0';
procedure LoadPaths;
begin
SetLength(Paths, 2);
SetLength(Paths[0], 2); //Bank to Port Sarim
Paths[0][0] := [
Point(3092, 3245),
Point(3082, 3251),
Point(3072, 3260),
Point(3060, 3264),
Point(3047, 3263),
Point(3041, 3252),
Point(3032, 3243),
Point(3028, 3230),
Point(3029, 3217)
];
Paths[0][1] := [
Point(3092, 3245),
Point(3078, 3250),
Point(3072, 3262),
Point(3057, 3264),
Point(3054, 3251),
Point(3042, 3243),
Point(3029, 3236),
Point(3028, 3225),
Point(3029, 3217)
];
SetLength(Paths[1], 2); //Karamja Dock to Fishing spots
Paths[1][0] := [
Point(2956, 3146),
Point(2942, 3145),
Point(2929, 3152),
Point(2917, 3151),
Point(2914, 3164),
Point(2924, 3172),
Point(2924, 3180)
];
Paths[1][1] := [
Point(2956, 3146),
Point(2941, 3146),
Point(2928, 3151),
Point(2918, 3158),
Point(2921, 3169),
Point(2924, 3180)
];
end;
{------------------------------------------------------------------------------]
[ procedure LoadDTMs; ]
[ by: ZephyrsFury ]
[ Description: Loads the required DTMs. ]
{------------------------------------------------------------------------------}
procedure LoadDTMs;
begin
LobDTM := DTMFromString('78DA630C646660906664400665CEB20C3A402' +
'190E87F20607406AA5142550391859140DA1BA8468C809A50A01A' +
'61026AC2816A2409A88904AA5121A006E42F0D026A7C806A94F1A' +
'B01003C1408A6');
TunaDTM := DTMFromString('78DA63F467666070646440064B67CD64D0010' +
'A8144FF0301A313508D17AA1A882C8C04D29E40353E04D48401D5' +
'B81050E30D546343404D20116A62816A9CF0AB010081E40A30');
SwordDTM := DTMFromString('78DA6354676660106764400627E65D60D0010' +
'A8144FF0301A338508D06AA1A882C8C04D29A40355204D4E803D5' +
'281250630A54234D408D1C508D2401356A40357C04D4E801D508E' +
'3570300DFF208A3');
CoinBitmap := LoadCoinBMP;
end;
{------------------------------------------------------------------------------]
[ procedure TakeScreenie(s: string); ]
[ by: ZephyrsFury ]
[ Description: Takes a screenshot. ]
{------------------------------------------------------------------------------}
procedure TakeScreenie(s: string);
begin
if (not(TakeScreenShots)) then Exit;
try
SaveScreenShot(ScriptPath + s + ' = ' + TheDate(3) + ' = ' + TimeRunning + '.bmp');
WriteLn('Screenshot saved: ' + ScriptPath + s + ' = ' + TheDate(3) + ' = ' + TimeRunning + '.bmp');
except
WriteLn('Failed to save screenshot: ' + s);
end;
end;
function ClickObject(id :integer): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
Mouse(xX.x,xX.y,2,2,true);
Wait(30 + Random(10));
FindNormalRandoms;
end;
end;
{------------------------------------------------------------------------------]
[ procedure WriteDebug(Text: string); ]
[ by: ZephyrsFury ]
[ Description: Writes to the Debug box or status bar depending on TestMode. ]
{------------------------------------------------------------------------------}
procedure WriteDebug(Text: string);
begin
case TestMode of
True: Writeln(Players[CurrentPlayer].Loc + ' - ' + Text);
False: Status(Players[CurrentPlayer].Loc + ' - ' + Text);
end;
end;
{------------------------------------------------------------------------------]
[ function TimeToGo: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Returns true when its time to go. ]
{------------------------------------------------------------------------------}
function TimeToGo: Boolean;
begin
Result := ((CurLoads mod Players[CurrentPlayer].Integers[0] = 0) and (CurLoads <> 0))
or (not(LoggedIn));
end;
{------------------------------------------------------------------------------]
[ pprocedure ProgressReport; ]
[ by: ZephyrsFury ]
[ Description: Displays the progress report. ]
{------------------------------------------------------------------------------}
procedure ProgressReport;
var
SNick, SLvl, SLoads, SFish, STime, SAct, SLoc: string;
DateTime, Temp2, Top, Temp1: string;
Spaces, PlayerMin, Exp: Integer;
begin
DateTime := '[' + TheDate(1) + ', ' + TheTime + ']';
Spaces := 86 - Length(DateTime);
Temp1 := DateTime;
for i := 0 to Ceil(Spaces / 2) - 1 do
Insert(' ', Temp1, 2);
Temp2 := Temp1;
for i := 0 to Floor(Spaces / 2) - 1 do
Insert(' ', Temp2, Length(Temp1));
Top := '[------------------------------------------------------------------------------------]';
WriteLn('');
WriteLn(Top);
WriteLn(Temp2);
WriteLn('[------------------------------------------------------------------------------------]');
WriteLn('[ >>> Zephyr`s Karamja Fisher Ver '+VerNumber+' <<< ]');
WriteLn('[------------------------------------------------------------------------------------]');
WriteLn(PadR('[ Total Time Running: ' + TimeRunning, 85) + ']');
WriteLn(PadR('[ Total Loads Done: ' + IntToStr(TotalLoads), 85) + ']');
WriteLn(PadR('[ Total Fish Caught: ' + IntToStr(TotalFishCount), 85) + ']');
if (TotalLobCount > 0) then
WriteLn(PadR('[ o Lobsters: ' + IntToStr(TotalLobCount), 85) + ']');
if (TotalSwordCount > 0) then
WriteLn(PadR('[ o Swordfish: ' + IntToStr(TotalSwordCount), 85) + ']');
if (TotalTunaCount > 0) then
WriteLn(PadR('[ o Tuna: ' + IntToStr(TotalTunaCount), 85) + ']');
WriteLn(PadR('[ Fishing Rate: ' + IntToStr(Round((TotalFishCount * 3600) / (GetTimeRunning / 1000))) + ' Fish/Hr', 85) + ']');
Exp := (TotalLobCount * 90) + (TotalSwordCount * 100) + (TotalTunaCount * 80);
WriteLn(PadR('[ Total Fishing Exp Gained: ' + IntToStr(Exp), 85) + ']');
WriteLn(PadR('[ Experience Gain Rate: ' + IntToStr(Round((Exp * 3600) / (GetTimeRunning / 1000))) + ' Exp/Hr', 85) + ']');
WriteLn(PadR('[ Fishing Levels Gained: ' + IntToStr(LevelsGained), 85) + ']');
WriteLn('[------------------------------------------------------------------------------------]');
WriteLn('[ | Nick | Act | Loc | Lvl | Loads | Fish | Time ]');
PlayerMin := Round(TimeFromMark(RunTime) / 1000 / 60);
Players[CurrentPlayer].Integers[12] := Players[CurrentPlayer].Integers[12] + PlayerMin;
MarkTime(RunTime);
for i := 0 to High(Players) do
begin
SNick := PadR(' ' + Players[i].Nick, 6);
SAct := PadR(' ' + BoolToStr(Players[i].Active)[1], 5);
SLoc := PadR(' ' + Players[i].Loc, 34);
SLvl := PadR(' ' + IntToStr(Players[i].Level[17]), 6);
SLoads := PadR(' ' + IntToStr(Players[i].Integers[11]), 7);
SFish := PadR(' ' + IntToStr(Players[i].Integers[10]), 6);
STime := ' ' + IntToStr(Players[i].Integers[12]) + ' min';
WriteLn(PadR('[ o |' + SNick + '|' + SAct + '|' + SLoc + '|' + SLvl +
'|' + SLoads + '|' + SFish + '|' + STime, 85) + ']');
end;
WriteLn('[------------------------------------------------------------------------------------]' );
WriteLn('');
SRLRandomsReport;
end;
{------------------------------------------------------------------------------]
[ procedure AntiBanProc; ]
[ by: ZephyrsFury ]
[ Description: Does antiban. ]
{------------------------------------------------------------------------------}
procedure AntiBanProc;
var
Dx, Dy, j, k, Chance: Integer;
TP: TPoint;
begin
if (not(LoggedIn)) then Exit;
if (TimeFromMark(AntiBanMark) < 30000 + Random(10000)) then Exit;
Chance := Random(40) + 1;
case (Chance) of
1: begin
WriteDebug('Antiban 1');
GetClientDimensions(x, y);
MMouse(Random(x), Random(y), 0, 0);
Wait(200 + random(100));
if (IsUpText('opti')) then
begin
GetMousePos(Dx, Dy);
Mouse(Dx, Dy, 0, 0, false);
Wait(200 + random(100));
ChooseOption('xamine');
end;
Wait(1000 + Random(500));
end;
2: begin
if (Random(5) = 1) then
begin
WriteDebug('Antiban 2');
HoverSkill('random', false);
GameTab(4);
end;
end;
3: begin
if (Random(5) = 1) then
begin
WriteDebug('Antiban 3');
HoverSkill('fishing', false);
GameTab(4);
end;
end;
4: begin
if (InvCount < 1) then Exit;
j := Random(28) + 1;
if (ExistsItem(j)) then
begin
WriteDebug('Antiban 4');
TP := ItemCoords(j);
Mouse(TP.x, TP.y, 0, 0, false);
Wait(200 + random(100));
ChooseOption('xamine');
Wait(1000);
Wait(1000 + Random(500));
end;
end;
5: begin
WriteDebug('Antiban 5');
PickUpMouse;
Wait(500 + Random(500));
end;
6: begin
WriteDebug('Antiban 6');
GetClientDimensions(Dx, Dy);
MMouse(Random(Dx) + 1, Random(Dy) + 1, 0, 0);
Wait(500 + random(500));
end;
7: begin
WriteDebug('Antiban 7');
GameTab(Random(14) + 1);
Wait(500 + Random(500));
GameTab(4);
end;
8: begin
WriteDebug('Antiban 8');
SleepAndMoveMouse(5000 + Random(1000));
end;
9: begin
if (Random(5) <> 0) then Exit;
if (GetColor(500, 361) <> 1975337) then Exit;
WriteDebug('Antiban 9');
k := Random(3) + 1;
for I := 0 to k do
begin
if (GetColor(500, 361) <> 1975337) then Break;
j := RandomRange(523, 2127);
MarkTime(T);
MouseBox(498, 348, 507, 357, 3);
GetMousePos(x, y);
HoldMouse(x, y, True);
while (TimeFromMark(T) < j) do
Wait(1);
ReleaseMouse(x, y, True);
if (Random(3) = 0) then
MouseBox(x - 50, y - 50, x + 50, y + 50, 3);
Wait(1000 + Random(1500));
end;
FixChat;
end;
10: begin
if (Players[CurrentPlayer].Loc <> 'Fish') then Exit;
WriteDebug('Antiban 10');
k := Random(6);
for I := 0 to k do
begin
case I of
0: R_MakeCompass(IntToStr(Round(GetMinimapAngleDeg) - 90 + Random(181)));
{1: R_SetAngle(RandomRange(0, 50));}
2: R_MakeCompass(IntToStr(Round(GetMinimapAngleDeg) - 30 + Random(61)));
{3: R_SetAngle(RandomRange(25, 75));}
4: R_MakeCompass(IntToStr(Round(GetMinimapAngleDeg) - 45 + Random(91)));
{5: R_SetAngle(RandomRange(50, 100));}
end;
end;
if (Random(4) = 0) then {R_}SetAngle(True);
if (Random(4) = 1) then R_MakeCompass('N');
end;
else Exit;
end;
MarkTime(AntiBanMark);
end;
{------------------------------------------------------------------------------]
[ function GetClosestTileInPath(Path: TPointArray): Integer; ]
[ by: ZephyrsFury ]
[ Description: Returns the array index of the Point in the TPA closest to us. ]
{------------------------------------------------------------------------------}
function GetClosestTileInPath(Path: TPointArray): Integer;
var
x, y, Last, II, Dist: Integer;
Me : Tme;
begin
Me := GetMe;
Last := 1 shl 20;
for II := 0 to High(Path) do
begin
Dist := Distance(Me.tile.x, Me.tile.y, Path[II].x, Path[II].y);
if (Dist > Last) then Continue;
Last := Dist;
Result := II;
end;
end;
{------------------------------------------------------------------------------]
[ function WalkMyPath(Path: TPointArray; FirstToLast: Boolean): Boolean; ]
[ by: ZephyrsFury ]
[ Description: Walks a path using reflection. ]
{------------------------------------------------------------------------------}
function WalkMyPath(Path: TPointArray; FirstToLast: Boolean): Boolean;
var
Closest, Nxt, LastPt, Incr, Att: Integer;
begin
LastPt := High(Path) * Integer(FirstToLast);
Incr := Integer(FirstToLast) * 2 - 1;
Closest := GetClosestTileInPath(Path);
if (DistanceFrom(Path[Closest]) > 3) then
if (not(WalkToTile(Path[Closest], 5, 3))) then
begin
WriteLn('Too far from Path to start walking...');
Exit;
end else
begin
AntiBanProc;
{R_}FFlag(10);
FindNormalRandoms;
end;
Att := 0;
while (GetClosestTileInPath(Path) <> LastPt) do
begin
Nxt := GetClosestTileInPath(Path) + Incr;
WriteLn('Walking to Path Index: ' + IntToStr(Nxt) + ' (' + IntToStr(Path[Nxt].x) +', ' + IntToStr(Path[Nxt].y) + ').');
if (not(WalkToTile(Path[Nxt], 5, 3))) then
begin
if (Att > 3) then Break;
Inc(Att);
while (CharacterMoving) do
Wait(100);
FindNormalRandoms;
end else Att := 0;
AntiBanProc;
{R_}FFlag(10);
FindNormalRandoms;
end;
Result := GetClosestTileInPath(Path) = LastPt;
end;
{------------------------------------------------------------------------------]
[ function GetPlayerLoc: string; ]
[ by: ZephyrsFury ]
[ Description: Returns the players location based on your position on the map.]
{------------------------------------------------------------------------------}
function GetPlayerLoc: string;
var
px, py, J, Closest, L: Integer;
cPath: TPointArray;
Me : Tme;
begin
Result := '';
Me := GetMe;
L := 10;
if (PointInBox(Point(Me.tile.x, Me.tile.y), IntToBox(3092 - L, 3243 - L, 3092 + L, 3243 + L))) then
Result := 'Bank'
else
if (PointInBox(Point(Me.tile.x, Me.tile.y), IntToBox(3028 - L, 3220 - L, 3028 + L, 3220 + L))) then
Result := 'Sarim'
else
if (PointInBox(Point(Me.tile.x, Me.tile.y), IntToBox(2956 - L, 3146 - L, 2956 + L, 3146 + L))) then
Result := 'Karamja'
else
if (PointInBox(Point(Me.tile.x, Me.tile.y), IntToBox(2924 - L, 3180 - L, 2924 + L, 3180 + L))) then
Result := 'Fish'
else
begin
for I := 0 to High(Paths) do
for J := 0 to High(Paths[i]) do
begin
cPath := Paths[i][J];
Closest := GetClosestTileInPath(cPath);
if (TileOnMM(cPath[Closest])) then
begin
WalkToTile(cPath[Closest], 5, 3);
{R_}FFlag(0);
Result := 'On Path ' + IntToStr(I);
Exit;
end;
end;
end;
end;
{------------------------------------------------------------------------------]
[ function OpenTheBank: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Opens the bank. ]
{------------------------------------------------------------------------------}
function OpenTheBank: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (BankScreen) then
begin
Result := True;
Exit;
end;
WriteDebug('Opening Bank');
if (OpenBankReflection('db')) then
begin
Wait(500 + Random(1000));
Result := True;
Exit;
end else
if (OpenBank('db', False, False)) then
begin
Wait(500 + Random(1000));
Result := True;
Exit;
end;
end;
{------------------------------------------------------------------------------]
[ function FindFishingGear: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Returns true if you have the required gear and money. ]
{------------------------------------------------------------------------------}
function FindFishingGear: Boolean;
var
Amt: Integer;
begin
GameTab(4);
case (GetPlayerLoc) of
'Karamja', 'Fish', 'On Path 1': Amt := 30;
else Amt := 60;
end;
Result := FindDTM(FishEquip.DTM, x, y, MIX1, MIY1, MIX2, MIY2) and (CoinAmount('inv') >= Amt);
end;
{------------------------------------------------------------------------------]
[ procedure ArrangeFishingGear; ]
[ by: ZephyrsFury ]
[ Description: Arranges the gear in inventory. ]
{------------------------------------------------------------------------------}
procedure ArrangeFishingGear;
begin
if (FindDTM(FishEquip.DTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
I := CoordsToItem(x, y);
if (I <> 1) then DragItem(i, 1);
end;
Wait(500 + Random(500));
if (FindBitmapToleranceIn(CoinBitmap, x, y, MIX1, MIY1, MIX2, MIY2, 50)) then
begin
I := CoordsToItem(x, y);
if (I <> 2) then DragItem(i, 2);
end;
Wait(500 + Random(500));
end;
{------------------------------------------------------------------------------]
[ function GetFishingGear: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Finds the fishing gear and gets it from the bank if that fails.]
{------------------------------------------------------------------------------}
function GetFishingGear: Boolean;
var
T, WithdrawAmt: Integer;
begin
if (not(LoggedIn)) then Exit;
if (not(FindFishingGear)) then
begin
if (GetPlayerLoc <> 'Bank') then Exit;
if (not(BankScreen)) then
begin
OpenTheBank;
if PinScreen then InPin(Players[CurrentPlayer].Pin);
end;
if (BankScreen) then
begin
if (not(FindDTM(FishEquip.DTM, x, y, MIX1, MIY1, MIX2, MIY2))) then
begin
WriteLn('Withdrawing ' + FishEquip.Name + '...');
SearchBank(Lowercase(FishEquip.Name));
Wait(500 + Random(500));
if (FindDTM(FishEquip.DTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
begin
Mouse(x, y, 5, 5, True);
T := GetSystemTime;
while (not(FindDTM(FishEquip.DTM, x, y, MIX1, MIY1, MIX2, MIY2))) and (GetSystemTime - T < 3000) do
Wait(200);
WriteLn('Withdrew ' + FishEquip.Name + '.');
end;
end;
if (CoinAmount('inv') < 60) then
begin
WriteLn('Withdrawing Coins...');
SearchBank('coins');
Wait(500 + Random(500));
if (FindBitmapToleranceIn(CoinBitmap, x, y, 30, 87, 476, 286, 50)) then
begin
Mouse(x, y, 5, 5, False);
Wait(200 + Random(200));
ChooseOption('raw-X');
Wait(500 + Random(500));
WithdrawAmt := RandomRange(500, 1000);
TypeSend(IntToStr(WithdrawAmt));
WriteLn('Withdrew ' + IntToStr(WithdrawAmt) + ' coins.');
T := GetSystemTime;
while (CoinAmount('inv') < 60) and (GetSystemTime - T < 3000) do
Wait(200);
end;
Wait(500 + Random(500));
end;
end;
CloseBank;
Result := FindFishingGear;
end else Result := True;
ArrangeFishingGear;
end;
{------------------------------------------------------------------------------]
[ function LostFishingGear: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Checks to see if you've lost your gear. ]
{------------------------------------------------------------------------------}
function LostFishingGear: Boolean;
begin
if (not(FindColor(x, y, 0, 7, 460, 69, 474))) then
Result := (not(FindFishingGear));
if (Result) then
ClickContinue(True, True);
end;
{------------------------------------------------------------------------------]
[ function FindWhirlPool(ax, ay: Integer): Boolean; ]
[ by: ZephyrsFury ]
[ Description: Finds Whirlpools on Tile (ax, ay). ]
{------------------------------------------------------------------------------}
function FindWhirlPool(ax, ay: Integer): Boolean;
var
WhirlPool: array of TNPC;
II: Integer;
begin
WhirlPool := SortNPCs(GetNPCs);
for II := 0 to High(WhirlPool) do
if (WhirlPool[II].Ms.X = ax) and (WhirlPool[II].Ms.Y = ay) then
begin
Result := (WhirlPool[II].NPCType = 405);
if (Result) then Exit;
end;
end;
{------------------------------------------------------------------------------]
[ function Fishing: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Returns true if you're currently fishing with a cage or harpoon]
{------------------------------------------------------------------------------}
function Fishing: Boolean;
var Me : Tme;
begin
Me := GetMe;
Result := (InRange(Me.Animation, 618, 619));
end;
{------------------------------------------------------------------------------]
[ function ClickFishingSpot(var ax, ay: Integer): Boolean; ]
[ by: ZephyrsFury ]
[ Description: Finds and clicks a Cage/Harpoon fishing spot. ]
{------------------------------------------------------------------------------}
function ClickFishingSpot(var ax, ay: Integer): Boolean;
var
fsNPC: array of TNPC;
Tx, Ty, II, T: Integer;
begin
FindNormalRandoms;
fsNPC := SortNPCs(GetNPCsByID(324));
if (Length(fsNPC) = 0) then
begin
WriteDebug('Could not find fishing spot!');
Exit;
end;
for II := 0 to High(fsNPC) do
begin
x := 0; y := 0;
{ if (TileOnMS(fsNPC[II], fsNPC[II].Height)) then
TileToMS(fsNPC[II], fsNPC[II].Height); }
x := fsNPC[II].Ms.X; y := fsNPC[II].Ms.Y;
ax := fsNPC[II].Ms.X; ay := fsNPC[II].Ms.Y;
if (FindWhirlPool(ax, ay)) then Continue;
if (x = 0) and (y = 0) then
begin
WriteDebug('Fishing spot not on MS.');
// TileToMM(fsNPC[II]);
Mouse(fsNPC[II].MM.X, fsNPC[II].MM.Y, 4, 4, True);
{R_}FFlag(0);
MMouse(fsNPC[II].Ms.X, fsNPC[II].Ms.Y, 0, 0);
Result := ClickFishingSpot(ax, ay);
Exit;
end;
WriteDebug('Found fishing spot at ' + IntToStr(x) + ', ' + IntToStr(y) + '.');
Mouse(x, y, 0, 0, False);
Wait(100 + Random(100));
if (ChooseOption(FishEquip.Text)) then
begin
T := GetSystemTime;
while (not(Fishing)) and (GetSystemTime - T < 3000) do
Wait(100);
if (Fishing) then Break;
end;
end;
Result := (Length(fsNPC) > 0) and (II <= High(fsNPC));
end;
{------------------------------------------------------------------------------]
[ procedure HandleTalk; ]
[ by: ZephyrsFury ]
[ Description: Handles talk with the Seaman and Customs officer. ]
{------------------------------------------------------------------------------}
procedure HandleTalk;
var
Messages: TStringArray;
II: Integer;
begin
Messages := ['Yes', 'journey', 'nothing', 'Ok.'];
while (not(FindColor(x, y, 0, 7, 460, 69, 474))) do
begin
ClickContinue(True, True);
for II := 0 to High(Messages) do
if (FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, Messages[II], NPCChars, ClickLeft)) then
Wait(500 + Random(500));
end;
end;
{------------------------------------------------------------------------------]
[ function TalkToNPC(Who: string): Boolean; ]
[ by: ZephyrsFury ]
[ Description: Talks to the 'Seaman' or the 'Customs officer'. ]
{------------------------------------------------------------------------------}
function TalkToNPC(Who: string): Boolean;
var
NPC: TNPC;
Tx, Ty: Integer;
begin
{R_}FFlag(0);
for c := 0 to 2 do
if (FindNPC(Who, NPC)) then
begin
x := 0; y := 0;
x := NPC.MS.X;
y := NPC.MS.Y;
if (x = 0) and (y = 0) then
begin
WriteDebug(Who + ' is not on the main screen.');
// TileToMM(NPC.TileX, NPC.TileY, Tx, Ty);
Mouse(NPC.MM.X, NPC.MM.Y, 5, 5, True);
{R_}FFlag(0);
while (CharacterMoving) do
Wait(100);
Result := TalkToNPC(Who);
Exit;
end;
WriteDebug('Found ' + Who + ' at ' + IntToStr(x) + ', ' + IntToStr(y) + '.');
Mouse(x, y, 0, 0, False);
Wait(100 + Random(100));
if (ChooseOption('Pay')) then
begin
FFlag(0);
while (CharacterMoving) do
Wait(100);
Wait(1000 + Random(1000));
HandleTalk;
T := GetSystemTime;
while (CountColor(65536, MMX1, MMY1, MMX2, MMY2) < 10000) and (GetSystemTime - T < 5000) do
Wait(100);
Result := (CountColor(65536, MMX1, MMY1, MMX2, MMY2) > 10000);
if (Result) then Exit;
end;
end else WriteDebug('Could not find ' + Who + '!');
end;
{------------------------------------------------------------------------------]
[ function CrossGangPlank: Boolean; ]
[ by: ZephyrsFury ]
[ Description: Finds and clicks the gangplank on the boat to/from Karamja. ]
{------------------------------------------------------------------------------}
function CrossGangPlank: Boolean;
var
py, II: Integer;
px: Tpoint;
Me : Tme;
begin
for II := 0 to 3 do
begin
Me := getMe;
case (GetPlayerLoc) of
'Sarim': TP := Point(Me.tile.x - 1, Me.tile.y);
'Karamja': TP := Point(Me.tile.x, Me.tile.y + 1);
end;
{R_}SetAngle(True);
px := TileToMS(TP, 0);
MMouse(px.X, px.y, 0, 0);
Wait(100 + Random(50));
if (IsUpText('Cross')) then
begin
Mouse(px.X, px.y, 0, 0, True);
T := GetSystemTime;
while (CountColor(65536, MMX1, MMY1, MMX2, MMY2) >= 10000) and (GetSystemTime - T < 5000) do
Wait(100);
Result := (CountColor(65536, MMX1, MMY1, MMX2, MMY2) < 10000);
if (Result) then Exit;
end;
Wait(1000 + Random(500));
end;
end;
{------------------------------------------------------------------------------]
[ procedure CheckLevel; ]
[ by: ZephyrsFury ]
[ Description: Checks for level-ups. ]
{------------------------------------------------------------------------------}
procedure CheckLevel;
var
TempLevel, LvlDiff: Integer;
Me: Tme;
begin
if (not(LoggedIn)) then Exit;
Me := GetMe;
TempLevel := Me.levels[10];
LvlDiff := (TempLevel - Players[CurrentPlayer].Level[17]);
if (LvlDiff > 0) then
begin
WriteLn('We gained a level!');
IncEx(ReportVars[4], LvlDiff);
IncEx(LevelsGained, LvlDiff);
Players[CurrentPlayer].Level[17] := TempLevel;
SRLRandomsReport;
ClickContinue(True, True);
end;
end;
{------------------------------------------------------------------------------]
[ procedure Location(PLoc: string); ]
[ by: ZephyrsFury ]
[ Description: Sets the players location to PLoc. ]
{------------------------------------------------------------------------------}
procedure Location(PLoc: string);
begin
Players[CurrentPlayer].Loc := PLoc;
WriteLn('Location: ' + PLoc);
end;
{------------------------------------------------------------------------------]
[ procedure WeAreLost(PlayerLoc: string); ]
[ by: ZephyrsFury ]
[ Description: Logs out, sets Player.Active to false and Loc to PlayerLoc. ]
{------------------------------------------------------------------------------}
procedure WeAreLost(PlayerLoc: string);
begin
TakeScreenie(PlayerLoc);
if (Players[CurrentPlayer].Rand <> '') then
begin
Location(Players[CurrentPlayer].Rand);
Players[CurrentPlayer].Active := False;
LogOut;
end else
begin
Location('Lost - ' + PlayerLoc);
Players[CurrentPlayer].Active := False;
LogOut;
end;
end;
{------------------------------------------------------------------------------]
[ procedure Intro; ]
[ by: ZephyrsFury ]
[ Description: Displays intro. ]
{------------------------------------------------------------------------------}
procedure Intro;
begin
WriteLn('');
WriteLn(' ._________. ');
Wait(100);
WriteLn(' \____ \ __ ');
Wait(100);
WriteLn(' / / | | ____ ');
Wait(100);
WriteLn(' / / _____ ._______ | |____.___ ___.____\ /______ ');
Wait(100);
WriteLn(' / / / ___ \ ___ \ _ \ \/ / _ \/ ____/ ');
Wait(100);
WriteLn(' ./ /__\ ____/| ___/ | | |\ /| | \_/\____ \ ');
Wait(100);
WriteLn(' \_________\______\| | |__| |__| \ / |__| /______/ ');
Wait(100);
WriteLn(' |___| Ver ' + VerNumber + ' /__/ Karamja Fisher ');
WriteLn('');
Status('Zephyr''s Karamja Fisher ' + VerNumber);
end;
{------------------------------------------------------------------------------]
[ procedure ScriptTerminate; ]
[ by: ZephyrsFury ]
[ Description: Called when the script terminates. ]
{------------------------------------------------------------------------------}
procedure ScriptTerminate;
begin
FreeDTM(LobDTM);
FreeDTM(SwordDTM);
FreeDTM(TunaDTM);
ProgressReport;
Writeln('Thanks for using Zephyr''s Karamja Fisher');
end;
{------------------------------------------------------------------------------]
[ procedure SetupScript; ]
[ by: ZephyrsFury ]
[ Description: Sets up the script. ]
{------------------------------------------------------------------------------}
procedure SetupScript;
begin
ClearDebug;
Intro;
SmartSetupEx(SmartWorldNo, False, Signed, False);
SetTargetDC(SMARTGetDC);
SetupSRL;
ScriptID := '942';
SRLID := SRLStatsID;
SRLPassword := SRLStatsPass;
for I := 0 to High(Players) do
begin
Players[i].Loc := Capitalize(Players[i].Loc);
Players[i].Strings[0] := Capitalize(Players[i].Strings[0]);
end;
LoadDTMs;
LoadPaths;
DeclarePlayers;
LoginPlayer;
{SetAudioOff;}
end;
{------------------------------------------------------------------------------]
[ procedure SetupPlayer; ]
[ by: ZephyrsFury ]
[ Description: Sets up the players. ]
{------------------------------------------------------------------------------}
procedure SetupPlayer;
var
me: Tme;
begin
Me := GetMe;
CurLoads := 0;
MarkTime(AntiBanMark);
MarkTime(RunTime);
R_MakeCompass('n');
{R_}SetAngle(True);
Players[CurrentPlayer].Level[17] := Me.Levels[10];
Players[CurrentPlayer].Level[8] := Me.Levels[3];
WriteLn('Fishing Level is ' + IntToStr(Players[CurrentPlayer].Level[17]));
if (Players[CurrentPlayer].Level[17] < FishEquip.Level) then
begin
WeAreLost('Too Low Fishing');
Exit;
end;
if (Players[CurrentPlayer].Strings[0] = 'Highest') then
begin
if (InRange(Players[CurrentPlayer].Level[17], 40, 49)) then
Players[CurrentPlayer].Strings[0] := 'Cage'
else
Players[CurrentPlayer].Strings[0] := 'Harpoon';
end;
case (Players[CurrentPlayer].Strings[0]) of
'Cage': with FishEquip do
begin
Name := 'Lobster Pot';
Text := 'Cage';
Level := 40;
DTM := DTMFromString('78DA63D46564608805622490E0C4C3A003140' +
'289FE0702462D202B10550D4416460269054C7330D4280159C904' +
'D4180159D904D4D8005971F8D500000A9A0833');
end;
'Harpoon': with FishEquip do
begin
Name := 'Harpoon';
Text := 'Harpoon';
Level := 35;
DTM := DTMFromString('78DA63D46364608801622490E0C1C3A003140' +
'289FE07024655202B07550D44164602694D202B81801A034CBB30' +
'D4E80359A104D4980259E104D418025961F8D50000596408C7');
end;
end;
SetAllChats('on', 'off', '', '', '');
FindNormalRandoms;
if (not(GetFishingGear)) then
begin
WeAreLost('No Fishing Gear');
Exit;
end;
if (GetPlayerLoc <> '') then
Location(GetPlayerLoc)
else
begin
WeAreLost('Loc detection failed');
WriteLn('Script Failed to detect your location.');
end;
end;
{------------------------------------------------------------------------------]
[ procedure PlayerLoop; ]
[ by: ZephyrsFury ]
[ Description: The player loop. ]
{------------------------------------------------------------------------------}
procedure PlayerLoop;
begin
repeat
if (Players[CurrentPlayer].Loc = 'Bank') then
begin
if (InvCount > 2) or (not(GetFishingGear)) then
begin
Location('At Bank');
PlayerLoop;
Exit;
end;
Location('Bank To Sarim');
end else
if (Players[CurrentPlayer].Loc = 'Bank To Sarim') then
begin
SetRun(True);
if (WalkMyPath(Paths[0][Random(Length(Paths[0]))], True)) then
Location('Sarim To Karamja')
else
begin
WeAreLost('Bank To Sarim Failed');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'Sarim To Karamja') then
begin
if (TalkToNPC('Seaman')) then
begin
T := GetSystemTime;
while (GetColor(496, 22) <> 100398) and (GetSystemTime - T < 10000) do
Wait(100);
T := GetSystemTime;
while (GetColor(496, 22) = 100938) and (GetSystemTime - T < 20000) do
Wait(1000);
if (Random(3) = 0) then ClickContinue(True, True);
if (not(CrossGangPlank)) then
begin
WeAreLost('Gang Plank Failed');
Exit;
end;
if (GetPlayerLoc = 'Karamja') then
Location('Karamja To Fish')
else
begin
WeAreLost('Ship Boarding Failed');
Exit;
end;
end else
begin
WeAreLost('No Sailor');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'Karamja To Fish') then
begin
SetRun(True);
if (WalkMyPath(Paths[1][Random(Length(Paths[1]))], True)) then
Location('Fish')
else
begin
WeAreLost('Karamja To Fish Failed');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'Fish') then
begin
SetRun(True);
while (LoggedIn) and (InvCount < 28) do
begin
if (ClickFishingSpot(Sx, Sy)) then
begin
MarkTime(TabsCounter);
TabsCountTo := 35000 + Random(5000);
while (Fishing) do
begin
if (not(LoggedIn)) then Break;
Wait(500 + Random(3000));
if (TimeFromMark(TabsCounter) >= TabsCountTo) and (TimeFromMark(AntiBanMark) >= 15000 + Random(5000)) then
begin
WriteDebug('Switching Tabs to avoid logging out...');
GameTab(Random(14) + 1);
Wait(1000 + Random(500));
GameTab(4);
TabsCountTo := 35000 + Random(5000);
MarkTime(TabsCounter);
MarkTime(AntiBanMark);
GetClientDimensions(x, y);
MMouse(Random(x), Random(y), 0, 0);
end;
AntiBanProc;
FindNormalRandoms;
if (FindFight) then
begin
WalkMyPath([Paths[1][1][5], Paths[1][1][4], Paths[1][1][3]], True);
Wait(5000 + Random(5000));
WalkMyPath([Paths[1][1][5], Paths[1][1][4], Paths[1][1][3]], False);
Inc(Fights);
Break;
end;
if (FindWhirlPool(Sx, Sy)) then
begin
WriteLn('WhirlPool Detected...');
Inc(WhirlPools);
Break;
end;
if (LostFishingGear) then
begin
WriteLn('You seem to have lost your Fishing Gear, going back to bank...');
Location('Fish To Karamja');
Exit;
end;
CheckLevel;
end;
Wait(500 + Random(3000));
end;
end;
if (InvFull) then
begin
WriteLn('Inventory Full, going back to Bank');
Location('Fish To Karamja');
end;
end else
if (Players[CurrentPlayer].Loc = 'Fish To Karamja') then
begin
SetRun(True);
if (WalkMyPath(Paths[1][Random(Length(Paths[1]))], False)) then
Location('Karamja To Sarim')
else
begin
WeAreLost('Fish To Karamja Failed');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'Karamja To Sarim') then
begin
if (TalkToNPC('Customs officer')) then
begin
T := GetSystemTime;
while (GetColor(496, 22) <> 100398) and (GetSystemTime - T < 5000) do
Wait(100);
T := GetSystemTime;
while (GetColor(496, 22) = 100398) and (GetSystemTime - T < 20000) do
Wait(1000);
if (Random(3) = 0) then ClickContinue(True, True);
if (not(CrossGangPlank)) then
begin
WeAreLost('Gang Plank Failed');
Exit;
end;
if (GetPlayerLoc = 'Sarim') then
Location('Sarim To Bank')
else
begin
WeAreLost('Ship Boarding Failed');
Exit;
end;
end else
begin
WeAreLost('No Customs officer');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'Sarim To Bank') then
begin
SetRun(True);
if (WalkMyPath(Paths[0][Random(Length(Paths[0]))], False)) then
Location('At Bank')
else
begin
WeAreLost('Sarim To Bank Failed');
Exit;
end;
end else
if (Players[CurrentPlayer].Loc = 'At Bank') then
begin
WriteDebug('Opening Bank..');
if (OpenTheBank) then
begin
if PinScreen then InPin(Players[CurrentPlayer].Pin);
WriteDebug('Depositing Fish...');
if (Players[CurrentPlayer].Strings[0] = 'Cage') then
begin
FishCount := CountItems(LobDTM, 'dtm', []);
IncEx(Players[CurrentPlayer].Integers[10], FishCount);
IncEx(TotalFishCount, FishCount);
IncEx(ReportVars[1], FishCount);
IncEx(TotalLobCount, FishCount);
end;
if (Players[CurrentPlayer].Strings[0] = 'Harpoon') then
begin
FishCount := CountItems(SwordDTM, 'dtm', []);
IncEx(Players[CurrentPlayer].Integers[10], FishCount);
IncEx(TotalFishCount, FishCount);
IncEx(ReportVars[2], FishCount);
IncEx(TotalSwordCount, FishCount);
FishCount := CountItems(TunaDTM, 'dtm', []);
IncEx(Players[CurrentPlayer].Integers[10], FishCount);
IncEx(TotalFishCount, FishCount);
IncEx(ReportVars[3], FishCount);
IncEx(TotalTunaCount, FishCount);
end;
Deposit(3, 28, True);
Inc(Players[CurrentPlayer].Integers[11]);
Inc(TotalLoads);
Inc(ReportVars[0]);
Inc(Banks);
Inc(CurLoads);
end else
begin
WeAreLost('Open Bank Failed');
Exit;
end;
if (not(GetFishingGear)) then
begin
WeAreLost('No Fishing Gear');
Exit;
end;
CloseBank;
Location('Bank');
ProgressReport;
end else
if (Players[CurrentPlayer].Loc = 'Karamja') then
begin
if (CountColor(65536, MMX1, MMY1, MMX2, MMY2) > 10000) then
if (not(CrossGangPlank)) then
begin
WeAreLost('Gang Plank Failed');
Exit;
end;
if (InvCount > 14) then Location('Karamja To Sarim')
else Location('Karamja To Fish');
end else
if (Players[CurrentPlayer].Loc = 'Sarim') then
begin
if (CountColor(65536, MMX1, MMY1, MMX2, MMY2) > 10000) then
if (not(CrossGangPlank)) then
begin
WeAreLost('Gang Plank Failed');
Exit;
end;
if (InvCount > 14) then Location('Sarim To Bank')
else Location('Sarim To Karamja');
end else
if (Pos('On Path', Players[CurrentPlayer].Loc) > 0) then
begin
case (Players[CurrentPlayer].Loc[9]) of
'0': Location('Sarim To Bank');
'1': Location('Karamja To Fish');
end;
end;
until(TimeToGo);
end;
begin
SetupScript;
repeat
SetupPlayer;
PlayerLoop;
if (AllPlayersInactive) then Break;
NextPlayer(Players[CurrentPlayer].Active);
until(False);
end.