api示例

(1)检索背包

--NUM_BAG_SLOTS——背包个数
--GetContainerNumSlots(bag)——获取指定背包物品数量
--GetContainerItem(bag, slot)——获取背包指定位置物品链接
for bag = 0, NUM_BAG_SLOTS do
    for slot = 0, GetContainerNumSlots(bag) do
        local link = GetContainerItemLink(bag, slot)
        if(link ~= nil) then
            local itemId, enchantId = link:match("item:(%d+) : (%d+)")
        end
    end
end

(2)检索装备

--GetInventoryItemLink("palyer", slot)——获取指定部位装备链接
--0-弹药, 1-头, 2-项链, 3-肩膀, 4-衬衫, 5-胸, 6-腰带, 7-腿, 8-鞋子, 9-手腕, 10-手套,
--11-戒指(上), 12-戒指(下), 13-饰品(上), 14-饰品(下), 15-披风, 16-主手, 17-副手, 18-远程, 19-战袍 
local link = GetInventoryItemLink("player", 10)
if(link ~= nil) then
    local itemId, enchantId = link:match("item:(%d+):(%d+)")
end

猜你喜欢

转载自www.cnblogs.com/not2/p/12654017.html