Code: Select all
Program fighter;
var
t:integer;
enemy,bandage:cardinal;
tweapon,tshield,totemlife:word;
healtime,i:integer;
totem,bandagehealneeded:boolean;
b:TDateTime;
{$Include 'all.inc'}
procedure FullDisconnect;
begin
SetARStatus(false);
Disconnect;
end;
procedure weaponckeck;
begin
if (not dead) and (connected) then begin
checksave;
if (getquantity(findtype(tweapon,ground)) > 0) and (gettype(ObjAtLayer(RhandLayer)) <> gettype(finditem)) then begin
addtosystemjournal('Weapon Change, осталось '+inttostr(findcount));
UnEquip(RHandLayer);
wait(500);
Equip(RhandLayer,finditem);
end;
Wait(3000);
checksave;
if (getquantity(findtype(tshield,ground)) > 0) and (gettype(ObjAtLayer(LhandLayer)) <> gettype(finditem)) then begin
addtosystemjournal('Shield Change, осталось '+inttostr(findcount));
UnEquip(LHandLayer);
wait(500);
Equip(LhandLayer,finditem);
end;
end;
end;
procedure resshim;
begin
AddToSystemJournal('Resshim. Enter');
if connected then begin
b:=Now;
checksave;hungry(1,ground);setwarmode(false);
if (getquantity(findtype($0E21,ground))< 1) and (connected) then fulldisconnect else bandage:= finditem;
if (getquantity(findtype($0192,ground))< 1) and (connected) then begin
repeat
AddToSystemJournal('Resshim. Trying to find ghost');
Wait(5000);
findtype($0192,ground);
until getquantity(finditem) = 0;
end;
if findcount > 0 then begin
AddToSystemJournal('Resshim. Ressurecting');
if targetpresent then canceltarget;
CheckTargetError(2,2);
if finditem = enemy then begin
waittargetobject(finditem);UseObject(bandage);
WaitJournalline(b,'Thank',60000);
end
else Ignore(finditem);
end;
end;
AddToSystemJournal('Resshim. Exit');
end;
procedure resself;
begin
AddToSystemJournal('Resself. Enter');
WaitConnection(3000);
checksave;
UOSay('.forgivethee');
Wait(1000);
WaitGump('1');
setwarmode(true);
while dead do wait(1000);
if findtype($2006,ground) > 0 then begin
if targetpresent then canceltarget;
waittargetobject(finditem);
useobject(findtype($0F51,ground));wait(1000);
end;
hungry(1,ground);
weaponckeck;
Wait(30000);
UOSay('Thank');
AddToSystemJournal('Resself. Exit');
end;
procedure healwaiting;
begin
i:=0;
while i<healtime do begin
if totem then if (totem) and (not dead) and (life <= totemlife) then UOSay('Totem heal me!');
wait(1000);
i:=i+1;
end;
end;
Begin
SetARStatus(true);Finddistance:=1;
{--------------------------------------}
ENEMY := $00DAA4F4;
tweapon := $0F51; {Dagger}
tshield := $1B76; {Heater}
totem := true; {u vas est totem?}
bandagehealneeded := true; {Lechenie bintami nada? ne otnositsa k resu}
totemlife := 30; {hp}
healtime := 5; {sec, zaderjka na le4enie}
{--------------------------------------}
while true do begin
if connected then begin
for t:=1 to 10 do begin
WaitConnection(2000);
if dead then resself;
if isdead(enemy) then resshim;
checksave;
if bandagehealneeded then begin
if (getquantity(findtype($0E21,ground)) < 1) and (connected) then fulldisconnect
else bandage:=finditem;
end;
CheckTargetError(2,2);
if getdistance(enemy) > 0 then begin
if (wartargetid <> enemy) or (iswarmode(self) = false) then attack(enemy);
waittargetobject(enemy);
if targetpresent then canceltarget;
if bandagehealneeded then useobject(bandage); healwaiting;
end
else Wait(1000);
end;
hungry(1,ground);
weaponckeck;
end;
Wait(100);
end;
End.