Code:
QR Reference 2.1.5+
*** 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.
*** General PQR Functions ***
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: Example: 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) -- 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. -- OBSOLETE, use PQR_UnitFacing("target", "player")
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) & 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. -- If you use EXACT filter, it will only return an exact match to that spell ID. You may also use the "PLAYER" filter with it. You can use other filters if you do not use "EXACT" Example: UnitDebuffID("target", 133, "EXACT|PLAYER") = Only return fireball debuff with a spell ID of 133 casted by the player.
PQR_UnitInfo(unitID or GUID) -- Returns the following: X,Y,Z,R,Type (3 = Unit, 4 = Player), and TargetGUID of the specified unit/GUID.
PQR_UnitFacing(unitCheck, unitTarget, degrees) -- Is the check unit facing the target unit? Returns true or false. If degrees is set to true this function will return the number of degrees the unit is compared to the facing of the other unit. You can also set degrees to a number for a smaller or larger 'cone' in front of the unitCheck unit. Default is 180. Examples: PQR_UnitFacing("player", "target") --Is the player facing the target? PQR_UnitFacing("target", "player") --Is the player behind the target? PQR_UnitFacing("player", "boss1") -- Is the player facing the boss1 unit? It also accepts GUIDs, so: PQR_UnitFacing("target", UnitGUID("player")) -- Same as above "behind" example.
PQR_UnitDistance(unit1, unit2) -- Returns the distance in yards from unit1 center to the center of the unit2's hitbox. A players hitbox is about 3 yards, so a 40 yard spell can actually be cast when this returns 43... I am looking into taking this into consideration somehow. Accepts both GUID and unitID
PQR_LoadLua(fileName, forceRun) -- Loads the lua file specified. Returns true if the file was run/loaded/already ran, returns false otherwise. If forceRun is true then it will run the lua file again even if it has already been previously run.
PQR_StopRotation() -- Stops the currently running rotation (automatic mode only)
PQR_DelayRotation(seconds) -- Delays the currently running profile for X seconds (default 1).
PQR_SwapRotation(rotationName or rotationNumber[, setRotation]) -- Switches the currently running rotation to another rotation. If changing by name use the full rotation name as seen in the PQR window (example: PQR_SwapRotation("Ret PVE (Xelper)") .) If swapping by number you can figure out which are selected by checking the global variables: PQR_Rotation# (ex: PQR_Rotation1). Returns true if the swap was successful, false otherwise. You do NOT need to have the rotation selected in PQR when changing by name.
PQR_CheckUIError(msg[, seconds]) -- returns true if the specified UI Errror has popped up in the last X seconds. (Default 1)
*** Interrupt Functions ***
PQR_IsOnInterruptList(spellName) -- 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) -- 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) -- 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)