Hi,
For my own purposes, I need the following ability:
When I get loot (any type of loot) from a mob, from a quest reward, by opening a container, by opening mail, by crafting or by trading (shortly, in any way a character can get loot), I want this addon to record the "name, id, type, item level" of the loot I got in a text file (lua file is ok too). To give example, let's say I looted
Corpsemaker, and
Iron Ore, it will record the following:
Corpsemaker|6687|Two-Handed Axes|35
Iron Ore|2772|Metal & Stone|30
I have the following so far:
LootLog.toc
Code:
## Interface: 70200
## Title: Loot Log
## Notes: Logs the loot you get.
## SavedVariables: LootLog
main.lua
main.lua
Code:
LootLog = {}
local f = CreateFrame("Frame")
local function Log_Loot(tooltip) -- How to get the info about just looted item?
-- 1. Get looted item id, name, item level, type, subtype
local item = tooltip:GetItem()
local itemName = GetItemInfo(item)
local _, itemLink = GetItemInfo(item) -- I need to extract item ID from this somehow.
local _, _, _, itemLevel = GetItemInfo(item)
local _, _, _, _, _, itemType = GetItemInfo(item)
local _, _, _, _, _, _, itemSubType = GetItemInfo(item)
-- 2. Save the above info to saved variables file.
table.insert(LootLog, itemName.."/"..itemLink.."/"..itemLevel.."/"..itemType.."/"..itemSubType.."\n")
end
f:SetScript("OnEvent", Log_Loot)
f:RegisterEvent("ITEM_PUSH")
Thanks for any help.