WoW:API GetPVPTimer: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(300000 changed to 301000 (API implementation must have changed))
m (Move page script moved page API GetPVPTimer to API GetPVPTimer without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}}
Returns the amount of time left on your PVP flag.
ms = GetPVPTimer()


Returns the amount of time left on your PVP flag
== Returns ==
local ms = GetPVPTimer()
;ms : Numbers - 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.


=== Arguments ===
== Example ==
None
The following snippet displays your current PVP status:
 
 
=== 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 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  

Latest revision as of 04:46, 15 August 2023

WoW API < GetPVPTimer

Returns the amount of time left on your PVP flag.

ms = GetPVPTimer()

Returns[edit]

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

Details[edit]

  • 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[edit]

The following snippet 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)