KillTrack

KillTrack

458k Downloads

Extend command PrintKills for todays records

mbayrak78gh opened this issue ยท 0 comments

commented

Describe the feature

Since KillTrack is storing global and user related kills, it would be great to have a print command available which shows what the user has killed today (from todays reset time until the next reset time). This would allow to track if e.g. an alt has killed a certain NPC.

Is your feature request related to a problem? Please describe.

No it is an extension.

Describe the solution you'd like

It would be great to have a command like
/kt today --> prints a list of NPCs the user has killed from todays reset time on
/kt today NPC_ID_1 NPC_ID_2 NPC_ID_3 --> prints if given NPCs by their IDs are already killed (saved)

Example (rares on timeless isle in Pandaria):
/kt today 72048 71864 72769 73173 73170 72245 --> I have created a macro for this, so I can check on each of my alt which rare I have killed

Additionally, if user has already ATT as add-on installed the NPC print link can be used to open ATT frame for it.

Describe alternatives you've considered

Not a convenient ones...

Additional context

Add any other context or screenshots about the feature request here.

Will you be working to implement this feature yourself in a PR?

Yes and already implemented:

changes in Commands.lua:
KT:Msg("/kt today [NPC IDs] - Rares killed today. Optional NPC IDs can be used (space delimited)")

C:Register({"today"}, function(args) KT:PrintKillsToday(args) end)

changes in KillTrack.lua:

function KT:ToATT(npcId, npcName, color)
    return "|Haddon:ATT:search:npc:" .. npcId .. "|h|c".. color .. "[" .. npcName .. "]|r|h"
end

function KT:PrintKillsToday(args)
    local lastKillAt = nil
    local now = date("*t")
    local start = time({year=now.year, month=now.month, day=now.day - 1, hour=now.hour, min=now.min, sec=now.sec + GetQuestResetTime() + 1}) 
    local last = start + 24 * 60 * 60

    self:Msg(("--- [From: %s] [To: %s]"):format(KTT:FormatDateTime(start), KTT:FormatDateTime(last)))
    if #args <= 0 then
        for k, cg in pairs(self.CharGlobal.MOBS) do
            if type(cg) == "table" then
                name = cg.Name
                if type(cg.LastKillAt) == "number" and cg.LastKillAt >= start then
                    lastKillAt = KTT:FormatDateTime(cg.LastKillAt)
     	            self:Msg(("%s [%s]"):format(KT:ToATT(k, cg.Name, "FF00FF00"), lastKillAt))
                end
            end
        end
    else
        for k, v in pairs(args) do
	    cg = self.CharGlobal.MOBS[tonumber(v)]
            if cg and type(cg) == "table" then
                name = cg.Name
	        if type(cg.LastKillAt) == "number" and cg.LastKillAt >= start then
                    lastKillAt = KTT:FormatDateTime(cg.LastKillAt)
     	            self:Msg(("%s [%s]"):format(KT:ToATT(v, cg.Name, "FF00FF00"), lastKillAt))
                else
	            self:Msg(("%s [Not killed]"):format(KT:ToATT(v, cg.Name, "FFFF0000")))
                end
            else
		cg = self.Global.MOBS[tonumber(v)]
		if cg and type(cg) == "table" then name = cg.Name else name = "Not killed" end
	        self:Msg(("%s"):format(KT:ToATT(v, name, "FFFF0000")))
            end
        end
    end
end