Vender Loot (com Falas)


Const

item_name = ['Short Sword', 'Sabre', 'Sword', 'Two Handed Sword', 'Battle Axe', 'Halberd', 'Mace', 'Battle Hammer', 'Chain Helmet', 'Chain Legs', 'Steel Shield', 'Battle Shield', 'Sentinel Shield', 'Salamander Shield', 'Chain Armor', 'Brass Armor', 'Plate Armor'];
item_id = [3294, 3273, 3264, 3265, 3266, 3269, 3286, 3305, 3352, 3558, 3409, 3413, 3444, 3445, 3358, 3359, 3357, 3276];

function CountItemFromOpenBackpack(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 + 1;
end;
end;
end;
end;

begin
UpdateWorld;
Self.Say('hi');
for i := 0 to 16 do
begin
UpdateWorld;
NumberOfItem := CountItemFromOpenBackpack(item_id[i]);
if NumberOfItem > 0 then
begin
Self.Say('sell '+ IntToSTr(NumberOfItem) + ' ' + item_name[i]);
Sleep(1500);
Self.Say('yes');
Sleep(1500);
end;
end;
Self.Say('bye');
end;