LibDogTag-Unit-3.0

6 - PVP Remaining Timer for Dogtags/Pitbull

Here's some code I whipped up to add a time remaining before PVP flag drops tag:

I put this is Status.lua

DogTag:AddTag("Unit", "PVPRemaining", {
    code = function(unit)
        if unit == 'player' and IsPVPTimerRunning() then
            local t = GetPVPTimer()/1000
            if(t < 1) then
                return nil
            else
                return t
            end
        else
            return nil
        end
    end,
    arg = {
        'unit', 'string;undef', 'player'
    },
    ret = "number;nil",
    events = "PVPRemaining#$unit",
    doc = L["Return the time remaining until PVP flag expires"],
    example = ('[PVPRemaining] => "110"; [PVPRemaining:FormatDuration] => "1:50"'),
    category = L["Status"]
})

And I added this to DogTag:AddTimerHandler:
    
    if IsPVPTimerRunning() then
        DogTag:FireEvent("PVPRemaining", 'player')
    end

User When Change
Tsevion Nov 03, 2008 at 02:52 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of Shefki Shefki Dec 23, 2008 at 10:55 UTC - 0 likes

    Committed something similar but different last night.

  • 1 comment

Facts

Last updated
Mar 30, 2012
Reported
Nov 03, 2008
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.
Votes
3

Reported by

Possible assignees