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 Mon, 03 Nov 2008 02:52:06 Create

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

  • 1 comment
  • Avatar of Shefki Shefki Tue, 23 Dec 2008 10:55:05

    Committed something similar but different last night.

  • 1 comment

Facts

Last updated on
22 Jun 2009
Reported on
03 Nov 2008
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.

Reported by

Possible assignees

Votes (Total: +9, Average: +3.0)