Autor Wiadomość
jabol123
PostWysłany: Czw 20:43, 05 Mar 2009    Temat postu: Small stones z bp do lewej ręki

wkładamy odpowiednia ilość kamyków do bp. Bot automatycznie przekłada kamyki z backpacka do lewej ręki.

Kod:

Const
SmallID = 1781
SmallAmount = 5

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;
 
  SmallStone := GetItemFromOpenBackpack(SmallID, Self.Containers.Count);
    if SmallStone <> nil then SmallStone.MoveToContainer(Self.Containers.Container[0], 0, 0);
    if (Self.LeftHand.ID = SmallID) then
    begin
          if (Self.LeftHand.Amount < 90) then
    begin
      SmallStone := GetItemFromOpenBackpack(SmallID, Self.Containers.Count);
      if SmallStone <> nil then SmallStone.MoveToBody(Self.LeftHand, 0);
    end;
      end else begin
    SmallCount := CountItemAmountFromOpenBackpack(SmallID);
    if SmallCount >= SmallAmount then
    begin
      Self.LeftHand.MoveToBody(Self.Arrow, 0);
      Sleep(500);
      SmallStone := GetItemFromOpenBackpack(SmallID, Self.Containers.Count);
      if SmallStone <> nil then SmallStone.MoveToBody(Self.LeftHand, 0);
    end else if Self.LeftHand.ID = 0 then Self.Arrow.MoveToBody(Self.LeftHand, 0);
  end;

  Sleep(500);
end; 

Powered by phpBB © 2001, 2005 phpBB Group