program MultiFighter;
{==============================================================================]
[ MultiFighter by marpis ]
[ ]
[ NAME : MultiFighter ]
[ WRITER : marpis ]
[ DESCRIPTION : Fights any monster with melee, ranged and magic ]
[ ]
[==============================================================================]
[ ]
[ INSTRUCTIONS ]
[ ]
[==============================================================================]
[ First read: ]
[ o http://www.villavu.com/forum/showthread.php?t=45849 ]
[ ]
[ Screenshots and Autoresponder logs will be saved to your Scripts folder. ]
[ ]
[ SMART-Instructions ]
[ o If you want to use SMART, you must have Reflection installed. ]
[ Get Reflection installer here: ]
[ http://www.villavu.com/forum/showthread.php?t=38932 ]
[ o To activate SMART, uncomment line 65. ]
[ o If you want to use Reflection, you must activate SMART. ]
[ ]
[ ]
[ FightMode ]
[ o Melee ]
[ - 'Attack' ]
[ - 'Strength' ]
[ - 'Defence' ]
[ - 'Even' <- Trains the lowest melee skill ]
[ o Ranged <- Will only wield regular arrows if ran out of ammo ]
[ - 'Accurate' ]
[ - 'Rapid' ]
[ - 'Longrange' ]
[ o Magic ]
[ ]
[ !!! KEEP THE RUNES THAT ARE CONSUMED WITH EVERY CAST IN THE !!! ]
[ !!! 1st INVENTORY SLOT !!! ]
[ ]
[ 'wind strike' OR '1' ]
[ 'water strike' OR '2' ]
[ 'earth strike' OR '3' ]
[ 'fire strike' OR '4' ]
[ ]
[ 'wind bolt' OR '5' ]
[ 'water bolt' OR '6' ]
[ 'earth bolt' OR '7' ]
[ 'fire bolt' OR '8' ]
[ ]
[ 'wind blast' OR '9' ]
[ 'water blast' OR '10' ]
[ 'earth blast' OR '11' ]
[ 'fire blast' OR '12' ]
[ ]
[ 'wind wave' OR '13' ]
[ 'water wave' OR '14' ]
[ 'earth wave' OR '15' ]
[ 'fire wave' OR '16' ]
[ ]
[==============================================================================]
[ PICKING UP ITEMS ]
[==============================================================================]
[
[ o PickupFocus := [1, 1] // Bones? Other?
[ This will pick 1 pile of Bones, then 1 other item you have declared
[
[ o PickupFocus := [5, 0] // Bones? Other?
[ This will pick 5 piles of Bones, and continue fighting
[
[
[==============================================================================]
[ SMART SETTINGS ]
[==============================================================================}
{.include SRL/SRL/misc/smart.scar} // <-- UNCOMMENT THIS TO USE SMART!
{.include SRL/SRL.scar}
const
World = 151; // World number?
Members = True; // Members world?
Signed = True; // Signed client?
UseReflection = False; // Use Reflection?
{==============================================================================}
// don't touch this
type
mUser = record
Name, Nick, Pass, RunDir, FightMode, FightStyle: string;
Active: Boolean;
CombatSetup: TBooleanArray;
Others: array [0..1] of TBooleanArray;
MonsterColors, PickupColors, PickupFocus: TIntegerArray;
Levels, XPG, SXP, LevelUps: array [0..6] of integer;
BoxReward, MonsterNames, PickupNames: TStringArray;
ProtectedItems: array of Variant;
HueMod, SatMod: extended;
MonTol, KillTime, SpecialPower: integer;
end;
{==============================================================================]
[ SCRIPT SETTINGS ]
[==============================================================================}
const
MousSpeed = 17; // Mouse Speed
LoopTime = 60; // How many minutes to play before switching players
SleepTime = '2h 20m'; // Example: '6h 15m' sleeps every 6th hour 15th minute
SleepFor = '8h 00m'; // Example: '1h 30m' sleeps for 1 hour and 30 minutes
SaveLogs = False; // Save screenshots and autoresponder logs?
AntiRandoms = False; // Set False if FindNormalRandoms is not working
CheckUpText = False; // Set False if GetUpText is not working
CalcXP = True; // Calculate XP Gained
RightClickOnly = True; // Only right click monsters?
{==============================================================================]
[ DECLARE PLAYERS ]
[==============================================================================}
var mFighter: array of mUser; SRLName: string;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // How many Players are you using? (including inactive)
CurrentPlayer := 0; // Starting Player?
SetArrayLength(mFighter, HowManyPlayers);
NumberOfPlayers(HowManyPlayers);
// Your name in the SRL Forums
SRLName := '';
// PLAYER 0
with mFighter[0] do
begin
Name := '';
Nick := '';
Pass := '';
Active := True;
FightMode := 'Strength'; // Read instructions above
MonsterColors := [15650121, 10526330];
KillTime := 60; // Max time to wait in battle in seconds
MonsterNames := ['arrior', 'iant'];
PickupColors := [5867168, 6916216, 2699141]; // Bone picking on line 143
PickupNames := ['harm', 'une'];
PickupFocus := [0, 3] // Bones? Other?
ProtectedItems := ['thril', 1, 2, 5];
CombatSetup := [True, True, True]; // Multicombat zone? Eat food? SpecialAttack?
SpecialPower := 100; // If you use Special Attacks (P2P only) how much power does it drain?
Others[0] := [False, False]; // Use MM? AutoResponder?
Others[1] := [False, False]; // Autotalk? Drop crap? Open doors?
RunDir := 'W'; // N, E, S, W
BoxReward := ['dama', 'thril', 'oin', 'ash', 'motion'];
end;
end;
{================ DON'T TOUCH ANYTHING BELOW =================================}
const
version = '2.55';
{.include SRL/SRL/Misc/Debug.scar}
{.include SRL/SRL/Skill/Prayer.scar}
{.include SRL/SRL/Misc/DoorProfiles.scar}
{$IFDEF SRL_SMART}
{.include SRL/SRL/Reflection/Reflection.scar}
{$ENDIF}
var //global variables
RoundMark, SleepMark, ReportMark, fails, TalkTimer, BMPFood: integer;
RespondedChatLines, MyResponds: TStringArray;
function FS_Mouse(x, y, rx, ry: integer; left: boolean): Boolean;
begin
if (x > 0) and (y > 0) then
begin
Result := True;
Mouse(x, y, rx, ry, left);
end;
end;
function FS_MMouse(x, y, rx, ry: integer): Boolean;
begin
if (x > 0) and (y > 0) then
begin
Result := True;
MMouse(x, y, rx, ry);
end;
end;
function WUT(Text: string; Time: Integer): boolean;
var
T: Integer;
begin
T := GetSystemTime + Time + Random(50);
repeat
Wait(50 + Random(20));
Result := IsUpText(Text);
if Result then
Exit;
until(GetSystemTime > T);
end;
procedure FRan;
begin
if AntiRandoms then
FindNonInventoryRandoms;
end;
{*******************************************************************************
function SendEmail(MyEmail, Subject, EmailMessage, SenderEmail, SenderName, Website: string): Boolean;
By: TRiLeZ
Description: Sends an email using PHP and SCAR.
*******************************************************************************}
function SendEmail(MyEmail, Subject, EmailMessage, SenderEmail, SenderName, Website: string): Boolean;
var
Email : string;
Client : Integer;
begin
Client := InitializeHTTPClient(False, False);
ClearPostData(Client);
Wait(20);
AddPostVariable(Client, 'email', MyEmail);
AddPostVariable(Client, 'message', EmailMessage);
AddPostVariable(Client, 'name', SenderName);
AddPostVariable(Client, 'subject', Subject);
AddPostVariable(Client, 'sender', SenderEmail);
Email := PostHTTPPageEx(Client, Website);
FreeHTTPClient(Client);
if (Email > '') then Result := true
else
begin
Result := false;
Writeln('Emailing User Failed!');
end;
end;
procedure SRLPlayers;
var
i, ii: integer;
begin
for i:= 0 to High(mFighter) do
begin
players[i].Name := mFighter[i].Name;
players[i].Pass := mFighter[i].Pass;
players[i].Nick := mFighter[i].Nick;
players[i].Active := mFighter[i].Active;
SetLength(players[i].BoxRewards, Length(mFighter[i].BoxReward));
for ii:= 0 to High(mFighter[i].BoxReward) do
players[i].BoxRewards[ii]:= mFighter[i].BoxReward[ii];
end;
end;
function PixelShift(x1, y1, x2, y2, t: integer): integer;
var
bmp, bmp2, x, y: integer;
begin
bmp := BitmapFromString((x2 -x1), (y2 - y1), '');
bmp2 := BitmapFromString((x2 -x1), (y2 - y1), '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), x1, y1, x2, y2, 0, 0, (x2 - x1), (y2 - y1));
wait(t);
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp2), x1, y1, x2, y2, 0, 0, (x2 - x1), (y2 - y1));
for x := 1 to (x2 - x1) do
for y := 1 to (y2 - y1) do
if FastGetPixel(bmp2, x, y) <> FastGetPixel(bmp, x, y) then
Inc(result);
FreeBitmap(bmp);
FreeBitmap(bmp2);
end;
function m_IsMoving: boolean;
begin
{$IfDef SRL_SMART}
if UseReflection then
begin
result := CharacterMoving;
exit;
end;
{$EndIf}
result := PixelShift(MMCX-30, MMCY-30, MMCX+30, MMCY+30, 500) > 200;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function FindAllHPBars: TPointArray;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function m_FindAllHPBars: TPointArray;
var
i, H, CTS: integer;
ATPA: T2DPointArray;
begin
SetLength(ATPA, 2);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(ATPA[0], 49236, msx1, msy1, msx2, msy2, 5);
FindColorsTolerance(ATPA[1], 590002, msx1, msy1, msx2, msy2, 5);
ColorToleranceSpeed(CTS);
ATPA[0] := MergeATPA(ATPA);
ATPA := TPAtoATPAEx(ATPA[0], 52, 5);
H := High(ATPA);
for i := 0 to H do
begin
SetLength(Result, Length(Result) + 1);
Result[i] := MiddleTPA(ATPA[i]);
end;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function IsInFight(x, y: integer): Boolean;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function IsInFight(x, y: integer): Boolean;
var
P: TPointArray;
i, H: integer;
begin
P := m_FindAllHPBars;
SortTPAFrom(P, Point(x, y));
H := High(P);
for i := 0 to H do
begin
Result := Distance(P[i].x, P[i].y, x, y) < 25;
if Result then exit;
end;
end;
procedure DrawBox(b : TBox);
var
T: Integer;
drawing : TBitmap;
begin
drawing := TBitmap.Create;
drawing.canvas.handle := GetTargetDC;
drawing.canvas.Pen.Color := CLRED;
MarkTime(T);
repeat
drawing.canvas.moveto(B.x1,B.y1);
drawing.canvas.LineTo(B.x2,B.y1);
drawing.canvas.LineTo(B.x2,B.y2);
drawing.canvas.LineTo(B.x1,B.y2);
drawing.canvas.LineTo(B.x1,B.y1);
wait(30);
until(TimeFromMark(T) > 200);
end;
procedure DrawBoxes(Points: TPointArray);
var
i, T : integer;
drawing : TBitmap;
B : Tbox;
begin
drawing := TBitmap.Create;
drawing.canvas.handle := GetTargetDC;
drawing.canvas.Pen.Color := CLRED;
MarkTime(T);
repeat
for i:= 0 to High(Points) do
begin
B := IntToBox(Points[i].X - 20, Points[i].Y - 20, Points[i].X + 20, Points[i].Y + 20);
drawing.canvas.moveto(B.x1,B.y1);
drawing.canvas.LineTo(B.x2,B.y1);
drawing.canvas.LineTo(B.x2,B.y2);
drawing.canvas.LineTo(B.x1,B.y2);
drawing.canvas.LineTo(B.x1,B.y1);
end;
wait(20);
until(TimeFromMark(T) > 200);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function m_FindObjects
var Objs: TPointArray Here the found objects are stored
width, height: Size of the object
colors: TIntegerArray, object colors
tolerance: Color tolerance
accuracy: Minimum amount of pixels per object
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function m_FindObjects(var Objs: TPointArray; width, height: integer; colors: TIntegerArray; accuracy, tolerance: integer; HueMod, SatMod: extended; ExcludeSelf: boolean): boolean;
var
TPA, TempTPA: TPointArray;
ATPA: T2DPointArray;
i, CTS: integer;
P: TPoint;
Box: TBox;
begin
if not loggedin then exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(HueMod, SatMod);
Box:= IntToBox(245, 145, 275, 180);
for I := 0 to High(Colors) do
begin
FindColorsSpiralTolerance(MSCX, MSCY, TempTPA, colors[i], MSX1, MSY1, MSX2, MSY2, tolerance);
TPA:= CombineTPA(TPA, TempTPA);
end;
ColorToleranceSpeed(CTS);
if (Length(TPA) < Accuracy) then
Exit;
ATPA := SplitTPAEx(TPA, Width, Height);
SetArrayLength(Objs, Length(ATPA));
Result := True;
SortATPASize(ATPA, true);
for I := 0 to High(ATPA) do
begin
P := MiddleTPA(ATPA[I]);
if (PointInBox(P, Box) and ExcludeSelf) or (Length(ATPA[i]) < Accuracy) then
begin
Swap(ATPA[I], ATPA[High(ATPA)]);
SetLength(ATPA, High(ATPA));
end else
Objs[i] := P;
end;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function GetArrowCount:integer;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function GetArrowCount:integer;
begin
GameTab(tab_Equip);
result := GetAmount(680, 250);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function RangedInFight: boolean;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function RangedInFight: boolean;
var
a, t: integer;
begin
a:= GetArrowCount;
MarkTime(t);
repeat
wait(10+random(100));
result:= GetArrowCount < a;
until(result or (TimeFromMark(t)> 3999));
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function posexx(substrarr: TStringArray; str: string): integer;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function PosExx(substrarr: TStringArray; str: string): integer;
var
i: integer;
begin
for i:= 0 to High(SUBstrarr) do
begin
result:= pos(lowercase(substrarr[i]), lowercase(str));
if (result > 0) then
exit;
end;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{ function Autotalk(seconds: integer): boolean;
seconds is the minimun time between responds. Use it if you like it!
remember to include posexx() too!
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
function Autotalk(seconds: integer): boolean;
var
i, ii: integer;
MyLevels: array [0..23] of integer;
ChatLines, Senders, Messages: array [0..7] of string;
TSA: TStringArray;
s: string;
responded: boolean;
begin
if (TimeFromMark(TalkTimer) < seconds*1000) then exit;
// Read messages in the chatbox
for i:= 1 to 8 do
begin
Senders[i-1]:= lowercase(GetChatboxText(i, clBlack));
Messages[i-1]:= lowercase(GetChatboxText(i, clChat));
ChatLines[i-1]:= Senders[i-1] + Messages[i-1];
end;
// Find triggers
for i:= 7 downto 0 do
begin
if (pos(players[currentplayer].nick, Senders[i])=0) then
if not InStrArr(ChatLines[i], RespondedChatLines, false) then
begin
{================================== LEVELS ===========================================================}
if (posexx(['att','str','def','rang','pray', 'magi', 'runecra', 'rc lvl', 'hp', 'health', 'hitpoints', 'agi', 'herb', 'thiev', 'craft', 'fletch', 'slay', 'mining', 'smith', 'fishing', 'cook', 'fm', 'firemak', 'wc', 'woodcut', 'farm'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Levels');
GetAllLevels;
for ii := 0 to 23 do
Mylevels[ii] := players[currentplayer].Level[ii+1];
// Attack
if pos('att', Messages[i])>0 then
begin
TSA:= ['att ', 'attack ', 'attlvl ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[0]);
end;
// Strength
if pos('str', Messages[i])>0 then
begin
TSA:= ['str ', 'strength ', 'strlvl ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[1]);
end;
// Defence
if pos('def', Messages[i])>0 then
begin
TSA:= ['def ', 'defence ', 'deflvl ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[2]);
end;
// Ranged
if pos('rang', Messages[i])>0 then
begin
TSA:= ['rang ', 'ranged ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[3]);
end;
// Prayer
if pos('pray', Messages[i])>0 then
begin
TSA:= ['pray ', 'prayer ', 'praylvl ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[4]);
end;
// Magic
if pos('mag', Messages[i])>0 then
begin
TSA:= ['mag ', 'magic ', 'maglvl ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[5]);
end;
// HP
if posexx(['hp', 'healt'], Messages[i])>0 then
begin
TSA:= ['hp ', 'healt ', 'health ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[7]);
end;
// Slayer
if (posexx(['slay'], Messages[i])>0) and (posexx(['ampir', 'ragon', 'dslay', 'vslay'], Messages[i])=0) then
begin
TSA:= ['slayer ', 'slaying ']
s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[13]);
end;
// S A Y T H E L I N E
s:= Trim(s);
if s = '' then
begin
writeln('ERROR: Autorespond failed');
exit;
end;
writeln(s);
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
TypeSend(s);
end else
{================================== MAX HIT ====================================================}
if (posexx(['max hit', 'maxhit'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Max hit');
TSA:= ['over 9000!!','more than yours nub','i can 1 hit kalphite queen','too much','you cant even imagine it','insane','not your business','wanna try on arena'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================ BOT ACCUSE ===============================================}
if (posexx(['bot', 'auto', 'macro'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Max hit');
TSA:= ['haha 8P','lololol','couldnt care less actually','ehmm lol','yea right', 'sure thing lol'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================== ABUSE ====================================================}
if (posexx(['noob', 'nuub', 'nob', 'newb', 'nyyp', 'nuup', 'noop', 'idiot', 'moron', 'fuk u', 'fuc u', 'fk u', 'fc u', 'fkc u', 'fuk you', 'fuc you'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Abuse');
TSA:= ['phewt','pfft','yea right','haha', 'lolol', 'hahaha', 'omglol'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================= WHAT'S UPS ================================================}
if (posexx(['whatup', 'wazzup', 'wazup', 'watap', 'watup', 'wat up', 'what''s up', 'whatsup', 'whats up', 'wasup', 'wassup'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Greetings');
TSA:= ['im cool','fine','okay','im bored','nuttin','nothin'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================= GREETINGS =================================================}
if (posexx(['hi', 'hello', 'hey', 'hai', 'yoyo', 'yo yo'], Messages[i])>0)
and (posexx(['high', 'they', 'hide', 'chicken', 'hint', 'phail', 'think'], Messages[i])=0) then
begin
responded:= true;
writeln('Answering: Greetings');
TSA:= ['hi there','yo yo','wasup','whatap','whats up','hello'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================ COMPLIMENTS ==============================================}
if (posexx(['nice', 'cool', 'kewl', 'great', 'awesome', 'sweet', 'fancy'], Messages[i])>0) and
(posexx(['weapon', 'shield', 'armor', 'plate', 'pl8', 'cape', 'helm', 'staff', 'sword', 'gear', 'body', 'leg', 'name', 'hit', 'pants', 'trousers', 'shirt'], Messages[i])>3) then
begin
responded:= true;
writeln('Answering: Compliments');
TSA:= ['heh thanks','ty','thanks dude','yup','lol','not rly'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================ FRIEND REQUEST ===========================================}
if (posexx(['iends?'], Messages[i])>0) then
begin
responded:= true;
writeln('Answering: Friend request');
TSA:= ['ehmm no ty','thx but no thx','not interested','mm naaah','lol no ty','not rly'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end else
{================================ JUST NAME ================================================}
if pos(players[currentplayer].nick, Messages[i])>0 then
begin
responded:= true;
writeln('Answering: Name mentioned');
TSA:= ['ya', 'yo', 'hmmh', 'yup'];
s := TSA[random(Length(TSA))];
SetLength(MyResponds, Length(MyResponds)+1);
MyResponds[High(MyResponds)] := s;
Typesend(s);
end;
{===========================================================================================}
// end of triggers
result:= responded;
if result then
begin
MarkTime(TalkTimer);
SetLength(RespondedChatLines, Length(RespondedChatLines)+1);
RespondedChatLines[High(RespondedChatLines)] := ChatLines[i];
exit;
end;
end;
end;
end;
procedure SetupPlayer; forward;
procedure NextP(a: boolean);
begin
NextPlayer(a);
repeat
wait(1000);
until(GetColor(MSCX, MSCY) <> 0);
SetupPlayer;
end;
function SwitchPlayers: boolean;
var
i, ii: integer;
begin
for i := 0 to 4 do
begin
case i of
0:Result := TimeFromMark(RoundMark) > LoopTime*60*1000;
1:Result := not mFighter[currentplayer].Active;
2:begin
for ii := 0 to 19 do
if not loggedin then wait(1000) else break;
Result := not loggedin;
end;
3:Result := fails > 19;
4:Result := not TabExists(tab_Combat);
end;
if result then
begin
writeln('SWITCH PLAYERS: ');
case i of
0: writeln('Switching time!');
1: writeln('Player inactive!');
2: writeln('Player logged out! (probably unsolved random event)');
3: writeln('No monsters found!');
4: writeln('Unsolved random!');
end;
case i of
0: mFighter[currentplayer].Active := true;
1, 2, 3:
begin
mFighter[currentplayer].Active := false;
if SaveLogs then
SaveScreenshot(mFighter[currentplayer].Name+'_'+DateToStr(Date)+'.bmp');
end;
4:
begin
if SaveLogs then
SaveScreenshot(mFighter[currentplayer].Name+'_'+DateToStr(Date)+'.bmp');
FRan;
wait(6000);
mFighter[currentplayer].Active := TabExists(tab_Combat);
end;
end;
players[currentplayer].Active := mFighter[currentplayer].Active;
exit;
end;
end;
end;
function EatFood: boolean;
var
x, y: integer;
begin
if not loggedin then exit;
if not mFighter[CurrentPlayer].CombatSetup[1] then exit;
GameTab(tab_Inv);
Result:= FindBitmapToleranceIn(BMPFood, x, y, MIX1, MIY1, MIX2, MIY2, 25);
if not Result then
begin
mFighter[CurrentPlayer].CombatSetup[1] := False;
exit;
end;
status('Eating...');
FS_Mouse(x+5, y+5, 3, 3, true);
wait(2000+random(100));
end;
function OutOfArrows: boolean;
var
x, y: integer;
begin
if (mFighter[currentplayer].FightStyle <> 'ranged') then exit;
GameTab(tab_Equip);
result:= not FindColor(x, y, 65535, 667, 247, 698, 257);
end;
function OutOfRunes: Boolean;
begin
if (mFighter[CurrentPlayer].FightStyle <> 'magic') then Exit;
Result := IsChatBoxTextAnyLine('ou do not', clBlack);
end;
function m_BMPItemCoordinates(BMP: integer): TPointArray;
var
i, x, y: integer;
B: tbox;
begin
if not loggedin then exit;
for I := 1 to 28 do
begin
B := InvBox(I);
if FindBitmapToleranceIn(BMP, X, Y, B.X1, B.Y1, B.X2, B.Y2, 30) then
begin
SetLength(Result, Length(Result)+1);
Result[high(Result)] := Point(B.X1 + ((B.X2-B.X1)/2), B.Y1 + ((B.Y2-B.Y1)/2));
end;
end;
end;
function WieldArrows: boolean;
var
TIA: array [0..27] of integer;
i, x, y, m, hi, BMPArrows: integer;
Arrows: TPointArray;
begin
if not loggedin then exit;
if not mFighter[currentplayer].Active then exit;
GameTab(tab_Inv);
wait(200+random(50));
BMPArrows := BitmapFromString(14, 10, 'beNpjYGJgYHLT4AKSBgo' +
'K+NlAJMXPDGTDuWgq4QwiDQSSRBoIQcQYiOZgrAZCLAUycHkTzWqs' +
'DCCKF+YFImQDgQyICEQlkA0hIQw0cyAqIbJhQjxw9cjmgEQAz5giM' +
'Q==');
if not FindBitmapToleranceIn(BMPArrows, X, Y, MIX1, MIY1, MIX2, MIY2, 30) then
begin
writeln('No arrows in inventory!');
Wait(2000);
FreeBitmap(BMPArrows);
Exit;
end;
Arrows:= m_BMPItemCoordinates(BMPArrows);
Hi := High(Arrows);
for I := 0 to hi do
TIA[i] := GetAmount(Arrows[i].x, Arrows[i].y);
InIntArrayEx(TIA, M, AMax(TIA));
writeln('Wielding stack with: '+inttostr(TIA[M])+' arrows');
FS_Mouse(Arrows[M].X, Arrows[m].Y, 3, 3, False);
Result:= WaitOption('ield', 1200 + Random(500));
FreeBitmap(BMPArrows);
end;
procedure RunBack(from: string; runfar: boolean; action, waittime: integer);
var
newdir: string;
begin
case lowercase(from) of
'n': newdir:= 's';
'e': newdir:= 'w';
's': newdir:= 'n';
'w': newdir:= 'e';
end;
RunAway(newdir, runfar, action, waittime);
end;
procedure SaveResponds;
var
SaveFilez: TStringList;
i: integer;
begin
SaveFilez := TStringList.Create;
SaveFilez.Clear;
SaveFilez.Add('~~ MultiFighter Autotalk Record ~~');
SaveFilez.Add('Date : '+DateToStr(Date));
SaveFilez.Add('');
for i:= 0 to Min(high(RespondedChatLines), high(MyResponds)) do
begin
SaveFilez.Add('* '+RespondedChatLines[i]);
SaveFilez.Add(' -> '+MyResponds[i]);
SaveFilez.Add('');
end;
if not SaveToFile(SaveFilez, ScriptPath + 'MF_'+Replace(DateToStr(Date), '/', '.')+'.txt') then
writeln('Saving report failed!');
end;
procedure AntiBan;
begin
if not mFighter[currentplayer].Active then exit;
case random(35) of
0: Gametab(RandomRange(tab_Combat, tab_Notes));
1: if CalcXP then hoverskill('random', false);
2, 6: PickUpMouse;
7..15: SleepAndMoveMouse(RandomRange(200, 2000));
end;
if mFighter[currentplayer].Others[0][1] then
if AutoTalk(30) then
Inc(players[currentplayer].integers[4]);
UseRewardBox;
end;
function PanicPrayer: boolean;
var
s: string;
begin
if GetMMLevels('prayer', s) > 0 then
if PrayerExists('11') then
result := ClickPrayer('11', true);
end;
procedure Flee;
var
DeathMark: integer;
s: string;
label
GoBack;
begin
if not loggedin then exit;
RunAway(mFighter[currentplayer].RunDir, true, 2, 5000+random(1000));
if mFighter[currentplayer].FightStyle = 'ranged' then
if OutOfArrows then
if not WieldArrows then
begin
mFighter[currentplayer].Active := false;
exit;
end;
if mFighter[currentplayer].CombatSetup[1] then
if EatFood then goto GoBack;
if not mFighter[currentplayer].CombatSetup[1] then
status('Recovering...');
if GetMMLevels('prayer', s) > 9 then
if PrayerExists('10') then
ClickPrayer('10', true);
SetRest;
repeat
FRan;
if IsInFight(MSCX, MSCY-20) then
begin
if PanicPrayer then
writeln('Protect Item activated!')
else
writeln('WE ARE DOOMED!');
MarkTime(DeathMark);
repeat
mFighter[currentplayer].active := not FindDead;
wait(50);
until(FindDead or (TimeFromMark(DeathMark) > 90000) or (not IsInFight(MSCX, MSCY-20)));
wait(3000);
if FindDead then exit;
ClickPrayer('11', false);
end;
AntiBan;
case random(2) of
0:begin
FS_Mouse(0, 0, MSX2, MSY2, false);
wait(750+random(500));
ChooseOption('xamin');
end;
1: MakeCompass(inttostr(random(360)));
end;
until(SwitchPlayers or (HPPercent > 95));
GoBack:
if PrayerActivated('10') then
ClickPrayer('10', false);
RunBack(mFighter[currentplayer].RunDir, true, 2, 5000);
status('');
end;
procedure HPCheck;
var
TMP: Integer;
begin
if not loggedin then exit;
mFighter[currentplayer].active := not FindDead;
if (not FindColor(TMP, TMP, 65280, 725, 31, 739, 38)) then
repeat
if not EatFood then
begin
Flee;
Exit;
end;
until(FindColor(TMP, TMP, 65280, 739, 107, 755, 119) or not loggedin);
status('');
end;
{$IfDef SRL_SMART}
function R_InCombat: boolean;
var
Me: TMe;
begin
Me := GetMe;
result := Me.Infight;
end;
{$EndIf}
function RuneCount(Slots: TIntegerArray): Integer;
var
B: TBox;
I: Integer;
begin
if (not LoggedIn) then Exit;
GameTab(Tab_Inv);
for I := 0 to High(Slots) do
begin
B := InvBox(Slots[I]);
IncEx(Result, GetAmount(B.X1 + (B.X2 - B.X1) div 2, B.Y1 + (B.Y2 - B.Y1) div 2));
end;
end;
function CastingMagic: Boolean;
var
I, T: Integer;
begin
I := RuneCount([1]);
T := GetSystemTime + 3700 + Random(100);
repeat
Wait(10);
if (RuneCount([1]) < I) then
begin
Result := True;
Exit;
end;
until(GetSystemTime > T);
end;
function InCombat: boolean;
begin
{$IfDef SRL_SMART}
if UseReflection then
begin
result := R_InCombat;
exit;
end;
{$EndIf}
case mFighter[currentplayer].FightStyle of
'ranged': result:= RangedInFight;
'melee': result:= (IsInFight(260, 150) and (Length(m_FindAllHPBars) > 1));
'magic': result:= CastingMagic;
end;
end;
procedure UseSpecial;
begin
GameTab(tab_Combat);
//WriteLn('Special left: '+IntToStr(Trunc(CountColor(3175983, 573, 418, 713, 418) div 1.4))+'%');
if (Trunc((CountColor(3175983, 573, 418, 713, 418) div 1.4)) >= mFighter[CurrentPlayer].SpecialPower) then
begin
MouseBox(591, 419, 693, 427, 1);
Wait(2000 + Random(200));
end;
end;
function CountChatLinesWithText(Text: String; Color: Integer): Integer;
var
I: Integer;
begin
for I := 1 to 8 do
if (Pos(Lowercase(Text), Lowercase(GetChatBoxText(I, Color))) > 0) then
Inc(Result);
end;
function FightMonster(Target: TPoint): boolean;
var
t, x, y: integer;
Doors: array of DoorProfile;
left: boolean;
label
TheFighting;
begin
if not loggedin then exit;
if not mFighter[currentplayer].active then exit;
if (IsInFight(260, 150) and (Length(m_FindAllHPBars) > 1)) then
goto TheFighting;
if not mFighter[currentplayer].CombatSetup[0] then
if IsInFight(Target.X, Target.Y) then
Exit;
// DrawBox(IntToBox(Target.X - 20, Target.Y - 20, Target.X + 20, Target.Y + 20));
MouseSpeed := MouseSpeed + 2;
Result := FS_MMouse(Target.X, Target.Y, 0, 0);
MouseSpeed := MouseSpeed - 2;
if (not Result) then
Exit;
if CheckUptext then
if not WUT('ption', 250) then exit;
GetMousePos(x, y);
Left := (not RightClickOnly) and IsUpTextMultiCustom(mFighter[currentplayer].MonsterNames)
if not FS_Mouse(x, y, 0, 0, left) then
Exit;
if left then
Result := DidRedClick
else
Result := WaitOption('ttack', 500);
if not Result then exit;
if random(4) = 0 then PickupMouse;
if mFighter[currentplayer].FightStyle = 'melee' then
begin
wait(900+random(200));
while m_IsMoving do wait(50+random(50));
FFlag(2);
wait(900+random(200));
end;
// doorcheck
if mFighter[currentplayer].Others[1][1] then
if not InCombat then
begin
Doors := GetDoorsIn(MMCX-15, MMCY-15, MMCX+15, MMCY+15);
if Length(Doors) > 0 then
begin
SetAngle(false);
MakeCompass(Round((Doors[0].Slope/(2*Pi))*360 +90));
if SpiralMouse(x, y, MSX1, MSY1, MSX2, MSY2, 'Open', 40, 20) then
begin
Mouse(x, y, 0, 0, false);
if not WaitOption('Open', 1500) then
mFighter[currentplayer].Active := false;
wait(350+random(100));
end else
mFighter[currentplayer].Active := false;
SetAngle(true);
exit;
end;
end;
// I can't reach that check
if (CountChatLinesWithText('reach', clBlack) > 2) then
begin
mFighter[currentplayer].Active := False;
Exit;
end;
// battle
TheFighting:
MarkTime(t);
repeat
HPCheck;
FRan;
SleepAndMoveMouse(750+random(500));
if random(15) = 0 then
PickupMouse;
if mFighter[CurrentPlayer].CombatSetup[2] then
UseSpecial;
until(not InCombat or (TimeFromMark(t) > mFighter[currentplayer].KillTime*1000) or OutOfArrows or OutOfRunes);
status('');
if OutOfArrows then
mFighter[CurrentPlayer].Active := WieldArrows;
if OutOfRunes then
mFighter[CurrentPlayer].Active := False;
end;
function PickupItem(colors: TIntegerArray; names: TStringArray): boolean;
var
Items: TPointArray;
I, T: integer;
begin
if not loggedin then Exit;
if not mFighter[currentplayer].Active then Exit;
if (Length(colors) = 0) or (Length(names) = 0) then Exit;
if m_FindObjects(Items, 20, 20, colors, 3, 5, 0.5, 0.5, False) then
begin
for I := 0 to High(Items) do
begin
FS_Mouse(Items[I].X, Items[I].Y, 2, 2, false);
Result := WaitOptionMulti(Names, 500);
if Result then
begin
MarkTime(T);
Wait(1000+random(100));
while (m_IsMoving and (TimeFromMark(t)<10000)) do wait(100+random(10));
Exit;
end;
end;
end;
end;
procedure BuryBonez;
var
x, y, i: integer;
BMPBones: array [0..1] of integer;
begin
if not mFighter[currentplayer].active then Exit;
if not loggedin then Exit;
BMPBones[0] := BitmapFromString(22, 15, 'beNqFk9tKQmEQhaPnq' +
'PAJoqibCKIQoouwA2UnRETEyg52TiSsEDtodhBDrLATZZZmSBYUUZ' +
'QXgXXZ8/TBxF9so2DY/Pvfa9asWTNbp9PXVko01VcXFRUTdqt1we2' +
'ObG2mTk/lhk8SwBpqytWrupQAOTEyYurpsZrNkIwND616vQfR6HUy' +
'KTyFoaHips1g6O7sMPf1QTJgs406BudmZ0JrgfjB/l0m857LpePxT' +
'b///PgoGgotLy5qSBrrqzQlHrJZr8cz5XT6FuZJIZdDR2srhNsbG7' +
'FIBEyFTtdU99WLUvLxls+/POfu79G/vrKiCGnKZrFwODs8RFj2MiU' +
'M4gAhBxqHP+DzYWZweWk3HOYS8FUigfjjvT1KA1DMMPCkFgC5mRkf' +
'd01OEgrPUNAPJx1hCwD6IrCdIIWvYECexGJURB5qPS4XGIfdjqUWk' +
'4kB4bCxvR2rW5qbeXLu7TJCCwO5VGR8WFQYIOEEQ++/DlS6QAyFYK' +
'ZWIYaWEUlHsmCkaIJL5t6o1yvOQkA4GBQZmYtzDb/axp+5asl/Lhs' +
'WiYzbdPrx9obpYLWshOAlV7OlGpKj3R3ZBHxzT08zl9enR8XwR676' +
'fQCzycMD/TiGyUxHbdT/DHVfMjCc3LLSku/GPwFrDi6J');
BMPBones[1] := BitmapFromString(19, 13, 'beNp1km9LwlAUxqVP4' +
'hcoCiII3xi+6aUv7I/BkCEhZJmZaWMM06IUa2ljNkaxtMylZdoqQu' +
'1V9L164MDtMgsexr1353fOc869vpmA71cezwSpc3d7nD+g9VOzaVx' +
'U2S+KXJif4pHPt9d+u31vWVe6npfldVHE4dBx7PqNdnZ6qCg7W5vE' +
'AmRp66Z5XirJmQxLDk17vfjGolFREIRweHUpRIdga5XKUS6HVNlUi' +
'gUzYaur6nZ8g09FYDwWIwNQz7ZNTeMrwnw0EnFl46dByb9HI7Bo8K' +
'HReH/ufg0H6KtYKPCpSGiZd4VO4TwnSWCRAVu0puxnwSLSMgxM+6P' +
'XQ0LMnEov+mcBqsUThAFEv/C/m0jAJxaMvb6sYcLVcllKp/+8RwhF' +
'McZxkxBYVPwPHJ8J3xR7CUQNXvrOY6fbasEzo3DX7J3QGqIGeRDDB' +
'BsKBtlFU7x/btL12HgQ7w3+95LJtZVlF+gqGvgBe5PKIg==');
Status('Burying bones...');
GameTab(tab_Inv);
for I := 0 to 1 do
begin
Repeat
FRan;
if FindBitmapToleranceIn(BMPBones[i], X, Y, MIX1, MIY1, MIX2, MIY2, 30) then
begin
FS_MMouse(X + 5, Y + 5, 4, 4);
if WUT('ury', 350) then
GetMousePos(x, y);
FS_Mouse(x, y, 0, 0, true);
wait(1500+random(200));
end;
until(not FindDTM(BMPBones[i], X, Y, MIX1, MIY1, MIX2, MIY2));
FreeBitmap(BMPBones[I]);
end;
status('');
end;
procedure DropCrap;
var
i, x, y: integer;
TIA: TIntegerArray;
TSA: TStringArray;
B: TBox;
begin
for i := 0 to high(mFighter[currentplayer].ProtectedItems) do
case VarType(mFighter[currentplayer].ProtectedItems[i]) of
varInteger:
begin
SetLength(TIA, Length(TIA)+1);
TIA[High(TIA)] := mFighter[currentplayer].ProtectedItems[i];
end;
varString:
begin
SetLength(TSA, Length(TSA)+1);
TSA[High(TSA)] := mFighter[currentplayer].ProtectedItems[i];
end;
end;
for i := 1 to 28 do
begin
B := InvBox(i);
if Length(BitmapToString(BMPFood)) > 1 then
if FindBitmapToleranceIn(BMPFood, x, y, B.x1, B.y1, B.x2, B.y2, 15) then
Continue;
if not InIntArray(TIA, i) then
if ExistsItem(i) then
begin
MMouseItem(i);
wait(150+random(50));
if posexx(TSA, GetUpText) = 0 then
if posexx(mFighter[currentplayer].PickupNames, GetUpText) = 0 then
begin
GetMousePos(x, y);
FS_Mouse(x, y, 0, 0, false);
wait(150+random(50));
ChooseOption('Drop');
end;
end;
end;
end;
procedure SetupFood;
var
i, s: integer;
box: TBox;
begin
if not loggedin then exit;
if (not mFighter[CurrentPlayer].CombatSetup[1]) then
begin
BMPFood := BitmapFromString(0, 0, '');
FreeBitmap(BMPFood);
exit;
end;
GameTab(tab_Inv);
if mFighter[currentplayer].FightStyle = 'magic' then
s := 2
else
s := 1;
for i:= s to 28 do
begin
if ExistsItem(i) then
begin
MMouseItem(i);
if WUT('Eat', 500+random(100)) then
begin
box := InvBox(i);
BMPFood := BitmapFromString(box.x2 - box.x1 -10, box.y2 - box.y1 -10, '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(BMPFood), box.x1+5, box.y1+5, box.x2 -5, box.y2 -5, 0, 0, (box.x2 - box.x1 -10), (box.y2 - box.y1 -10));
writeln('Food found in inventory slot: '+IntToStr(i));
exit;
end;
end;
end;
mFighter[CurrentPlayer].CombatSetup[1]:= false;
end;
procedure SetLevels;
var
i: integer;
TIA: TintegerArray;
begin
if not loggedin then Exit;
if not CalcXP then Exit;
TIA := [skill_Attack, skill_Strength, skill_Defense, skill_Range, skill_Prayer, skill_Mage, skill_Hp];
for i := 0 to 6 do
mFighter[CurrentPlayer].Levels[i] := GetSkillLevel(TIA[i]);
end;
procedure UpdateXPs;
begin
if mFighter[CurrentPlayer].FightStyle = 'magic' then
mFighter[CurrentPlayer].XPG[5] := GetXP(skill_Mage) - mFighter[CurrentPlayer].SXP[5];
case lowercase(mFighter[CurrentPlayer].FightMode) of
'rapid', 'accurate': mFighter[CurrentPlayer].XPG[3] := GetXP(skill_Range) - mFighter[CurrentPlayer].SXP[3];
'longrange': begin
mFighter[CurrentPlayer].XPG[3] := GetXP(skill_Range) - mFighter[CurrentPlayer].SXP[3];
mFighter[CurrentPlayer].XPG[2] := GetXP(skill_Defense) - mFighter[CurrentPlayer].SXP[2];
end;
'attack': mFighter[CurrentPlayer].XPG[0] := GetXP(skill_Attack) - mFighter[CurrentPlayer].SXP[0];
'strength': mFighter[CurrentPlayer].XPG[1] := GetXP(skill_Strength) - mFighter[CurrentPlayer].SXP[1];
'defence': mFighter[CurrentPlayer].SXP[2] := GetXP(skill_Defense) - mFighter[CurrentPlayer].SXP[2];
'even': begin
mFighter[CurrentPlayer].XPG[0] := GetXP(skill_Attack) - mFighter[CurrentPlayer].SXP[0];
mFighter[CurrentPlayer].XPG[1] := GetXP(skill_Strength) - mFighter[CurrentPlayer].SXP[1];
mFighter[CurrentPlayer].XPG[2] := GetXP(skill_Defense) - mFighter[CurrentPlayer].SXP[2];
end;
end;
end;
function UsingRanged: boolean;
begin
if not loggedin then exit;
result:= posexx(['ccura', 'ongr', 'api'], mFighter[currentplayer].FightMode)>0;
if Result then
writeln('Player is using ranged')
else
writeln('Player is using melee');
if Result then
begin
GameTab(tab_Equip);
if GetArrowCount > 0 then exit else
if not WieldArrows then
mFighter[currentplayer].active:= false;
end;
end;
procedure FightMode;
var
m: integer;
Levels: TIntegerArray;
begin
if not loggedin then exit;
case mFighter[currentplayer].FightMode of
'defence','defense','longrange': SetFightMode(4);
'strength','rapid': SetFightMode(2);
'attack','accurate': SetFightMode(1);
'even':begin
if mFighter[currentplayer].FightStyle <> 'melee' then exit;
Levels := [mFighter[currentplayer].Levels[1], mFighter[currentplayer].Levels[2], mFighter[currentplayer].Levels[3]];
InIntArrayEx(Levels, m, AMin(Levels));
if m = 2 then m:= 3;
SetFightMode(m+1);
end;
end;
Retaliate(true);
end;
procedure CheckLevelUps;
var
i: integer;
TIA: TIntegerArray;
begin
if not loggedin then Exit;
if (not CalcXP) then Exit;
if (players[currentplayer].integers[0] mod 10 <> 0) or (players[currentplayer].integers[0] = 0) then Exit;
UpdateXPs;
TIA := [skill_Attack, skill_Strength, skill_Defense, skill_Range, skill_Prayer, skill_Mage, skill_Hp];
for i := 0 to 6 do
begin
players[currentplayer].Level[i] := GetSkillLevel(TIA[i]);
if players[currentplayer].Level[i] > mFighter[currentplayer].Levels[i] then
begin
Inc(players[CurrentPlayer].Integers[1]);
Inc(mFighter[CurrentPlayer].LevelUps[i]);
end;
end;
SetLevels;
FightMode;
end;
{$IfDef SRL_SMART}
procedure R_SearchMobs;
var
Monsters: array of TNPC;
i: integer;
P: TPoint;
begin
MakeCompass('N');
Monsters := GetNPCs;
if Length(Monsters) < 1 then
begin
wait(2000);
exit;
end;
Monsters := SortNPCs(Monsters);
for i := 0 to high(Monsters) do
begin
if posexx(mFighter[currentplayer].MonsterNames, Monsters[i].Name) > 0 then
begin
if (not mFighter[currentplayer].CombatSetup[0]) and Monsters[i].InFight then
Continue;
P := Monsters[i].MM;
if distance(MMCX, MMCY, P.x, P.y) < 72 then
begin
WalkToTile(Monsters[i].Tile, 2, 0);
exit;
end;
end;
end;
end;
{$EndIf}
procedure SearchMobs;
var
NPCs: TPointArray;
begin
writeln('Monsters not found: '+inttostr(fails));
if mFighter[currentplayer].Others[0][0] then
begin
{$IfDef SRL_SMART}
if UseReflection then
begin
R_SearchMobs;
exit;
end;
{$EndIf}
NPCs := GetMinimapDots('NPC');
if Length(NPCs) > 0 then
begin
MouseFlag(NPCs[0].x, NPCs[0].y, 4, 4, 0);
Exit;
end;
end;
MakeCompass(inttostr(random(360)));
wait(2000+random(500));
end;
{*******************************************************************************
function function TPAMods(var MidColour: integer; var HueMod, SatMod: Extended; Colors: TIntegerArray): boolean;
By: TorrentOfFlame
Description: Works out the MidColour, Tolerance, Hue Modifier and Saturation Modifier for TPA's based on inputted
values
*******************************************************************************}
function TPAMods(var MidColour, Tolerance: integer; var HueMod, SatMod: Extended; Colors: TIntegerArray): boolean;
var
H, S, L, Tol: Extended;
i, ii: integer;
HSLColor: Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
begin
for i := 0 to High(Colors) do
begin
ColortoHSL(Colors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
for ii:= 1 to 3 do
begin
HSL[0][ii] := MinE(HSLColor[ii], HSL[0][ii]);
HSL[1][ii] := MaxE(HSLColor[ii], HSL[1][ii]);
end;
end;
H := HSL[1][1] - HSL[0][1];
S := HSL[1][2] - HSL[0][2];
L := HSL[1][3] - HSL[0][3];
MidColour := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
HueMod := (H/L);
SatMod := (S/L);
Tol := L;
if (MidColour <= 0) then
begin
WriteLn('TPA Variables not found.');
Result := False;
end else
Result := True;
Tolerance := Trunc(Tol + 0.5);
end;
procedure SetupMonsterFinder(var tolerance: integer; var HueMod, SatMod: extended);
var
HM, SM: extended;
tol, MC, CTS, i, tries: integer;
ATPA: T2DPointArray;
label
FailExit;
begin
TPAMods(MC, tol, HM, SM, mFighter[currentplayer].MonsterColors);
SetLength(ATPA, 2);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HM, SM);
tol := 5;
repeat
writeln('TEST TOLERANCE = '+inttostr(tol));
ATPA[1] := [];
for i := 0 to high(mFighter[currentplayer].MonsterColors) do
begin
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[0], mFighter[currentplayer].MonsterColors[i], MSX1, MSY1, MSX2, MSY2, tol);
ATPA[1] := CombineTPA(ATPA[0], ATPA[1]);
end;
if Length(ATPA[1]) > 1000 then
begin
tol := tol - 1;
if tol < 0 then
begin
FailExit:
writeln('Failed to find best color modifiers, using following:');
writeln(' * Tolerance = 10');
writeln(' * Huemod = 0.4');
writeln(' * SatMod = 0.4');
Tolerance := 10;
HueMod := 0.4;
SatMod := 0.4;
ColorToleranceSpeed(CTS);
exit;
end;
inc(tries);
end else
begin
Tolerance := tol;
HueMod := HM;
SatMod := SM;
writeln('BEST COLOR MODIFIERS FOUND:');
writeln(' * Tolerance = '+inttostr(tolerance));
writeln(' * Huemod = '+floattostr(HueMod));
writeln(' * SatMod = '+floattostr(SatMod));
ColorToleranceSpeed(CTS);
exit;
end;
until(false);
goto FailExit;
end;
procedure m_FixSpellBookCombat;
var
X, Y: Integer;
begin
GameTab(tab_Magic);
Y := 441;
if GetColor(591, 441) <> 16777215 then
begin
Mouse(592, 450, 4, 4, True);
Wait(600 + Random(100));
end;
for X := 0 to 2 do
begin
if GetColor(613 + X*22, Y) = 16777215 then
begin
Mouse(613 + X*22, Y + 11, 3, 3, True);
Wait(600 + Random(100));
end;
end;
if GetColor(705, 441) <> 16777215 then
begin
Mouse(703, 450, 3, 3, True);
Wait(600 + Random(100));
end;
end;
function m_SpellCoords(Spell: String): TPoint;
begin
Case LowerCase(Spell) Of
'wind strike': Result := Point(572, 231);
'water strike': Result := Point(596, 231);
'earth strike': Result := Point(621, 231);
'fire strike': Result := Point(643, 231);
'wind bolt': Result := Point(572, 255);
'water bolt': Result := Point(596, 255);
'earth bolt': Result := Point(621, 255);
'fire bolt': Result := Point(643, 255);
'wind blast': Result := Point(717, 255);
'water blast': Result := Point(572, 278);
'earth blast': Result := Point(596, 278);
'fire blast': Result := Point(621, 278);
'wind wave': Result := Point(717, 278);
'water wave': Result := Point(572, 302);
'earth wave': Result := Point(596, 302);
'fire wave': Result := Point(621, 302);
end;
end;
procedure m_SetUpAutoCast(Spell: string);
var
D, X, Y: Integer;
P: TPoint;
begin
D := DTMFromString('78DA6334666260B8CD00064C108AE1FFFFFF0' +
'C22409A11CA67B425428D0B116ADC80320F8950F382801A47A0CC' +
'7B026A4C8850630494798A5B0D90FD1F002C8B25B9');
GameTab(tab_Magic);
P := m_SpellCoords(Spell);
if (not FindDTM(D, X, Y, P.x-22, P.y-22, P.x+22, P.y+22)) then
begin
Mouse(P.X, P.Y, 3, 3, False);
WaitOption('uto', 1000 + Random(200));
Wait(200 + Random(100));
end;
FreeDTM(D);
end;
procedure SetupMagicThings;
begin
writeln('!!! REMEMBER TO HAVE RUNES IN THE 1ST INV SLOT !!!');
writeln('!!! REMEMBER TO HAVE RUNES IN THE 1ST INV SLOT !!!');
writeln('!!! REMEMBER TO HAVE RUNES IN THE 1ST INV SLOT !!!');
m_FixSpellBookCombat;
m_SetUpAutoCast(mFighter[CurrentPlayer].Fightmode);
end;
procedure SetupPlayer;
begin
if not loggedin then exit;
case lowercase(mFighter[CurrentPlayer].FightMode) of
'strength', 'defence', 'attack', 'even': mFighter[CurrentPlayer].FightStyle := 'melee';
'accurate', 'rapid', 'longrange': mFighter[CurrentPlayer].FightStyle := 'ranged';
'wind strike', '1', 'water strike','2', 'earth strike','3', 'fire strike', '4',
'wind bolt', '5', 'water bolt', '6', 'earth bolt', '7', 'fire bolt', '8', 'wind blast',
'9', 'water blast','10', 'earth blast','11', 'fire blast', '12', 'wind wave', '13',
'water wave', '14', 'earth wave', '15', 'fire wave', '16': mFighter[CurrentPlayer].FightStyle := 'magic';
end;
if mFighter[CurrentPlayer].Fightstyle = 'magic' then
begin
SetUpMagicThings;
if CalcXP then
mFighter[CurrentPlayer].SXP[5] := GetXP(skill_Mage);
end;
if CalcXP then
case lowercase(mFighter[CurrentPlayer].FightMode) of
'rapid', 'accurate': mFighter[CurrentPlayer].SXP[3] := GetXP(skill_Range);
'longrange': begin
mFighter[CurrentPlayer].SXP[3] := GetXP(skill_Range);
mFighter[CurrentPlayer].SXP[2] := GetXP(skill_Defense);
end;
'attack': mFighter[CurrentPlayer].SXP[0] := GetXP(skill_Attack);
'strength': mFighter[CurrentPlayer].SXP[1] := GetXP(skill_Strength);
'defence': mFighter[CurrentPlayer].SXP[2] := GetXP(skill_Defense);
'even': begin
mFighter[CurrentPlayer].SXP[0] := GetXP(skill_Attack);
mFighter[CurrentPlayer].SXP[1] := GetXP(skill_Strength);
mFighter[CurrentPlayer].SXP[2] := GetXP(skill_Defense);
end;
end;
SetLevels;
FightMode;
SetupFood;
Fails := 0;
SetAngle(true);
SetAngle(true);
if mFighter[currentplayer].HueMod <= 0 then
SetupMonsterFinder(mFighter[currentplayer].MonTol, mFighter[currentplayer].HueMod, mFighter[currentplayer].SatMod);
end;
procedure ProgressReport;
var
i: integer;
h: Extended;
begin
ClearDebug;
if SaveLogs then SaveResponds;
if HowManyPlayers > 1 then
begin
writeln('|~ Multifighter '+version+'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
writeln('|_Player_|_Kills_|_Levels_|_Pickups_|_Bones_|_Responds_|_Active_|');
for i := 0 to High(mFighter) do
writeln('| '+padr(players[i].Nick, 7)+'| '+padr(inttostr(players[i].integers[0]), 6)+'| '+padr(IntToStr(players[i].integers[1]), 7)+'| '+padr(inttostr(players[i].integers[2]), 8)+'| '+padr(inttostr(players[i].integers[3]), 6)+'| '+padr(IntToStr(players[i].integers[4]),9)+'| '+padr(booltostr(players[i].active), 6)+'|');
writeln('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
if HowManyPlayers > 1 then
writeln('| Minutes to switch: '+padr(inttostr(((LoopTime-(TimeFromMark(RoundMark)/60/1000)))), 43)+'|');
writeln('| Worked for: '+padr(timerunning, 50)+'|');
writeln('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
end else
begin
h := GetTimeRunning div 1000 div 60 div 60;
writeln('|||||||||||||||||||||||||||||||||||||||||||||||||||||');
writeln('|||| ||||');
writeln('|| M U L T I F I G H T E R ||');
writeln('|||| v'+version+' ||||');
writeln('|||||||||||||||||||||||||||||||||||||||||||||||||||||');
writeln('|| o Kills ||');
writeln('|| -> '+Padr(IntToStr(Players[CurrentPlayer].Integers[0]), 42)+'||');
writeln('|| -> '+Padr(IntToStr(Round(Players[CurrentPlayer].Integers[0] div h))+' K/H', 42)+'||');
writeln('|| ||');
writeln('|| o Pickups ||');
writeln('|| -> '+Padr(IntToStr(Players[CurrentPlayer].Integers[3])+' Bones', 42)+'||');
writeln('|| -> '+Padr(IntToStr(Players[CurrentPlayer].Integers[2])+' Other items', 42)+'||');
writeln('|| ||');
case mFighter[CurrentPlayer].FightStyle of
'melee': writeln('|| o XP-Gained with Fightmode: '+Padr(Capitalize(mFighter[currentplayer].FightMode), 19)+'||');
'magic': writeln('|| o XP-Gained with Magic ||');
'ranged': writeln('|| o XP-Gained with Ranged ||');
end;
if (mFighter[CurrentPlayer].XPG[0] > 0) then
writeln('|| -> Attack : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[0]), 10)+Padr('['+IntToStr(mFighter[CurrentPlayer].LevelUps[0])+' Levels]', 21)+'||');
if (mFighter[CurrentPlayer].XPG[1] > 0) then
writeln('|| -> Strength : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[1]), 10)+Padr('['+IntToStr(mFighter[CurrentPlayer].LevelUps[1])+' Levels]', 21)+'||');
if (mFighter[CurrentPlayer].XPG[2] > 0) then
writeln('|| -> Defence : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[2]), 10)+Padr('['+IntToStr(mFighter[CurrentPlayer].LevelUps[2])+' Levels]', 21)+'||');
if (mFighter[CurrentPlayer].XPG[3] > 0) then
writeln('|| -> Ranged : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[3]), 10)+Padr('['+IntToStr(mFighter[CurrentPlayer].LevelUps[3])+' Levels]', 12)+'||');
if (mFighter[CurrentPlayer].XPG[5] > 0) then
writeln('|| -> Magic : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[5]), 10)+Padr('['+IntToStr(mFighter[CurrentPlayer].LevelUps[5])+' Levels]', 21)+'||');
writeln('|| -> TOTAL : '+Padr(IntToStr(mFighter[CurrentPlayer].XPG[0]+mFighter[CurrentPlayer].XPG[1]+mFighter[CurrentPlayer].XPG[2]+mFighter[CurrentPlayer].XPG[3]+mFighter[CurrentPlayer].XPG[5]), 31)+'||');
writeln('|| -> XP/H : '+Padr(IntToStr(Round((mFighter[CurrentPlayer].XPG[0]+mFighter[CurrentPlayer].XPG[1]+mFighter[CurrentPlayer].XPG[2]+mFighter[CurrentPlayer].XPG[3]+mFighter[CurrentPlayer].XPG[5]) div h)), 31)+'||');
if mFighter[CurrentPlayer].Others[0][1] then
begin
writeln('|| ||');
writeln('|| o AutoResponder ||');
writeln('|| -> '+Padr(IntToStr(Players[CurrentPlayer].Integers[4])+' Responds', 42)+'||');
end;
writeln('|||||||||||||||||||||||||||||||||||||||||||||||||||||');
writeln('|| '+Padr(TimeRunning, 48)+'||');
writeln('|||||||||||||||||||||||||||||||||||||||||||||||||||||');
end;
if (GetTimeRunning - ReportMark) > 15*60*1000 then
begin
if SendEmail('fightreport@gmail.com', 'MultiFighter Report', GetDebugText, SRLName+'@hotmail.com', SRLName, 'http://marpis.hostoi.com/MyPHPEmail.php') then
writeln('Successfully reported!')
else
begin
writeln('@@ ONLINE REPORT FAILED!');
TerminateScript;
end;
ReportMark := GetTimeRunning;
end;
SRLRandomsReport;
end;
function BedTime: boolean;
var
h, m, i: integer;
hs: string;
begin
if SleepTime = '' then exit;
for i := 1 to length(SleepTime) do
begin
hs := hs + copy(SleepTime, i, 1);
if EndsWith('h', hs) then break;
end;
hs := GetNumbers(hs);
h := StrToIntDef(hs, 0);
m := StrToIntDef(between('h', 'm', SleepTime), 0);
result := (h*60*60*1000) + (m*60*1000) < TimeFromMark(SleepMark);
end;
procedure Sleepz;
var
h, m, s, t, i, sleeptimez, hx, mx: integer;
hs: string;
begin
if SleepFor = '' then exit;
Status('Sleeping...');
for i := 1 to length(SleepFor) do
begin
hs := hs + copy(SleepFor, i, 1);
if EndsWith('h', hs) then break;
end;
hs := GetNumbers(hs);
hx := StrToIntDef(hs, 0);
mx := StrToIntDef(between('h', 'm', SleepFor), 0);
sleeptimez := hx*60*60*1000 + mx*60*1000;
logout;
MarkTime(t);
repeat
ConvertTime(sleeptimez - timefrommark(t), h, m, s);
Disguise(inttostr(h)+' h '+inttostr(m)+' m '+inttostr(s)+' sec');
Sleep(1000);
until(TimeFromMark(t) > sleeptimez);
Disguise('Mozilla Firefox');
loginplayer;
MarkTime(SleepMark);
end;
procedure PickBones;
var
I: Integer;
begin
if not loggedin then Exit;
if (mFighter[CurrentPlayer].PickupFocus[0] < 1) then Exit;
for I := 0 to mFighter[CurrentPlayer].PickupFocus[0] do
if PickupItem([13553364], ['one']) then
Inc(Players[CurrentPlayer].Integers[3])
else
Break;
end;
procedure PickupAll;
var
I: Integer;
begin
if Random(2) = 0 then
begin
PickBones;
if Length(mFighter[currentplayer].PickupColors) > 0 then
if Length(mFighter[currentplayer].PickupNames) > 0 then
for I := 0 to (mFighter[currentplayer].PickupFocus[1] - 1) do
if PickupItem(mFighter[currentplayer].PickupColors, mFighter[currentplayer].PickupNames) then
Inc(players[currentplayer].integers[2])
else
Break;
end else
begin
if Length(mFighter[currentplayer].PickupColors) > 0 then
if Length(mFighter[currentplayer].PickupNames) > 0 then
for I := 0 to (mFighter[currentplayer].PickupFocus[1] - 1) do
if PickupItem(mFighter[currentplayer].PickupColors, mFighter[currentplayer].PickupNames) then
Inc(Players[currentplayer].integers[2])
else
Break;
PickBones;
end;
end;
procedure MainLoop;
var
i: integer;
Monsterz: TPointArray;
begin
if not loggedin then loginplayer;
MarkTime(SleepMark);
repeat
MarkTime(RoundMark);
repeat
FRan;
RunEnergy(RandomRange(60, 100));
HPCheck;
if m_FindObjects(Monsterz, 40, 40, mFighter[CurrentPlayer].MonsterColors, 15, mFighter[currentplayer].MonTol, mFighter[currentplayer].HueMod, mFighter[currentplayer].SatMod, True) then
begin
FRan;
for I := 0 to Min(2, High(Monsterz)) do
begin
if FightMonster(Monsterz[i]) then
begin
Fails:= 0;
Inc(players[currentplayer].integers[0]);
PickupAll;
Break;
end;
if (I = Min(2, High(Monsterz))) then
begin
Inc(Fails);
if (Fails mod 3 = 0) then SearchMobs;
end;
end;
CheckLevelUps;
end else
begin
Inc(Fails);
writeln('Fails : '+inttostr(fails));
SearchMobs;
end;
if (mFighter[currentplayer].PickupFocus[0] > 0) then
if InvFull then BuryBonez;
if mFighter[currentplayer].Others[1][0] then
if InvFull then DropCrap;
AntiBan;
ProgressReport;
if BedTime then Sleepz;
until(SwitchPlayers);
if PlayersActive > 0 then
NextP(mFighter[currentplayer].active)
else
begin
logout;
TerminateScript;
end;
until(false);
end;
procedure SetupFighter;
var
content: string;
i: integer;
begin
DeclarePlayers;
GetApplication.BringToFront;
wait(100);
if SRLName = '' then
begin
writeln('*** YOU MUST ENTER YOUR SRL USERNAME ***');
terminatescript;
end;
Smart_Server:= World;
Smart_Members:= Members;
Smart_Signed:= Signed;
Smart_SuperDetail:= false;
SetupSRL;
SRLPlayers;
Disguise('Mozilla Firefox');
ClearDebug;
Content:= GetPage('http://marpis.bravehost.com/index.html');
for i:= 13 downto 1 do
if pos('<line'+inttostr(i)+'>', Content) > 0 then
writeln(Between('<line'+inttostr(i)+'>', '</line'+inttostr(i)+'>', Content));
writeln('');
if Between('<ver>', '</ver', Content) <> version then
begin
for i:= 0 to 2 do
writeln('WARNING! YOUR SCRIPT IS OUTDATED!');
writeln('Visit the SRL forums to download the latest version:');
writeln('http://www.villavu.com/forum/showthread.php?t=45849');
end;
wait(3000);
ActivateClient;
wait(2000);
MouseSpeed := MousSpeed;
ClearReport;
end;
begin
SetupFighter;
if not loggedin then loginplayer;
SetupPlayer;
MainLoop;
end.