r3dnoob
02-04-2010, 06:17 PM
{================================================= =============================]
[ DRAYNOR FISH 'N' BANK v1.7 ]
[================================================== ============================]
[ ]
[ Written By: Jimmy_Mac ]
[ ]
[================================================== ============================]
[ Instructions. ]
[================================================== ============================]
[ ]
[ 1. Fill in Declare Players (lines 22 - 76). ]
[ 2. Have either 'net' or 'rod and bait' in inventory. ]
[ 3. Start in Draynor Bank or at Fishing Spot. ]
[ ]
[================================================== ============================}
program DraynorFishNBank;
{.include SRL/SRL/Misc/SMART.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/fishing.scar}
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Total Number of Players.
CurrentPlayer := 0; //Starting Player.
NumberOfPlayers(HowManyPlayers);
Players[0].Name :=''; //Username.
Players[0].Pass :=''; //Password.
Players[0].Nick :=''; //Nickname. (4 Letters of your username)
Players[0].Active := True; //Is the player active?
Players[0].Pin := ''; //Leave blank if you dont have one.
Players[0].Integers[0] := 20; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[0].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[0].Integers[2] := 12; //Maximum time (in seconds) before catching a fish.
{
Players[1].Name :=''; //Username.
Players[1].Pass :=''; //Password.
Players[1].Nick :=''; //Nickname. (4 Letters of your username)
Players[1].Active := True; //Is the player active?
Players[1].Pin := ''; //Leave blank if you dont have one.
Players[1].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[1].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[1].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
Players[2].Name :=''; //Username.
Players[2].Pass :=''; //Password.
Players[2].Nick :=''; //Nickname. (4 Letters of your username)
Players[2].Active := True; //Is the player active?
Players[2].Pin := ''; //Leave blank if you dont have one.
Players[2].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[2].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[2].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
Players[0].Name :=''; //Username.
Players[0].Pass :=''; //Password.
Players[3].Nick :=''; //Nickname. (4 Letters of your username)
Players[3].Active := True; //Is the player active?
Players[3].Pin := ''; //Leave blank if you dont have one.
Players[3].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[3].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[3].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
}
end;
{************************************************* *****************************}
{* YOU DON'T NEED TO EDIT BELOW HERE *}
{************************************************* *****************************}
const
ClearTheDebug = True; //Clear the debug?
WriteToDebug = False; //See debug info. (For Dev)
Version = '1.7';
var
Net, Rod, Shrimp, Anchovie, Sardine, Herring, Bait, BankDots: Integer;
FindFishAttempts, FishingMax, PlainWater, ChatTime, NickChatTime : Integer;
StillFishing : Boolean;
Method, MethodChoose, Completed, Proggy: String;
CatchColor: Array of Integer;
function CompassInt:Integer;
begin
result := round(rs_GetCompassAngleDegrees);
end;
procedure Debug(text:String);
begin
if WriteToDebug then writeln(text);
end;
procedure MakePlayerInactive;
begin
if PlayersActive <= 1 then
begin
Players[CurrentPlayer].Active := False;
Logout;
end else NextPlayer(False);
end;
function RadialWalkTolWait(TheColor, Tol: Integer; StartRadial, EndRadial: Integer; Radius: Integer; Xmod, Ymod: Integer; waitTime:integer; flagDist:Integer): Boolean;
var
tpa : TPointArray;
i : Integer;
begin
Result := False;
StartRadial := StartRadial + (360 - CompassInt);
EndRadial := EndRadial + (360 - CompassInt);
if RadialWalkEx(tpa, MMCX, MMCY, TheColor, Tol, StartRadial, EndRadial, Radius) then
for i := 0 to High(tpa) do
if MFNF(tpa[i].x, tpa[i].y, Xmod, Ymod) then
begin
wait(waitTime*1000);
FFlag(flagDist);
Result := True;
Break;
end;
end;
procedure CheckChat;
var
HiChatR, HiChatBounce : TStringArray;
begin
if not (LoggedIn) then Exit;
HiChatR:= ['sup', 'yo', 'hey'];
HiChatBounce:= ['ima bounce', 'im off', 'catcha later', 'i g2g'];
if InChat(Players[CurrentPlayer].Nick) then
begin
if (TimeFromMark(NickChatTime) <= 180000) then
begin
TypeSend(HiChatBounce[random(4)]);
wait(500+random(1000));
while LoggedIn do LogOut;
SelectWorld(RandomWorld(False, False));
LoginPlayer;
NickChatTime := 0;
end else
begin
TypeSend(HiChatR[random(3)]);
MarkTime(NickChatTime);
end;
end;
if (TimeFromMark(ChatTime) >= 120000) or (ChatTime = 0) then
begin
if inChat('Fish') or Inchat('Fsh') then
begin
if InChat('lvl') or InChat('level') or InChat('Level') or InChat('Lvl') then
begin
Wait(2000 + random(1500));
TypeSendEx(chr(13), false);
wait(50+random(300));
TypeSendEx('x', false);
wait(50+random(300));
TypeSendEx('2', false);
MarkTime(ChatTime);
end;
end;
end;
end;
Procedure LoadDTMs;
begin
Shrimp := DTMFromString('78DA63CC67626078CD800236D6A73070016 94' +
'620FE0F048CD940357719D00013986484F218AB80FC8704D4 6463' +
'DA85A12616C87F4484391F09A84904F2DFE0570300041E0EF E');
Anchovie := DTMFromString('78DA63CC67626078CD8002CACB6B18B8803 42' +
'310FF0702C66CA09ABB0C6880094C3242798C5540FE43026A B231' +
'EDC250130BE43F22C29C8F04D42402F96FF0AB0100DDD70ED 4');
Sardine := DTMFromString('78DA637462606058C2800212D62432B0036 94' +
'620FE0F048CEE40C62C0634C0042619A13C464F20318F801A 3F20' +
'319F801A3B20B182801A1B20B194801A6720B18C801A90DF9 7E35' +
'70300FC570CC3');
Herring := DTMFromString('78DA63B4676260E0616440061B56AE60E00 7D' +
'220D1FF40C0E80A54C38AAA868181094CC244193D807C4E02 6A7C' +
'807C36026ACC8830C704C81720A0C619C8E727A0C616C817C 2AF0' +
'600B6A6089F');
Net := DTMFromString('78DA639CCEC4C0F084010518A9CB30B0036 94' +
'620FE0F048CF3816A6E33A0012630C908E5312E01F2EF1350 B310' +
'C87F4B404D2F90FF92809A1E20FF0101355380FC9BF8D5000 0A43' +
'10EF6');
Rod := DTMFromString('78DA637460626078CE8002221C7818D8813 42' +
'310FF0702465FA09AAB0C6880094C3242798C4E40FE5D026A AC81' +
'FCA704D49801F9AF08A8B107F23FE1570300A89F0BA3');
Bait := DTMFromString('78DA63B465626078CE800236364A31F0036 94' +
'620FE0F048CA640358F19D00013986484F218AD80FC4704D4 80EC' +
'7A40404D0090FF94801A0F20FF2D01351684D500000A580D8 4');
BankDots := DTMFromString('78DA63CC626260886540017FFE303170016 94' +
'620FE0F048C203561B8D58000584D2201358D4035D1A86A2C 4D4C' +
'197418116A00EA850E16');
end;
Procedure FreeDTMs;
begin
FreeDTM(Shrimp);
FreeDTM(Anchovie);
FreeDTM(Sardine);
FreeDTM(Herring);
FreeDTM(Net);
FreeDTM(Rod);
FreeDTM(Bait);
FreeDTM(BankDots);
end;
Procedure Bitmaps;
begin
PlainWater := BitmapFromString(24, 23, 'beNqbNL9r0igaRaN' +
'oFI2iUUQvBAAzoLtm');
end;
Procedure Antiban; //Credits to Ultra for a couple of these. :)
var x, y, rand: Integer;
begin
rand := random(120)+1;
if rand <= 8 then Debug('Running Antiban');
case rand of
1: MMouse(Random(500), Random(500), Random(500), Random(500));
2: SleepAndMoveMouse(random(5000));
3: IdleTime(Random(5000), 2, 5.2);
4: PickUpMouse;
5: RandomRClick;
6: if MouseSpeed < 15 then
IncEx(MouseSpeed, Random(5))
else
DecEx(MouseSpeed, Random(5));
7: begin
GetMousePos(x, y);
MMouse(x, y, 100, 100);
end;
8: BoredHuman;
end;
end;
Function Walk(where: String):Boolean;
begin
if not loggedin then exit;
case where of
'water': if RadialWalkTolWait(FindWaterColor, 5, 200, 215, 75, -5, 5, 4, 30) then Result := True else Result:=False;
'bank': if RadialWalkTolWait(3355960, 18, 10, 50, 67, 1, 1, 0, 5) then Result := True else Result:=False;
end;
end;
Procedure AddToProgress(text:String);
begin
Proggy := Proggy + text + chr(13);
end;
Procedure ProgressReport;
var
MultiplyBy : Integer;
LevelText : String;
begin
if Players[CurrentPlayer].Integers[3] > 0 then
begin
if Method = 'net' then MultiplyBy := 27 else MultiplyBy := 26;
AddToProgress('[============= DRAYNOR FISH N BANK ' + Version + ' =============]');
AddToProgress(PadR('[', 52) + ']');
AddToProgress(PadR('[ Player: ' + Players[CurrentPlayer].Name, 52) + ']');
AddToProgress(PadR('[ Total Loads Done: ' + IntToStr(Players[CurrentPlayer].Integers[3]) + '. That''s ' + IntToStr(Players[CurrentPlayer].Integers[3]*MultiplyBy) + ' Fish!', 52) + ']');
AddToProgress(PadR('[ Unless you have extra items in your inv. ;)', 52) + ']');
if Players[CurrentPlayer].Integers[4] = 1 then LevelText:='level';
if Players[CurrentPlayer].Integers[4] = 0 then LevelText:='levels';
if Players[CurrentPlayer].Integers[4] > 1 then LevelText:='levels';
AddToProgress(PadR('[ You have gained ' + IntToStr(Players[CurrentPlayer].Integers[4]) + ' ' + LevelText + ' on this player.', 52) + ']');
if Completed = '' then else AddToProgress(PadR('[ ' + Completed, 52) + ']');
if PlayersActive <= 1 then AddToProgress(PadR('[ Ran For: ' + TimeRunning, 52) + ']');
AddToProgress(PadR('[', 52) + ']');
AddToProgress('[================================================== =]');
AddToProgress('[ By Jimmy_Mac ]');
AddToProgress('[================================================== =]');
AddToProgress(chr(13)+chr(13));
end;
end;
procedure ScriptTerminate;
begin
ProgressReport;
if ClearTheDebug then ClearDebug;
WriteLn(Proggy);
end;
Procedure ProgReport;
begin
if ClearTheDebug then ClearDebug;
WriteLn(Proggy);
end;
procedure CatchColors;
var
DTMx, DTMy, i, b : Integer;
DTMArray: TVariantArray;
begin
LoadDTMs;
i := 0;
SetArrayLength(CatchColor, i+1);
SetArrayLength(DTMArray, 4);
DTMArray := [Shrimp, Anchovie, Sardine, Herring];
for b := 0 to High(DTMArray) do
if FindDTM(DTMArray[b], DTMx, DTMy, MIX1, MIY1, MIX2, MIY2) then
begin
SetArrayLength(CatchColor, i+1);
CatchColor[i] := GetColor(DTMx, DTMy);
i:= i+1;
end;
FreeDTMs;
end;
Function FindEquipment:Boolean;
var
X, Y : Integer;
begin
LoadDTMs;
if FindDTM(Net, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
Method := 'net';
MethodChoose := 'et';
Result := True;
end else
if FindDTM(Rod, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
if FindDTM(Bait, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
Method := 'rod';
MethodChoose := 'ait Fis';
Result := True;
end else Debug('Found rod, but no bait. :(');
end else
begin
Debug('Equipment Not Found!');
Logout;
ProgressReport;
MakePlayerInactive;
Result := False;
end;
FreeDTMs;
end;
Function MiniMap2MainScreen(x, y : Integer) : TPoint;
begin
if InRange(x, 600, 652) and InRange(y, 68, 102) then
begin
// result.x := round((x - 599) * 9.846153); //OLD
// result.y := round((y - 67) * 9.823529); //OLD
result.x := round((x - 601) * 10.66666);
result.y := round((y - 67) * 10.77419);
end;
end;
Function FindTheFishSpot: Boolean;
var
x, y, FSx, FSy, Margin : Integer;
FS_TPoint : TPoint;
begin
Margin := 30;
Repeat
Margin := Margin + 20;
if FindSymbol(FSx, FSy, 'fish') then FS_TPoint := MiniMap2MainScreen(FSx, FSy) else
begin
Debug('Couldn''t find the fishing symbol.');
Result := False;
ProgressReport;
MakePlayerInactive;
Exit;
end;
if FindColorSpiralTolerance(x, y, 11248540, FS_TPoint.x - Margin, FS_TPoint.y - Margin, FS_TPoint.x + Margin, FS_TPoint.y + Margin, 4) then
begin
MMouse(x, y, 2, 2);
wait(100 + random(300));
if method = 'net' then
begin
case random(4)+1 of //I prefer like this because this is how I would do it if I was playing.
1..3: mouse(x, y, 1, 1, true);
4: begin
Mouse(x, y, 1, 1, false);
wait(300 + random(300));
ChooseOption(MethodChoose);
end;
end;
FindFishAttempts := 0;
Result:=True;
wait(1000 + random(500));
exit;
end else
begin
Mouse(x, y, 1, 1, false);
wait(250 + random(300));
ChooseOption(MethodChoose);
FindFishAttempts := 0;
Result:=True;
wait(1000 + random(500));
exit;
end;
end;
until(Margin >= 150);
Inc(FindFishAttempts);
Result:=False;
end;
Procedure ClearVars;
var
i : Integer;
begin
for i := 0 to HowManyPlayers - 1 do
begin
Players[i].Integers[3] := 0;
Players[i].Integers[4] := 0;
if Players[i].Integers[0] = 0 then Players[i].Integers[0] := 100000000; //Random High Number.
if Players[i].Integers[1] = 0 then Players[i].Integers[1] := 100000000; //Random High Number.
end;
end;
Procedure Setup;
begin
SetupSRL;
wait(500);
DeclarePlayers;
if (not (loggedIn)) then LoginPlayer;
SymbolAccuracy := 0.4;
ClearVars;
end;
procedure WalkingToTheFish;
var
MMx, MMy : Integer;
begin
if not loggedin then exit;
if InvFull then exit;
FindNormalRandoms;
Setrun(true);
if FindSymbol(MMx, MMy, 'fish') then
begin
Status('Found Fish Symbol. Walking to It.');
Mouse(MMx, MMy, 5, 5, true);
wait(2500+random(1000));
FFlag(1);
end else
if Walk('water') then
begin
Status('Found Fishing Spot. Walking to It.');
if FindSymbol(MMx, MMy, 'fish') then Mouse(MMx, MMy, 5, 5, true);
end else
begin
Debug('Couldn''t walk to Fishing Spot. Exiting');
logout;
ProgressReport;
MakePlayerInactive;
end;
end;
Function InactiveWater:Boolean;
var
a, i, x, y : Integer;
begin
Bitmaps;
for i := 0 to 7 do
begin
if FindBitmapToleranceIn(PlainWater, x, y, 205, 173, 230, 198, 6) then
begin
inc(a);
wait(150);
end else wait(150);
end;
FreeBitmap(PlainWater);
if a >= 8 then
begin
Debug('Found Inactive water.');
Result := True;
end else
begin
Debug('Found Active water.');
Result := False;
end;
end;
procedure Fishing;
var
MMx, MMy, FishingStart, LastInvCount : Integer;
begin
FindFishAttempts := 0;
FishingMax := Players[CurrentPlayer].Integers[2]*1000;
StillFishing := False;
Status('Fishing');
Repeat
CheckChat;
if InRange(compassInt, 1, 355) then makeCompass(356 + random(5));
if not loggedin then exit;
SetAngle(True);
if LevelUp then
begin
Inc(Players[CurrentPlayer].Integers[4]);
if Players[CurrentPlayer].Integers[4] >= Players[CurrentPlayer].Integers[0] then
begin
Completed := 'Gained set amount of levels for this player.';
Debug(Completed);
Logout;
ProgressReport;
MakePlayerInactive;
exit;
end;
end;
FindNormalRandoms;
CheckChat;
if FindWhirlPoolMS then
begin
debug('Found Whirlpool');
HandleWhirlPool;
end;
GameTab(tab_Inv);
Antiban;
if not loggedin then exit;
if FindFishAttempts >= 5 then
begin
if not loggedin then exit;
Debug('Couldn''t find a spot to fish :(');
Logout;
MakePlayerInactive;
exit;
end;
FindNormalRandoms;
if not FindEquipment then
begin
if not loggedin then exit;
Debug('Couldn''t Find Equipment in Inventory :(');
Logout;
ProgressReport;
MakePlayerInactive;
exit;
end;
if InvFull then Exit;
if not StillFishing then
begin
if InvFull then Exit;
if FindTheFishSpot then
begin
if not loggedin then exit;
Debug('Found a spot to fish.');
StillFishing := True;
MarkTime(FishingStart);
LastInvCount := InvCount;
if InvFull then Exit;
end else
begin
if not loggedin then exit;
if FindSymbol(MMx, MMy, 'fish') then Mouse(MMx, MMy, 5,5, true);
fflag(1);
Debug('Couldn''t find a spot to fish. Walking to fish symbol to try again.');
LastInvCount := InvCount;
wait(1500 + random(500));
FindFishAttempts := FindFishAttempts + 1;
MarkTime(FishingStart);
end;
end;
CheckChat;
if InactiveWater then
begin
if not loggedin then exit;
if InvFull then Exit;
StillFishing := False;
LastInvCount := InvCount;
end;
if InvCount > LastInvCount then
begin
if not loggedin then exit;
if InvFull then Exit;
Debug('Caught a fish.');
LastInvCount := InvCount;
MarkTime(FishingStart);
StillFishing := True;
end;
CheckChat;
if (TimeFromMark(FishingStart)>=FishingMax) then
begin
if not loggedin then exit;
if InvFull then Exit;
Debug('Havn''t caught a fish in ' + IntToStr(FishingMax/1000)+ ' seconds');
StillFishing := False;
LastInvCount := InvCount;
end;
until(not LoggedIn or InvFull);
end;
procedure WalkingToTheBank;
var
MMx, MMy : Integer;
begin
if not loggedin then exit;
Wait(random(2500));
FindNormalRandoms;
SetRun(true);
LoadDTMs;
if FindDTM(BankDots, MMx, MMy, MSx1, MSy1, MSx2, MSy2) then
begin
FreeDTMs;
Status('Found Bank DTM. Walking to It.');
Debug('Found Bank DTM. Walking to It.');
Mouse(MMx, MMy, 3, 3, true);
FFlag(1);
wait(500 + random(300));
exit;
end else
if FindSymbol(MMx, MMy, 'bank') then
begin
Status('Found Bank Symbol. Walking to It.');
Debug('Found Bank Symbol. Walking to It.');
Mouse(MMx, MMy, 3, 3, true);
FFlag(1);
wait(500 + random(300));
exit;
end else if Walk('bank') then Status('Found Bank Via Radial Walking. Walking to It.') else
begin
Debug('Couldn''t walk to Bank. Exiting');
Logout;
ProgressReport;
MakePlayerInactive;
end;
end;
Procedure Banking;
var
ColorsFound, i, b, x, y, NPCx, NPCy : Integer;
BankNPC : TPoint;
begin
if not loggedin then exit;
FindNormalRandoms;
Status('Banking');
b := 0;
if random(5) = 0 then Antiban;
SetAngle(True);
LoadDTMs;
repeat
wait(800+random(500));
if not OpenBankFast('db') then
if not OpenBank('db', False, False) then
if not OpenBankQuiet('db') then
if not OpenBankNPC then
if not OpenBankGlass('db', False, False) then
if FindDTM(BankDots, NPCx, NPCy, 602, 68, 652, 99) then
begin
Debug('Found DTM of bank trying to click NPC using MiniMap2MainScreen function');
BankNPC := MiniMap2MainScreen(NPCx, NPCy);
Mouse(BankNPC.x, BankNPC.y, 0, 0, false);
wait(250 + random(200));
ChooseOption('ank B');
wait(250 + random(200));
end else
begin
Debug('Couldn''t open bank, changing location, retrying.');
WalkingToTheBank;
end;
inc(b);
wait(200+random(150));
until((b >= 5) or BankScreen or PinScreen);
FreeDTMs;
if PinScreen then
begin
Debug('Found Pin Screen Inputting PIN.');
InPin(Players[CurrentPlayer].Pin);
wait(400+random(300));
end;
if BankScreen then
begin
Debug('Found Bank Screen.');
CatchColors;
ColorsFound := GetArrayLength(CatchColor);
if ColorsFound = 0 then
begin
Debug('Array has no colors');
Logout;
ProgressReport;
MakePlayerInactive;
Exit;
end;
if not loggedin then exit;
if random(2) = 0 then swap(CatchColor[0],CatchColor[1]); //So it doesnt always click on the shrimps first.
for i:=0 to ColorsFound-1 do
If findcolortolerance(x, y, CatchColor[i], MIX1, MIY1, MIX2, MIY2, 5) then
begin
Debug('Depositing Fish');
Mouse(x, y, 4, 4, false);
wait(50+random(100));
ChooseOption('osit-All');
wait(500+random(400));
Players[CurrentPlayer].Integers[3] := Players[CurrentPlayer].Integers[3] + 1;
if (Players[CurrentPlayer].Integers[3] >= Players[CurrentPlayer].Integers[1]) then
begin
Completed := 'Banked the set amount of loads for this player.';
Debug(Completed);
Logout;
ProgressReport;
MakePlayerInactive;
end;
end;
case random(3)+1 of
1: CloseBank;
end;
end else
begin
if not loggedin then exit;
Debug('Couldn''t open bank screen');
Logout;
ProgressReport;
MakePlayerInactive;
end;
end;
begin
Setup;
Repeat
WalkingToTheFish;
Fishing;
WalkingToTheBank;
Banking;
until(AllPlayersInactive);
ProgReport;
end. thats Exactly what I get, he has like 800 lines
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.