Ataka Tal Bixo primeiro
Const
Name=['Witch'];
SwitchAt=10;// the % of the current attacked monster
function GetPlace(st:string):integer;
var
x:integer;
begin
Result:=1000;
for x:=Low(Name) To High(Name) do
begin
if Name[x]=st then
Result:=x;
end;
end;
function GetCreatureByID(ID: integer): TCreature;
var
x: integer;
begin
Result := nil;
for x := 0 to Creatures.Count - 1 do
begin
if x >= Creatures.Count then Break;
if Creatures.Creature[x].ID = ID then
begin
Result := Creatures.Creature[x];
Exit;
end;
end;
end;
function IsCreatureBesideYou(c: TCreature): boolean;
begin
UpdateWorld;
Result := False;
if (abs(c.X-self.X) <= 6) and (abs(c.Y-self.Y) <= 6) then begin
if c.Z = self.Z then begin
Result := True;
end;
end;
end;
var
x:integer;
b:boolean;
begin
while not terminated do
begin
b:=false;
updateworld;
If (Self.Attacking<>0) then
begin
Creature:=GetCreatureByID(Self.Attacking);
if Creature<>nil then
if SwitchAt<Creature.Health then
begin
for x := 0 to Creatures.Count - 1 do
begin
updateworld;
if b then break;
if x >= Creatures.Count then Break;
if Creatures.Creature[x].NPC then
if Creatures.Creature[x].z=self.z then
if Creatures.Creature[x].Name<>self.name then
if Creatures.Creature[x].Attacking = false then
if IsCreatureBesideYou(Creatures.Creature[x]) then
if GetPlace(Creature.Name)>GetPlace(Creatures.Creature[x].Name) then
begin
sleep(100);
updateworld;
Creatures.Creature[x].attacking:=true;
B:=true;
end;
end;
end;
end;
Sleep(100);
end;
end;
TAL XP LOGA
const
WeaponID = 3285
SpearID = 3277
SpearOz = 20
SpearAmount = 3
Procedure PickUpSpears(Spears: TItem);
begin
if (Self.Capacity <= (Spears.Amount * SpearOz)) then
begin
if (Self.Capacity/SpearOz) > 1 then
Spears.MoveToContainer(Self.Containers.Container[0], 0, Int(Self.Capacity/SpearOz));
end else Spears.MoveToContainer(Self.Containers.Container[0], 0, 0);
Sleep(500);
end;
Function GetItemFromOpenBackpack(ID, Index: integer): TItem;
var
x: integer;
y: integer;
begin
Result := nil;
for x := 0 to Self.Containers.Count - 1 do
begin
if x >= Self.Containers.Count then Break;
if x = Index then Continue;
for y := 0 to Self.Containers.Container[x].Count - 1 do
begin
if y >= Self.Containers.Container[x].Count then Break;
if Self.Containers.Container[x].Item[y].ID = ID then
begin
Result := Self.Containers.Container[x].Item[y];
Exit;
end;
end;
end;
end;
function CountItemAmountFromOpenBackpack(ID: integer): integer;
var
x: integer;
y: integer;
begin
Result := 0;
for x := 0 to Self.Containers.Count - 1 do
begin
if x >= Self.Containers.Count then Break;
for y := 0 to Self.Containers.Container[x].Count - 1 do begin
if y >= Self.Containers.Container[x].Count then Break;
if Self.Containers.Container[x].Item[y].ID = ID then begin
Result := Result + Self.Containers.Container[x].Item[y].Amount;
end;
end;
end;
end;
while not terminated do
begin
UpdateWorld;
Weapon := GetItemFromOpenBackpack(WeaponID, Self.Containers.Count);
if Weapon <> nil then Weapon.MoveToBody(Self.Arrow, 0);
Spear := GetItemFromOpenBackpack(SpearID, 0);
if Spear <> nil then Spear.MoveToContainer(Self.Containers.Container[0], 0, 0);
if (Self.RightHand.ID = SpearID) then
begin
if (Self.RightHand.Amount < 90) then
begin
Spear := GetItemFromOpenBackpack(SpearID, Self.Containers.Count);
if Spear <> nil then Spear.MoveToBody(Self.RightHand, 0);
end;
end else begin
SpearCount := CountItemAmountFromOpenBackpack(SpearID);
if SpearCount >= SpearAmount then
begin
Self.RightHand.MoveToBody(Self.Arrow, 0);
Sleep(500);
Spear := GetItemFromOpenBackpack(SpearID, Self.Containers.Count);
if Spear <> nil then Spear.MoveToBody(Self.RightHand, 0);
end else if Self.RightHand.ID = 0 then Self.Arrow.MoveToBody(Self.RightHand, 0);
end;
Sleep(500);
end;
|