thanks suicidalkatt & elcius.
While your method would be ideal, it doesn't really do what the author intended.
I believe they want to have the tooltip show every set that contains a particular itemID not just the first one that returns true.
|
1 set = 1 itemid. Both variants are correct for me. ItemId 123456 can not be in 2 Sets in my table.
Lua Code:
function AddLootMsg(self, event, message, ...)
if not string.match(message,'Hbattlepet') then
local lootid = select(3, string.find(message, "item:(%d+):"))
local itemName,itemLink = GetItemInfo(lootid);
if not itemLink then return end
local itemId = tonumber(itemLink:match('item:(%d+)'));
if itemSet[itemId] then -- if a set is found
for i, setIndex in pairs(itemSet[itemId]) do -- for each index the id has
message = message:gsub("\124r.", "\124r (|cff9400D3Transmog Set: " .. setName[setIndex]['name'] .. "|cff00aa00).")
return false, message, ...
end
end
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", AddLootMsg);
thats my code for chat_msg_loot so far.. in my first tests it works.. have someone also an improvement for this code?