WoW:API GetPVPTimer: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New page: {{wowapi}} __NOTOC__ Returns the amount of time left on your PVP flag local ms = GetPVPTimer() === Arguments === None === Returns === :;ms : Integer - Amount of time (in millisecond...)
 
(300000 changed to 301000 (API implementation must have changed))
Line 15: Line 15:


=== Details ===
=== Details ===
If you are flagged for PVP permanently, the function returns 300000.
If you are flagged for PVP permanently, the function returns 301000.
If you are not flagged for PVP the function returns either 300000 or -1.
If you are not flagged for PVP the function returns either 301000 or -1.




Line 24: Line 24:
  local sec = math.floor(GetPVPTimer()/1000)
  local sec = math.floor(GetPVPTimer()/1000)
  local msg = (not UnitIsPVP("player")) and "You are not flagged for PVP" or  
  local msg = (not UnitIsPVP("player")) and "You are not flagged for PVP" or  
             (sec==300 and "You are perma-flagged for PVP" or  
             (sec==301 and "You are perma-flagged for PVP" or  
               "Your PVP flag wears off in "..(sec>60 and math.floor(sec/60).." minutes " or "")..(sec%60).." seconds")
               "Your PVP flag wears off in "..(sec>60 and math.floor(sec/60).." minutes " or "")..(sec%60).." seconds")
  DEFAULT_CHAT_FRAME:AddMessage(msg)
  DEFAULT_CHAT_FRAME:AddMessage(msg)

Revision as of 03:47, 5 September 2009

WoW API < GetPVPTimer

Returns the amount of time left on your PVP flag

local ms = GetPVPTimer()


Arguments

None


Returns

ms
Integer - Amount of time (in milliseconds) until your PVP flag wears off.


Details

If you are flagged for PVP permanently, the function returns 301000. If you are not flagged for PVP the function returns either 301000 or -1.


Example

Displays your current PVP status

local sec = math.floor(GetPVPTimer()/1000)
local msg = (not UnitIsPVP("player")) and "You are not flagged for PVP" or 
            (sec==301 and "You are perma-flagged for PVP" or 
             "Your PVP flag wears off in "..(sec>60 and math.floor(sec/60).." minutes " or "")..(sec%60).." seconds")
DEFAULT_CHAT_FRAME:AddMessage(msg)