Add new code snippets

This commit is contained in:
2024-03-03 13:50:12 +01:00
commit 01b612a50b
409 changed files with 65292 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
--MERCHANT_SHOW PLAYER_ALIVE CHAT_MSG_LOOT
function(e, msg)
if e == "PLAYER_ALIVE" then
for c = 0, 5 do
for s = 1, GetContainerNumSlots(c) do
if GetContainerItemLink(c, s) then
local name = GetItemInfo(GetContainerItemLink(c, s))
local icon = select(10, GetItemInfo(GetContainerItemLink(c, s)))
local link = GetContainerItemLink(c, s)
local id = link:match("item:(%d+):")
if not WeakAurasSaved.CustomTrash.IconDatabase[name] and name and icon then WeakAurasSaved.CustomTrash.IconDatabase[name] = icon; print("Adding|cff78cb00 ", name, " |rto the icon database") end
if not WeakAurasSaved.CustomTrash.IDDatabase[name] and name and id then WeakAurasSaved.CustomTrash.IDDatabase[name] = id; print("Adding|cff3366ff ", name, " |rto the id database") end
end
end
end
elseif e == "MERCHANT_SHOW" then
local i = 1
C_Timer.After(0.2, function()
while GetMerchantItemInfo(i) do
local name, icon = GetMerchantItemInfo(i)
local link = GetMerchantItemLink(i)
local id = link:match("item:(%d+):")
if not WeakAurasSaved.CustomTrash.IconDatabase[name] and name and icon then WeakAurasSaved.CustomTrash.IconDatabase[name] = icon; print("Adding|cff78cb00 ", name, " |rto the icon database") end
if not WeakAurasSaved.CustomTrash.IDDatabase[name] and name and id then WeakAurasSaved.CustomTrash.IDDatabase[name] = id; print("Adding|cff3366ff ", name, " |rto the id database") end
i = i + 1
end
end)
elseif e == "CHAT_MSG_LOOT" then
local itemID, icon, name
for itemLink in msg:gmatch("|%x+|Hitem:.-|h.-|h|r") do
itemID = itemLink:match("item:(%d+):")
icon = select(10, GetItemInfo(itemLink))
name = GetItemInfo(itemLink)
end
if not WeakAurasSaved.CustomTrash.IconDatabase[name] and name and icon then WeakAurasSaved.CustomTrash.IconDatabase[name] = icon; print("Adding|cff78cb00 ", name, " |rto the icon database") end
if not WeakAurasSaved.CustomTrash.IDDatabase[name] and name and id then WeakAurasSaved.CustomTrash.IDDatabase[name] = id; print("Adding|cff3366ff ", name, " |rto the id database") end
end
end