Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. Function PQR_SpellAvailable(SpellID)
  2.     local GCDSpell = PQR_GCDSpell()
  3.  
  4.     if GetSpellCooldown ~= nil then
  5.         local GCDstartTime, GCDduration = GetSpellCooldown(GCDSpell)
  6.         local startTime, duration, enabled = GetSpellCooldown(SpellID)
  7.         local usableName, _, _, spellCost = GetSpellInfo(SpellID)
  8.         local spellUsable = nil
  9.         local _, build = GetBuildInfo()
  10.         If tonumber(build) <= 12340 Then
  11.             spellUsable = IsUsableSpell(usableName)
  12.         else
  13.             spellUsable = IsUsableSpell(SpellID)
  14.         end
  15.  
  16.         pq_SpellAvailable = "false"
  17.  
  18.         if startTime ~= nil and GCDstartTime ~= nil then
  19.             local timeLeft = startTime + duration - GetTime()
  20.             local GCDtimeLeft = GCDstartTime + GCDduration - GetTime()
  21.            
  22.             If GCDtimeLeft <= 0 Then
  23.                 If timeLeft <= 0.25 Then
  24.                     if spellUsable ~= nil then
  25.                         pq_SpellAvailable = "true"
  26.                     end
  27.                 end
  28.             else
  29.                 If timeLeft <= GCDtimeLeft + 0.25 Then
  30.                     if spellUsable ~= nil then
  31.                         pq_SpellAvailable = "true"
  32.                     end
  33.                 end
  34.             end
  35.         else
  36.             pq_SpellAvailable = "false"
  37.         end
  38.     else
  39.         pq_SpellAvailable = "false"
  40.     end
  41.  
  42.     if pq_SpellAvailable == nil or pq_SpellAvailable == "false" then
  43.         return false
  44.     else
  45.         return true
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement