forked from ornfelt/azerothcore_lua_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventoryDump.lua
More file actions
58 lines (49 loc) · 2.72 KB
/
InventoryDump.lua
File metadata and controls
58 lines (49 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- will dump all your inventory items
abotInventoryResult = "["
for a = 0, 4 do
containerSlots = GetContainerNumSlots(a)
for b = 1, containerSlots do
abId = GetContainerItemID(a, b)
if (string.len(tostring(abId or "")) > 0) then
abItemLink = GetContainerItemLink(a, b)
abCurrentDurability, abMaxDurability = GetContainerItemDurability(a, b)
abCooldownStart, abCooldownEnd = GetContainerItemCooldown(a, b)
abIcon, abItemCount, abLocked, abQuality, abReadable, abLootable, abItemLink, isFiltered = GetContainerItemInfo(a, b)
abName, abLink, abRarity, abLevel, abMinLevel, abType, abSubType, abStackCount, abEquipLoc, abIcon, abSellPrice = GetItemInfo(abItemLink)
stats={};
abStats=GetItemStats(abotItemLink, stats);
statsResult={};
for key, value in pairs(stats) do
table.insert(statsResult, string.format("\"%s\":\"%s\"", key, value))
end
abotInventoryResult = abotInventoryResult..
"{"..
'"id": "'..tostring(abId or 0)..'",'..
'"count": "'..tostring(abItemCount or 0)..'",'..
'"quality": "'..tostring(abQuality or 0)..'",'..
'"curDurability": "'..tostring(abCurrentDurability or 0)..'",'..
'"maxDurability": "'..tostring(abMaxDurability or 0)..'",'..
'"cooldownStart": "'..tostring(abCooldownStart or 0)..'",'..
'"cooldownEnd": "'..tostring(abCooldownEnd or 0)..'",'..
'"name": "'..tostring(abName or 0)..'",'..
'"lootable": "'..tostring(abLootable or 0)..'",'..
'"readable": "'..tostring(abReadable or 0)..'",'..
'"link": "'..tostring(abItemLink or 0)..'",'..
'"level": "'..tostring(abLevel or 0)..'",'..
'"minLevel": "'..tostring(abMinLevel or 0)..'",'..
'"type": "'..tostring(abType or 0)..'",'..
'"subtype": "'..tostring(abSubType or 0)..'",'..
'"maxStack": "'..tostring(abStackCount or 0)..'",'..
'"equiplocation": "'..tostring(abEquipLoc or 0)..'",'..
'"sellprice": "'..tostring(abSellPrice or 0)..'",'..
'"stats": '.."{" .. table.concat(statsResult, ",").."}"..','..
'"bagid": "'..tostring(a or 0)..'",'..
'"bagslot": "'..tostring(b or 0)..'"'
.."}"
if b < containerSlots then
abotInventoryResult = abotInventoryResult .. ","
end
end
end
end
abotInventoryResult = abotInventoryResult .. "]"