Appearance
Buy from an open trade
Npc.buy after the NPC trade window is already open. offer.sell is the price you pay.
lua
local Npc = require("sdk.npc")
-- Trade window must already be open.
local item_id = 268 -- gold potion
local count = 10
local ok, err = Npc.buy(item_id, count)
if not ok then
print("buy failed", err)
end