PQR Custom Functions

PQRotation (PQR) provides a small set of functions to provide more functionality to profile writers than would normally be available by simple WoW API calls. Below is a list of all current functions provided by PQR.

Global Variables
სა''These global variables can be used/changed to suit your needs. Note that most of these will change back to their default values when a new rotation is started to ensure that a profile is running the way it's creator intended.''

PQR_RotationStarted
''true if a new rotation profile has started. You can set this to false and use it as a flag to run code that should only be run once per rotation enable.''

PQR_InterruptStarted
''true if a new interrupt profile has started. You can set this to false and use it as a flag to run code that should only be run once per rotation enable.''

PQR_SpellAvailableTime
''This is the time in seconds before a spell is off cooldown that PQR_SpellAvailable(spellID) will consider a spell as available. The default value is 0.125 (125ms). If a spell has 125ms left on cooldown, it will be considered available and attempt to be casted. ''

PQR_ResetMovementTime
''This is the time in seconds before you will be considered "not moving" after previously been considered moving by PQR_IsMoving. Default value is 0.5.''

PQR_WriteToChat(text[, suffix)
''Prints to chat using the  prefix. Passing "text" a nil value will cause a Lua error.''

PQR_DebugP(text)
''Prints to chat using the  prefix ONLY when "Profile" debug level is turned on. Passing this a nil value will cause a lua error.''

PQR_AddToSpellDelayList(spellID, itemID, secondsToDelay)
NOTE: DelayList is cleared on rotation change.

''If the indicated spell/item is used but fails due to being on GCD, the rotation will delay for secondsToDelay seconds (default 1). If the cast is sucessful the rotation will automatically resume before the delay has finished.''

''You should populate the list each time the rotation is started using the PQR_RotationStarted flag. See the example below for adding these 3 abilities:''

if PQR_RotationStarted == true then

PQR_RotationStarted = false

PQR_AddToSpellDelayList(642, 0, 1) --Divine Shield

PQR_AddToSpellDelayList(6940, 0, 1) --Hand of Sacrifice

PQR_AddToSpellDelayList(79634, 58146, 1) --Golem's Strength (spellID, itemID, delay)

end

PQR_SpellAvailable(spellID)
<p style="border-style: initial; border-color: initial; font-style: normal;">''Returns true if the selected ability is off cooldown. False otherwise. This takes into consideration the global variable PQR_SpellAvailableTime. Takes GCD into account.''

PQR_IsCastingSpell(spellID)
''Returns true if the player is currently casting or channeling the indicated spell. Returns false otherwise.''

''Note that the spell ID is simply translated to the spell name, and the current casting state is then compared to the spell name. If two spells share the same name, but different IDs, this will return true if the player is casting either spell.''

PQR_NotBehindTarget
''Returns true if we have received a "Must be behind the target." red message in the last 3 seconds. Returns false otherwise. An example of using this would be a feral druid where you must be behind the target to shred.''

Shred:

if PQR_NotBehindTarget == false then

return true

end

Mangle:

if PQR_NotBehindTarget then

return true

end

PQR_IsMoving(seconds)
''Returns true if the player has been moving for X seconds. Returns false otherwise.''

''Note that by default this function will return false once the player has been stationary for 1 second. This reset timer can be controlled by assigning a value to the variable "PQR_ResetMovementTime." For example, to change the reset time to 0.5 seconds, you would use "PQR_ResetMovementTime = 0.5" somewhere near the top of your rotation. This variable is global, and will effect all instances of PQR_IsMoving in your rotation. Note that changing from one rotation to another will reset this value to 1.0.''

PQR_IsOutOfSight(unit[, seconds])
Returns true if the specified unit has been out of sight in the last X seconds (default 3.) Returns false otherwise.

Note that the unit is converted to UnitName, and the check is based on unit name, so if 2 mobs both share the same name this will return the same value for either of them regardless of if one is out of sight and the other is not.

UnitBuffID(unit, spellID, filter) and UnitDebuffID(unit, spellID, filter)
Returns:

name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId

''Note that this function is simply a version of UnitBuff and UnitDebuff that accept a spell ID instead of a spell name. This is to ease the pains of multiple language localizations.''

''Filter: This parameter can be any of "HELPFUL", "HARMFUL", "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a | or space character to chain multiple filters together (e.g. "HELPFUL|RAID" or "HELPFUL RAID" == helpful buffs that you can cast on your raid). You can, for example, use the "PLAYER" filter when checking to make sure the unit has your Bane of Agony on it, and not another Warlocks.''

''An example, UnitDebuff("target", "Forbearance") would only work on an english client. On a spanish client, you would need to use UnitDebuff("target", "Abstinencia") to check for a Forbearance debuff. To simplify this, you can now use: UnitDebuff("target", 25771) (which is the spell ID for Forbearance) to check for the debuff and be guarenteed it will work on all clients.''

''Note that the spell ID you provide will simply be translated into the spell name and used in a UnitBuff or Debuff function. If two spells share the same name, but different spell IDs, they will both return true.''

PQR_IsOnInterruptList(spellName)
<p style="border-style: initial; border-color: initial;">Returns true/false based on if a spell is on the interrupt list on the Settings form or has been added via PQR_AddInterrupt(spellName).

PQR_AddInterrupt(spellName)
<p style="border-style: initial; border-color: initial; font-style: normal; border-style: initial; border-color: initial;">''Adds an interrupt to the interrupt list. The interrupt list is repopulated on interrupt rotation change. You should use PQR_InterruptStarted flag to repopulate the list with any profile-added spells. See PQR_AddToSpellDelayList for an example on how to use this flag. (Note: Change RotationStarted to InterruptStarted)''

PQR_AddInterrupt(spellName)
<p style="border-style: initial; border-color: initial; font-style: normal; border-style: initial; border-color: initial; border-style: initial; border-color: initial;">''Adds an interrupt to the interrupt list. The interrupt list is repopulated on interrupt rotation change. You should use PQR_InterruptStarted flag to repopulate the list with any profile-added spells. See PQR_AddToSpellDelayList for an example on how to use this flag. (Note: Change RotationStarted to InterruptStarted)''