Vanilla WoW - VanillaGaming

Community => Addons => Topic started by: Luise on December 23, 2016, 02:00:18 am



Title: LootTracker
Post by: Luise on December 23, 2016, 02:00:18 am
Hello everyone,
since i have not found any loot tracker addon i made one myself. Feel free to share ideas, features and bugs you may encounter.

If enabled it tracks items + player who lootet it. You can enable / disable common / uncommon / rare / epic and legendary loot.


Like every other addon, if the server or client crashes the database is lost. For saving (eg. writing the database from wow memory to disk) you have to /reloadui or /logout or /exit.

Download Version 1.3.2 here: https://github.com/isitLoVe/LootTracker/releases/download/latest/LootTracker.zip

(http://i.imgur.com/2qmbKssl.jpg)


Title: Re: LootTracker beta
Post by: Atreyyo on December 23, 2016, 01:04:40 pm
Really nice addon.
I got one suggestion about the addtodb function.

You could input the values like this in order to sort them easily later if you so wanted to by either name, item or date.

 Example
LootTrackerDB[looter] = { loot = timestamp }

And then use a sort function to print and sort as you wish.

Or similar, oh and make loot links hyperlinks so you can click them aswell ^^


Title: Re: LootTracker beta
Post by: Ayag on December 23, 2016, 01:41:59 pm
Hey Luise ! Nice idea I'm going to give it a try and give feedback if any :)

Sorry if it sounds dumb but does ALT F4 works aswell to save the file ? I assume it's the most common way to exit the game ..
Also, does the previous file gets overwritten or does it just keeps writing on the same one ?

Cheers


Title: Re: LootTracker beta
Post by: Nela on December 23, 2016, 02:06:24 pm
Sorry if it sounds dumb but does ALT F4 works aswell to save the file ? I assume it's the most common way to exit the game ..
For saving (eg. writing the database from wow memory to disk) you have to /reloadui or /logout or /exit.
I guess that alt+f4 should be fine as it just works in a faster way than common logout


Title: Re: LootTracker beta
Post by: Atreyyo on December 24, 2016, 01:30:54 am
Since I really liked the idea of this addon I went on and tried some stuff, I hope you don't mind.

I changed the way it saved the loot so now it saves loot as hyperlink.

Code:
--extract the loot
local loot = string.sub(arg1, string.find(arg1, "|cff", 1, true), string.find(arg1, "|h|r", 1, true)+1).."|r"

I changed the way the data was being saved in the database.

Code:
if LootTrackerDB == nil then
LootTrackerDB = { }
end
if LootTrackerDB[looter] == nil then
LootTrackerDB[looter] = { }
end
LootTrackerDB[looter][timestamp] = loot

With this way of storing the data, you can easily use a sort function to sort between the data, or just print it all like this.

Code:
function LootTracker_Database(arg)
DEFAULT_CHAT_FRAME:AddMessage("Dumping Database:")
if arg == "name" then
LootTrackerDB_sorted = LootTracker_SortDB("name")
for _, key in pairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
if key == name then
for tstamp, loot in pairs(LootTrackerDB[name]) do
DEFAULT_CHAT_FRAME:AddMessage(name.." --> "..loot.." "..tstamp)
end
end
end
end
elseif arg == "loot" then
LootTrackerDB_sorted = LootTracker_SortDB("loot")
for _, key in pairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
if key == loot then
DEFAULT_CHAT_FRAME:AddMessage(loot.." --> "..name.." "..tstamp)
end
end
end
end
elseif arg == "date" then
LootTrackerDB_sorted = LootTracker_SortDB("date")
for _, key in ipairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
if key == tstamp then
DEFAULT_CHAT_FRAME:AddMessage(tstamp.." "..name.." --> "..loot)
end
end
end
end
else
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
DEFAULT_CHAT_FRAME:AddMessage(name.." --> "..loot.." "..tstamp)
end
end
end
end

function LootTracker_SortDB(arg)
local sortedKeys = { }
if arg == "name" then
for k, _ in pairs(LootTrackerDB) do
table.insert(sortedKeys, k)
end
elseif arg == "loot" then
for k, _ in pairs(LootTrackerDB) do
for l, _ in pairs(LootTrackerDB[k]) do
table.insert(sortedKeys, LootTrackerDB[k][l])
end
end
elseif arg == "date" then
for k, _ in pairs(LootTrackerDB) do
for l, _ in pairs(LootTrackerDB[k]) do
table.insert(sortedKeys, l)
end
end
end
table.sort(sortedKeys, function(a,b) return a<b end)
return sortedKeys
end

Use LootTracker_Database("name") / LootTracker_Database("loot") / LootTracker_Database("date") to print a sorted list of the database or leave empty to just print it as it is.

Would be cool to have a nice gui with a scroll list to put the db in later  ;D


Title: Re: LootTracker beta
Post by: Luise on December 24, 2016, 01:29:25 pm
Nice idea a gui would be nice but i slack know how yet. Do you have a github account, you can send me pull requests instead of forum posts.

My idea of the Loot DB would be something like this:

LootTrackerDB[raidid][looter][loot] or LootTrackerDB[raidid][looter][timestamp]

since VG does not have unique raid ids we could use Zone - Timestamp yy-mm-dd


Title: Re: LootTracker beta
Post by: Poodlesnack on December 24, 2016, 02:35:32 pm
I have been dreaming of this!
Would be really nice if it could be saved or imported to excel or similar software so that you can add even more data like this:
(http://i.imgur.com/rkNtjJq.jpg)
Would it would be possible to integrate this into the DKP addon that some guilds use to make it record dkp automatically?


Title: Re: LootTracker beta
Post by: Atreyyo on December 24, 2016, 03:25:43 pm
Sorry I don't have github yet, might have to get one though, seems neat.
I also noticed it was not adding items "won" to the database but only "receive" items.
Made a fix for that if you want it, oh and also added classcolors to the names stored in the db, aswell as a search function.

Edit:

Sorry if I kinda hijacked your addon but iike I said earlier, I really liked the idea of this addon you made and I just could not leave it alone ^^




Title: Re: LootTracker beta
Post by: Luise on December 25, 2016, 01:36:14 pm
current state of my db:
LootTrackerDB = {
   ["16-12-25 Durotar"] = {
      ["Tranq"] = {
         ["117"] = "Tough Jerky",
      },
      ["Corrheal"] = {
         ["769"] = "Chunk of Boar Meat",
         ["818"] = "Tigerseye",
      },
   },
}

      LootTrackerDB[raidid][playername][itemid] =   itemname

   timestamp = date("%y-%m-%d")
   zonename = GetRealZoneText();
   raidid = timestamp .. " " .. zonename

can you make a sort function for this?



Title: Re: LootTracker beta
Post by: Atreyyo on December 25, 2016, 02:27:54 pm
current state of my db:
LootTrackerDB = {
   ["16-12-25 Durotar"] = {
      ["Tranq"] = {
         ["117"] = "Tough Jerky",
      },
      ["Corrheal"] = {
         ["769"] = "Chunk of Boar Meat",
         ["818"] = "Tigerseye",
      },
   },
}

      LootTrackerDB[raidid][playername][itemid] =   itemname

   timestamp = date("%y-%m-%d")
   zonename = GetRealZoneText();
   raidid = timestamp .. " " .. zonename

can you make a sort function for this?



Sure, but won't there be an issue when you loot the same item and it gets replaced in the db instead of added?

Let's say you want to track all them Bijous that drops in Zul'Gurub, if you do it like this, you will just get one entry per itemid won't you?

Perhaps the best solution would be to store the data like this.

Code:
LootTrackerDB = {
 [1] = {
     [name] = "RandomvgGuy",
     [item] = "Band of Accuria",
     [rarity] = "epic",
     [timestamp] = "16-12-25 17:55:56",
     [zone] = "Molten Core"
 }
 [2] = {
     [name] = "AnothervgRandom",
     [item] = "Eye of Ragnaros",
     [rarity] = "legendary",
     [timestamp] = "16-12-25 17:56:31",
     [zone] = "Molten Core"
 }
}

This way you can store whatever data you want and easily collect any specific data you might need.


Title: Re: LootTracker beta
Post by: Luise on December 25, 2016, 05:20:24 pm
ah you are right that would be a problem, i only thought of epics in normal raids.


Title: Re: LootTracker beta
Post by: Luise on December 30, 2016, 03:58:05 am
quick update to the gui:

(https://i.imgur.com/K4UW4uFl.png)


Title: Re: LootTracker beta
Post by: Luise on January 15, 2017, 12:59:20 am
Releasing v1 soon:

check out the readme at https://github.com/isitLoVe/LootTracker

(https://i.imgur.com/2qmbKssl.jpg)


Title: Re: LootTracker beta
Post by: Atreyyo on January 15, 2017, 01:07:58 am
Looks awesome, well done man!


Title: Re: LootTracker beta
Post by: Cohle on January 15, 2017, 03:21:42 am
I do recall CTRaidTracker having a similar but it was unreliable at best! This looks far superior!


Title: Re: LootTracker
Post by: Pucchini on March 14, 2018, 12:42:12 pm
There's a fork with minor tweaks:
LootTracker Fork by Road-Block (https://github.com/Road-block/LootTracker)

-Item Edit frame closable by Esc
-Better compatibility with shootyepgp
-More Compact Browser window


Also:
The Export Format is rather badly parseable. Anyone eager to fix that? Luise? Should I fix and pull-request?


Title: Re: LootTracker
Post by: Luise on August 04, 2018, 08:55:01 am
There's a fork with minor tweaks:
LootTracker Fork by Road-Block (https://github.com/Road-block/LootTracker)

-Item Edit frame closable by Esc
-Better compatibility with shootyepgp
-More Compact Browser window


Also:
The Export Format is rather badly parseable. Anyone eager to fix that? Luise? Should I fix and pull-request?

*yawns* what would be a good parsable output? csv? json? yaml?


Title: Re: LootTracker
Post by: Pucchini on August 04, 2018, 09:45:33 am
Some random plain text is fine to me  :D

Quote
18-07-22 19:46:48 - Pauldrons of Elemental Fury: Oldshamy - 48

but my main concern is the use of field separators because it's unnecessarily hard to parse the 4 main fields: timestamp, item name, player, gp.
Everything except item name and player are separated by dashes, while again you find dashes in the date part of the timestamp.
E.g. parsing it requires multiple commands:

Quote
player = $(( cut -d'-' -f4 $line | cut -d':' -f2 ))
item = $(( cut -d'-' -f4 $line | cut -d':' -f2 ))

with a consistent field delimiter we could boil it down to:

Quote
player = $(( cut -d'-' -f5 $line ))
item = $(( cut -d'-' -f4 $line ))

OR

player = $(( awk '{ print $4 }' $line ))
player = $(( awk '{ print $5 }' $line ))

Quite noticeable when you parse alot of logs to create ratio graphs :)


Title: Re: LootTracker
Post by: Luise on August 06, 2018, 08:37:50 pm
There you go: https://github.com/isitLoVe/LootTracker/releases/download/latest/LootTracker.zip

CTRL+Click the Export Button to get a csv output, should be easier to parse

(https://i.imgur.com/GMdKdUDl.png) (https://i.imgur.com/GMdKdUD.png)


Title: Re: LootTracker
Post by: Pucchini on August 06, 2018, 09:24:31 pm
Thank you very much and great function names! :-P


Title: Re: LootTracker
Post by: KENJY on June 08, 2019, 10:08:03 pm
Since I really liked the idea of this addon I went on and tried some stuff, I hope you don't mind.

I changed the way it saved the loot so now it saves loot as hyperlink.

Code:

if LootTrackerDB == nil then
LootTrackerDB = { }
end
if LootTrackerDB[looter] == nil then
LootTrackerDB[looter] = { }
end
LootTrackerDB[looter][timestamp] = loot

With this way of storing the data, you can easily use a sort function to sort between the data, or just print it all like this.

Code:
function LootTracker_Database(arg)
DEFAULT_CHAT_FRAME:AddMessage("Dumping Database:")
if arg == "name" then
LootTrackerDB_sorted = LootTracker_SortDB("name")
for _, key in pairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
if key == name then
for tstamp, loot in pairs(LootTrackerDB[name]) do
DEFAULT_CHAT_FRAME:AddMessage(name.." --> "..loot.." "..tstamp)
end
end
end
end
elseif arg == "loot" then
LootTrackerDB_sorted = LootTracker_SortDB("loot")
for _, key in pairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
if key == loot then
DEFAULT_CHAT_FRAME:AddMessage(loot.." --> "..name.." "..tstamp)
end
end
end
end
elseif arg == "date" then
LootTrackerDB_sorted = LootTracker_SortDB("date")
for _, key in ipairs(LootTrackerDB_sorted) do
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
if key == tstamp then
DEFAULT_CHAT_FRAME:AddMessage(tstamp.." "..name.." --> "..loot)
end
end
end
end
else
for name,_ in pairs(LootTrackerDB) do
for tstamp, loot in pairs(LootTrackerDB[name]) do
DEFAULT_CHAT_FRAME:AddMessage(name.." --> "..loot.." "..tstamp)
end
end
end
end

function LootTracker_SortDB(arg)
local sortedKeys = { }
if arg == "name" then
for k, _ in pairs(LootTrackerDB) do
table.insert(sortedKeys, k)
end
elseif arg == "loot" then
for k, _ in pairs(LootTrackerDB) do
for l, _ in pairs(LootTrackerDB[k]) do
table.insert(sortedKeys, LootTrackerDB[k][l])
end
end
elseif arg == "date" then
for k, _ in pairs(LootTrackerDB) do
for l, _ in pairs(LootTrackerDB[k]) do
table.insert(sortedKeys, l)
end
end
end
table.sort(sortedKeys, function(a,b) return a<b end)
return sortedKeys
end

Use LootTracker_Database("name") / LootTracker_Database("loot") / LootTracker_Database("date") to print a sorted list of the database or leave empty to just print it as it is.

Would be cool to have a nice gui with a scroll list to put the db in later  ;D
You could input the values like this in order to sort them easily later if you so wanted to by either name, item or date.
Xender (http://"https://xender.vip/") Discord (http://"https://discord.software/") Omegle (http://"https://omegle.onl/")