var
PURCHASE_DIALOGS: array of string = ['1st Dialog name','2nd Dialog name'];
StaffID : integer = 189;
StaffCount : int64 = 1;
StaffPrice : int64 = 1800000;
function ItemCounting(id: integer): int64;
var i: integer;
begin
result:= 0;
for i:= 0 to Inventory.User.Count-1 do begin
if (Inventory.User.Items(i).ID = id) then
Inc(result, Inventory.User.Items(i).Count);
end;
end;
procedure OpenStore();
var i: integer;
begin
for i:= Low(PURCHASE_DIALOGS) to High(PURCHASE_DIALOGS) do
if Engine.DlgSel(PURCHASE_DIALOGS[i]) then delay(500);
end;
procedure PurchaseCrystallize();
var
i: integer;
begin
while delay(100) do begin
if (Engine.Status = lsOnline)
and (ItemCounting(57) > (StaffPrice*StaffCount)) then begin
OpenStore();
Engine.NpcExchange(StaffID, StaffCount);
for i:= 1 to StaffCount do begin
if Engine.CrystalItem(StaffID) then delay(200);
end;
end else begin
Print('Havent enough adena for purchase!');
Engine.BlinkWindow(true);
Script.Stop;
end;
end;
end;
begin
PurchaseCrystallize;
end.