1. #1

    Addon to log all the loot I get

    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


    Thanks for any tips and suggestions.
    Last edited by Eommus; 2017-04-06 at 05:53 AM.

  2. #2
    Legendary! Vargur's Avatar
    10+ Year Old Account
    Join Date
    Nov 2009
    Location
    European Federation
    Posts
    6,664
    WowHead looter uses cached data to upload, but TSM might have such a module.
    Science flies you to the moon. Religion flies you into buildings.
    To resist the influence of others, knowledge of oneself is most important.


  3. #3
    Thanks for the comment, I want a very simple thing that does only what I explained above and that I can edit/update as I like.

    I came up with the following code so far, which correctly fires when I loot an item (tested it with printing text to the chat log). I just need to get the looted item info, and then save it:

    LootLog.toc

    Code:
    ## Interface: 70200
    ## Title: Loot Log
    ## Notes: Logs the loot you get.
    ## SavedVariables: LootLog
    
    main.lua

    main.lua

    Code:
    local f = CreateFrame("Frame")
    
    local function Log_Loot()
    	-- 1. Get looted item id, name, item level, type, subtype
    	-- 2. Save the above info to saved variables file.
    end
    
    f:SetScript("OnEvent", Log_Loot)
    f:RegisterEvent("ITEM_PUSH")
    Last edited by Eommus; 2017-04-06 at 10:08 AM.

  4. #4
    Just curious, but why do you need something like this?

    Personally I use TSM, not sure if that logs all items I loot though. But I do have good control over what I got in my bags at least.
    Quote Originally Posted by atenime45 View Post
    The 10% reward. It's was unspoken rule that you DONT attack other faction so everyone could enjoy the 10% reward. But now no one cares about that anymore

  5. #5
    This addon might be a step in the right direction: https://mods.curse.com/addons/wow/lootappraiser It's mostly meant to calculate the value of everything you've looted, but I've not messed with the settings too much, you might be able to make it suit your needs.

  6. #6
    This is not about auctions, value of items or gold. Just for my own personal use of keeping track of what items I looted.

    I know how to get the item details using GetItemInfo but I don't know how to get the "just looted" item's details, and then save that info to a saved variables file.

    Code:
    LootLog = {}
    
    local f = CreateFrame("Frame")
    
    local function Log_Loot(tooltip)
    	-- 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")

    Need a little help here, thank you.

    - - - Updated - - -

    SOLVED! Inspecting some addons which display looted item info, I was finally able to get the info about the looted item, and then store it in the saved variables file using the following:

    Code:
    LootLog = {}
    
    local f = CreateFrame("Frame")
    f:RegisterEvent("LOOT_OPENED")
    
    local function Log_Loot()
    	local n = GetNumLootItems()
    	for i = 1, n do
    		local item = GetLootSlotLink(i)
    		
    		local itemName = select(1, GetItemInfo(item))
    		local itemLink = select(2, GetItemInfo(item))
    		local itemId = select(2, strsplit(":", itemLink, 3))
    		local itemRarity = select(3, GetItemInfo(item))
    		local itemLevel = select(4, GetItemInfo(item))
    		local itemReqLevel = select(5, GetItemInfo(item))
    		local itemType = select(6, GetItemInfo(item))
    		local itemSubType = select(7, GetItemInfo(item))
    		local itemPrice = select(11, GetItemInfo(item))
    		
    		local text = itemName.."/"..itemId.."/"..itemRarity.."/"..itemLevel.."/"..itemReqLevel.."/"..itemType.."/"..itemSubType.."/"..itemPrice
    		
    		table.insert(LootLog, text)
    	end
    end
    
    f:SetScript("OnEvent", Log_Loot)
    This seems to work only for looted items (e.g. it doesn't work for items you receive via crafting, trading, mail, quests etc.). Not ideal but I guess I can live with it. Just keeping this here in case anyone might need a similar functionality in the future.
    Last edited by Eommus; 2017-04-07 at 07:12 AM.

  7. #7
    Quote Originally Posted by Eommus View Post
    This is not about auctions, value of items or gold. Just for my own personal use of keeping track of what items I looted.

    I know how to get the item details using GetItemInfo but I don't know how to get the "just looted" item's details, and then save that info to a saved variables file.

    Code:
    LootLog = {}
    
    local f = CreateFrame("Frame")
    
    local function Log_Loot(tooltip)
    	-- 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")

    Need a little help here, thank you.

    - - - Updated - - -

    SOLVED! Inspecting some addons which display looted item info, I was finally able to get the info about the looted item, and then store it in the saved variables file using the following:

    Code:
    LootLog = {}
    
    local f = CreateFrame("Frame")
    f:RegisterEvent("LOOT_OPENED")
    
    local function Log_Loot()
    	local n = GetNumLootItems()
    	for i = 1, n do
    		local item = GetLootSlotLink(i)
    		
    		local itemName = select(1, GetItemInfo(item))
    		local itemLink = select(2, GetItemInfo(item))
    		local itemId = select(2, strsplit(":", itemLink, 3))
    		local itemRarity = select(3, GetItemInfo(item))
    		local itemLevel = select(4, GetItemInfo(item))
    		local itemReqLevel = select(5, GetItemInfo(item))
    		local itemType = select(6, GetItemInfo(item))
    		local itemSubType = select(7, GetItemInfo(item))
    		local itemPrice = select(11, GetItemInfo(item))
    		
    		local text = itemName.."/"..itemId.."/"..itemRarity.."/"..itemLevel.."/"..itemReqLevel.."/"..itemType.."/"..itemSubType.."/"..itemPrice
    		
    		table.insert(LootLog, text)
    	end
    end
    
    f:SetScript("OnEvent", Log_Loot)
    This seems to work only for looted items (e.g. it doesn't work for items you receive via crafting, trading, mail, quests etc.). Not ideal but I guess I can live with it. Just keeping this here in case anyone might need a similar functionality in the future.
    Which I why I linked mine, as said, to see if you could tweak it or use the code to suit your needs. I read in the OP you weren't looking for auctions..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •