View Single Post
08-14-15, 07:55 PM   #6
Endzeit
A Deviate Faerie Dragon
Join Date: Aug 2015
Posts: 12
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:
  1. function AddLootMsg(self, event, message, ...)
  2.      if not string.match(message,'Hbattlepet') then
  3.     local lootid = select(3, string.find(message, "item:(%d+):"))
  4.    
  5.     local itemName,itemLink = GetItemInfo(lootid);
  6.     if not itemLink then return end
  7.    
  8.    
  9.     local itemId = tonumber(itemLink:match('item:(%d+)'));
  10.    
  11.     if itemSet[itemId] then -- if a set is found
  12.         for i, setIndex in pairs(itemSet[itemId]) do -- for each index the id has
  13.         message = message:gsub("\124r.", "\124r (|cff9400D3Transmog Set: " .. setName[setIndex]['name'] .. "|cff00aa00).")
  14.         return false, message, ...
  15.  
  16.     end
  17. end
  18. end
  19. end
  20.  
  21. 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?

Last edited by Endzeit : 08-14-15 at 08:00 PM.
  Reply With Quote