38 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| --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 |