View Single Post
05-20-17, 07:30 AM   #18
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Thanks to all the tips and help on this thread, I was finally able to finish my addon using the following. If you think it can be improved (i.e. made more efficient), please let me know.

Lua Code:
  1. LootLog = {}
  2.  
  3. local f = CreateFrame("Frame")
  4. f:RegisterEvent("CHAT_MSG_LOOT")
  5.  
  6. function Log_Loot(self, event, message, _, _, _, player, _, _, _, _, _, _, ...)
  7.     if player == "Eommus" then
  8.         local itemId = message:match("item:(%d+):")
  9.         LootLog[itemId] = {}
  10.     end
  11. end
  12.  
  13. f:SetScript('OnEvent', Log_Loot)

Such a simple thing, taking so long to come up with.

Food for thought: What if I was in a group with a player from another realm with the same name? The (if player == "Eommus") check won't be enough then.

Last edited by Eommus : 05-20-17 at 08:07 AM.
  Reply With Quote