program AMM5;
var ksm,magec, ksmy, ksmx, ksmw, ksu, ksd, ksr, ksl, hit:integer;
var x,w,y, skip,z, monster1, monsterM,sx, sy, xx, yy, t, ptts: Integer;
var clx, cly, ksosx, ksosy, setclx, setcly, ksoffsetx, ksoffsety:integer;
var ptx, pty, tr:integer;
var ksS, selfbox: TBox;
const


user='username';{dont touch to keep all reloging features off}
pass='password';




Procedure ReadString(str: String);{by rena: START}
var
i,strLength :Integer;
goer: Boolean;

begin
i:=1
strLength:=Length(str)
goer:=False
while(i<strLength+1) do
begin
if(GetKeyCode(StrGet(str,i))=191)then
begin
KeyDown(16)
goer:=True
i:=i+1
end;
KeyDown(GetKeyCode(StrGet(str,i)))
wait(10)
KeyUp(GetKeyCode(StrGet(str,i)))
wait(20)
i:=i+1
if(goer=True)then
begin
KeyUp(16)
wait(600)
end;
end;
wait(300)
end;{by rena: END}

Procedure check_dc;
var char:integer;
begin  //
char:=1



if (((findcolorspiral (x, y, 10079232, 410, 210, 458, 287)
or (findcolorspiral(x, y, 255,17, 359, 54, 496)=false)))and
((user='no relog')=false)) then begin repeat
clickmouse(400, 224, true);wait(700);clickmouse(400, 324, true);wait(700)
until (findcolorspiral (x, y, 255,17, 359, 54, 496)=false)
repeat clickmouse(115, 375, true);wait(500)
until ((findcolorspiral(x, y, 255, 276, 322,575, 343)) or
(findcolorspiral(x, y, 10079232, 358, 307, 449, 332)))
clickmouse(414, 353, true);wait(500);
if(findcolorspiral (x, y, 255,17, 359, 54, 496)=false)then begin;
readstring(user);clickmouse(414, 388, true);wait(500);readstring(pass);wait(500)
clickmouse(409, 428, true);wait(3000);end
if findcolorspiral(x, y, 10079232,357, 305, 444, 333) then begin
clickmouse(380, 315, true);wait(500);pty:=4545 end


if ((findcolorspiral(x, y, 255,280, 323, 574, 343)=false)and(pty=4545)=false )
then begin
wait(500);clickmouse(534, (124*(char)), true);wait(500);
repeat until(findcolorspiral (x, y, 255,17, 359, 54, 496)) end
pty:=0
end

end;  //


begin

t:=2    //1 is right, 2 is left
tr:=1


monster1:= 1638350;
monsterM:= 1629877;
ptts:=0


selfbox:=IntToBox(270, 144, 364, 199);
if (findwindowtitlepart('endless online', false)=false) then
begin
writeln('Endless Online is not running... Script Terminated.')
terminatescript;
end
cleardebug;
setclx:=641
setcly:=507
findwindowtitlepart('endless online', false)
wait(300)
GetClientDimensions(clx, cly)
writeln('Your Client size is  X: '+inttostr(clx)+'  -  Y:'+inttostr(cly))
ksosx:=setclx-clx
ksosy:=setcly-cly
writeln('Your Offset is      X: '+inttostr(ksosx)+'  -  Y:'+inttostr(ksosy))
ksoffsetx:=313-ksosx
ksoffsety:=489-ksosy
writeln('Your KS Detection is X: '+inttostr(ksoffsetx)+'  -  Y:'+inttostr(ksoffsety))
wait(1000)
  activateclient; WAIT(2000)
clickmouse(608, 446, true)
wait(500)
if (findcolorspiral(x, y,13158600,465, 455, 469, 459)=false) then begin
clickmouse(567, 461, true)
end

repeaT
begin
z:=0
if tr=1 then begin
t:=(random(2)+1);writeln('Direction: '+inttostr(t));end

check_dc





if findcolorspiral(x, y,9175295,306, 103, 332, 126) then begin
ksl:=0;
ksr:=0;
ksd:=0;
ksu:=0;
end
repeat
z:=z+1

if (
  ( findcolorspiral(x, y,9175295,306, 86, 334, 104) )
and( findcolorspiral (x, y, monster1, 275, 154, 303, 174)=false )
and( findcolorspiral (x, y, monster1, 336, 182, 363, 209)=false )
and( findcolorspiral (x, y, monster1, 323, 157, 350, 165)=false )
and( findcolorspiral (x, y, monster1, 288, 184, 300, 194)=false )
){amm5 by joeyroyden / EoBots}
then begin
keydown(123);wait(500);keyup(123)
end



  writeln(inttostr(z)+'-'+inttostr(w))
if(z=100)then
begin
z:=0
keydown(123)
wait(200)
keyup(123)
end
if (findcolorspiral (x, y, monster1,275, 154, 303, 174)=false)then begin
ksl:=0; end
if ((findcolorspiral (x, y, monster1, 275, 154, 303, 174))and(ksl=0)) then
begin
if(FindColorSpiral(x, y, 16235924, 153, 27, 155, 33))then
begin

clickmouse(78, 364, true)
if findcolorspiral(ptx, pty, 32896,114, 364, 476, 468)then begin
clickmouse(ptx, pty, true)
wait(8)
clickmouse(ptx, pty, true)
sleep (350)
ptts:=ptts+1;writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end
end else
begin
writeln('No Healing Required')
wait(50);keydown(37)
wait(50)
keyup(37)
wait(20)
keydown(17)
wait(10)
keyup(17)
wait(100);

check_dc

skip:=skip-1
magec:=0
hit:=1
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksl:=1
end
end
end
until ((findcolorspiral(x, y, monster1, 275, 154, 303, 174)=false)or(ksl=1))
keyup(17)
wait(200)
{amm5 by joeyroyden / EoBots}
if ((findcolorspiral(x, y, monsterM, 13, 61, 627, 331)=false) and (hit=1))
then begin
wait(randomrange(500, 5000))
hit:=0
sendarrowwait(t, 5)
end

repeat
z:=z+1
writeln(inttostr(z)+'-'+inttostr(w))
if(z=100)then
begin
z:=0
keydown(123)
wait(200)
keyup(123)
end
if (findcolorspiral (x, y, monster1,336, 182, 363, 209)=false)then begin
ksr:=0
end
if ((findcolorspiral (x, y, monster1, 336, 182, 363, 209))and(ksr=0)) then
begin
IF (FindColorSpiral(x, y, 16235924, 153, 27, 155, 33))then
begin {amm5 by joeyroyden / EoBots}

clickmouse(78, 364, true)
if findcolorspiral(ptx, pty, 32896,114, 364, 476, 468)then begin
clickmouse(ptx, pty, true)
wait(8)
clickmouse(ptx, pty, true)
sleep (350)
ptts:=ptts+1;writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end
end else
begin
writeln('No Healing Required')
wait(50);keydown(39)
wait(50)
keyup(39)
wait(20)
keydown(17)
wait(10)
keyup(17)

check_dc

wait(100);skip:=skip-1
magec:=0
if (t=2) then begin
hit:=1
end
if (t=1) then begin
hit:=0
end
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksr:=1
end
end
end
until ((findcolorspiral(x, y, monster1, 336, 182, 363, 209)=false)or(ksr=1))
keyup(17)
wait(200)
if ((findcolorspiral(x, y, monsterM, 13, 61, 627, 331)=false) and (hit=1)
and (t=2))
then begin
wait(randomrange(500, 5000))
hit:=0
sendarrowwait(t, 5)
end

if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksm:=1
ksmx:=xx
ksmy:=yy
ksmw:=1
end
repeat
z:=z+1
  writeln(inttostr(z)+'-'+inttostr(w))
if(z=100)then
begin
z:=0
keydown(123)
wait(200)
keyup(123)
end {amm5 by joeyroyden / EoBots}
if (findcolorspiral (x, y, monster1,323, 157, 350, 165)=false)then begin
ksu:=0
end
if ((findcolorspiral (x, y, monster1, 323, 157, 350, 165))and(ksu=0)) then  ///////////////////////////////
begin
IF (FindColorSpiral(x, y, 16235924, 153, 27, 155, 33))then
begin {amm5 by joeyroyden / EoBots}

clickmouse(78, 364, true)
if findcolorspiral(ptx, pty, 32896,114, 364, 476, 468)then begin
clickmouse(ptx, pty, true)
wait(8)
clickmouse(ptx, pty, true)
sleep (350)
ptts:=ptts+1;writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end
end else
begin
writeln('No Healing Required')
wait(50);keydown(38)
wait(50)
keyup(38)
wait(20)
keydown(17)
wait(10)
keyup(17)
wait(100);skip:=skip-1

check_dc

magec:=0
hit:=1
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksu:=1
end
end
end
until ((findcolorspiral(x, y, monster1, 323, 157, 350, 165)=false)or(ksu=1))
keyup(17)
wait(200)
if ((findcolorspiral(x, y, monsterM, 13, 61, 627, 331)=false) and (hit=1))
then begin
hit:=0
wait(randomrange(500, 5000))
sendarrowwait(t, 5)
end
repeat
z:=z+1
  writeln(inttostr(z)+'-'+inttostr(w))
if(z=100)then
begin
z:=0
keydown(123)
wait(200)
keyup(123)
end
if (findcolorspiral (x, y, monster1,288, 184, 300, 194)=false)then begin
ksd:=0
end
if ((findcolorspiral (x, y, monster1, 288, 184, 300, 194))and(ksd=0)) then
begin
IF (FindColorSpiral(x, y, 16235924, 153, 27, 155, 33))then
begin
clickmouse(78, 364, true)
if findcolorspiral(ptx, pty, 32896,114, 364, 476, 468)then begin
clickmouse(ptx, pty, true)
wait(8)
clickmouse(ptx, pty, true)
sleep (350)
ptts:=ptts+1;writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end
end else
begin
writeln('No Healing Required')
wait(50);keydown(40)
wait(50)
keyup(40)
wait(20)
keydown(17)
wait(10)
keyup(17)
wait(100);skip:=skip-1

check_dc

magec:=0
if (t=2) then begin
hit:=0
end
if (t=1) then begin
hit:=1
end
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksd:=1
end
end
end
until ((findcolorspiral(x, y, monster1, 288, 184, 300, 194)=false)or(ksd=1))
keyup(17){amm5 by joeyroyden / EoBots}
if ((findcolorspiral(x, y, monsterM, 13, 61, 627, 331)=false) and (hit=1)
and (t=1))
then begin
wait(randomrange(500, 5000))
hit:=0
sendarrowwait(t, 5)
end
end
if (findcolorspiral (x, y,monsterm, 13, 61, 627, 331)=false)then
begin
magec:=0
IF (GETCOLOR(201, 31)=16235924)then begin
repeat
wait(100)
KEYDOWN(115)
WAIT(800)
KEYUP(115)
WAIT(450)
until (((GETCOLOR(201, 31)=16235924)=false)
or (findcolorspiral(x, y, monster1, 13, 61, 627, 331)))
end
wait(750)
if(FindColorSpiral(x, y,61373, 13, 61, 627, 331))then
begin
repeat
FindColorSpiral(x, y,61373, 13, 61, 627, 331)
movemousesmooth(x, y);wait(200);clickmouse(x, y, true)
wait(80)
clickmouse(x, y, true)
until((FindColorSpiral(x, y,61373, 13, 61, 627, 331)=false)
or(findcolorspiral(x, y, monster1, 13, 61, 627, 331)))
end
cleardebug;
if (findcolorspiral(x, y, monsterm, 13, 61, 627, 331)=false) then begin
ksm:=0
end
if (ksm=0) then begin
  ksS := IntToBox(0, 0, 5, 5); end
writeln('AMM v5 - By Joeyroyden - is waitting for a monster. (Direction: '+inttostr(t)+')')
writeln('Http://eobots.myteamtoolbar.com for quick links to other scripts')

writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')


repeat

check_dc

if (
  ( findcolorspiral(ptx, pty,9175295,306, 86, 334, 104) )
and( findcolorspiral (ptx, pty, monster1, 275, 154, 303, 174)=false )
and( findcolorspiral (ptx, pty, monster1, 336, 182, 363, 209)=false )
and( findcolorspiral (ptx, pty, monster1, 323, 157, 350, 165)=false )
and( findcolorspiral (ptx, pty, monster1, 288, 184, 300, 194)=false )
) {amm5 by joeyroyden / EoBots}
then begin
keydown(123);wait(500);keyup(123)
end

if(FindColorSpiral(x, y,8716032,244, 149, 398, 224))then
begin
FindColorSpiral(x, y,8716032, 244, 149, 398, 224)
movemousesmooth(x, y);wait(200);clickmouse(x, y, true);wait(500)

end
IF (FindColorSpiral(x, y, 16235924, 153, 27, 155, 33))then
begin {amm5 by joeyroyden / EoBots}

clickmouse(78, 364, true)
if findcolorspiral(ptx, pty, 32896,114, 364, 476, 468)then

begin
clickmouse(ptx, pty, true)
wait(8)
clickmouse(ptx, pty, true)
sleep (350)
ptts:=ptts+1;writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end

end else begin
if (x=0) then begin
x:=x+1
writeln('Used '+inttostr(ptts)+' Potions since you started AMM5')
end
end
until (findcolorspiral(x, y, monster1, 13, 61, 627, 331)=true)

end

skip:=skip-1;writeln('skip: '+inttostr(skip))
if FindColorSkipBox(sx, sy, monsterm, 13, 61, 627, 331, selfbox)then
begin
if (findcolorspiral2(xx, yy, monsterM, 11, 63, 626, 335)=true)then begin
if ((findcolorspiral2 (x, y, monsterm, ksmx-75, ksmy-75, ksmx+75, ksmy+75)=false))
then begin
ksm:=0
ksmw:=0
magec:=0
end
if (ksm=1) then begin
  ksS := IntToBox((ksmx-90), (ksmy-90), (ksmx+90), (ksmy+90)); end
if (ksm=0) then begin
  ksS := IntToBox(0, 0, 5, 5); end
  if(FindColorSkipBox(sx, sy, monsterM, 13, 61, 627, 331, ksS))then begin
if((findcolorspiral (x, y, monster1,275, 154, 303, 174)=false)
and
(findcolorspiral (x, y, monster1,336, 182, 363, 209)=false)
and
(findcolorspiral (x, y, monster1,323, 157, 350, 165)=false)
and {amm5 by joeyroyden / EoBots}
(findcolorspiral (x, y, monster1,288, 184, 300, 194)=false))then begin
FindColorspiral2(sx, sy, monsterM, 13, 61, 627, 331)
wait(50)
if magec=0 then begin
writeln('Go')
keydown(113)
wait(25)
keyup(113)
wait(50)
clickmouse(sx, sy, true)
wait(randomrange(1000, 2000))
magec:=0

end
end
ksmw:=0
skip:=1
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksm:=1
ksmx:=xx
ksmy:=yy
ksmw:=1
end
end
end
wait(100)
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksm:=1
ksmx:=xx
ksmy:=yy
ksmw:=1
end
if(getcolor(ksoffsetx, ksoffsety)=0)then begin
ksm:=1
ksmx:=xx
ksmy:=yy
ksmw:=1
end

check_dc

if findcolorspiral(x, y,9175295,306, 103, 332, 126) then begin
ksl:=0;
ksr:=0;
ksd:=0;
ksu:=0;
end
end
until(x = 500000000)
end.