Advertisement
Guest User

Paladin.lua

a guest
Jun 26th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.55 KB | None | 0 0
  1. if not PriorityQueue then return end
  2.  
  3. if select(2, UnitClass('player')) ~= "PALADIN" then
  4.     return
  5. end
  6.  
  7. local L = LibStub("AceLocale-3.0"):GetLocale("PriorityQueue")
  8. local C = PriorityQueue.constants -- Defined in PriorityQueue LUA no locale needed.
  9.  
  10. C["GCD Spell"] = GetSpellInfo(19750)
  11.  
  12. C["Consecration"], _, C["Consecration Icon"] = GetSpellInfo(26573)
  13. C["Crusader Strike"], _, C["Crusader Strike Icon"] = GetSpellInfo(35395)
  14. C["Divine Storm"], _, C["Divine Storm Icon"] = GetSpellInfo(53385)
  15. C["Hammer of Wrath"], _, C["Hammer of Wrath Icon"] = GetSpellInfo(24275)
  16. C["Templar's Verdict"], _, C["Templar's Verdict Icon"] = GetSpellInfo(85256)
  17. C["Holy Wrath"], _, C["Holy Wrath Icon"] = GetSpellInfo(2812)
  18.  
  19. C["Seal of Righteousness"], _, C["Seal of Righteousness Icon"] = GetSpellInfo(20154)
  20. C["Seal of Truth"], _, C["Seal of Truth Icon"] = GetSpellInfo(31801)
  21. C["Seal of Justice"], _, C["Seal of Justice Icon"] = GetSpellInfo(20164)
  22. C["Seal of Insight"], _, C["Seal of Insight Icon"] = GetSpellInfo(20165)
  23. C["Seal of Anything"], _, C["Seal of Anything Icon"] = GetSpellInfo(50908)
  24.  
  25. C["Judgement"], _, C["Judgement Icon"] = GetSpellInfo(20271)
  26. C["Inquisition"], _, C["Inquisition Icon"] = GetSpellInfo(84963)
  27. C["Zealotry"], _, C["Zealotry Icon"] = GetSpellInfo(85696)
  28. C["Exorcism"], _, C["Exorcism Icon"] = GetSpellInfo(85673)
  29. --prot specific:
  30.  
  31. C["Shield of the Righteous"], _, C["Shield of the Righteous Icon"] = GetSpellInfo(53600)
  32. C["Hammer of the Righteous"], _, C["Hammer of the Righteous Icon"] = GetSpellInfo(53595)
  33. C["Word of Glory"], _, C["Word of Glory Icon"] = GetSpellInfo(85673)
  34. C["Avenger's Shield"], _, C["Avenger's Shield Icon"] = GetSpellInfo(31935)
  35.  
  36. -- Buffs/Procs:
  37. C["The Art of War"] = GetSpellInfo(59578);
  38. C["Divine Shield"], _, C["Divine Shield Icon"] = GetSpellInfo(642)
  39.  
  40. function PriorityQueue:UNIT_MANA()
  41.     if self.db.char.priority.show and InCombatLockdown() then
  42.         self:SetNextPriority()
  43.     end
  44. end
  45.  
  46. ---------------------------
  47. -- Paladin Priorities
  48. ---------------------------
  49.  
  50. function PriorityQueue:DetermineGCD()
  51.     if PriorityQueue.db.char.priority.spec ~= 0 then
  52.         if PriorityQueue.db.char.priority.spec == 1 then
  53.             --Holy
  54.             C["GCD Spell"] = GetSpellInfo(19750) --Flash of Light
  55.         elseif PriorityQueue.db.char.priority.spec == 2 then
  56.             --Prot
  57.             C["GCD Spell"] = GetSpellInfo(25780) --Righteous Fury
  58.         elseif PriorityQueue.db.char.priority.spec == 3 then
  59.             --Ret
  60.             C["GCD Spell"] = GetSpellInfo(85256) --Templar's Verdict
  61.         end
  62.     else
  63.         PriorityQueue:GetCurrentSpec()
  64.     end
  65. end
  66.  
  67. function PriorityQueue:GetPaladinPriorityDefaults()
  68.     self:RegisterEvent("UNIT_MANA")
  69.     self.db.char.priority.dropthreat.name = C["Divine Shield"]
  70.     self.db.char.priority.dropthreat.icon = C["Divine Shield Icon"]
  71.    
  72.     self.presets.default = "Retribution"
  73.    
  74.     self.presets.priorities.name["Retribution"] =  L["Retribution"]
  75.     self.presets.priorities.list["Retribution"] = { "sot", "inquisition", "cs", "how", "exorcism_aow",  "tv", "judgement", "hw", "consecration", "none", "none", "none", "none", "none", "none" }
  76.  
  77.     self.presets.priorities.name["RetributionAOE"] =  L["Retribution AOE"]
  78.     self.presets.priorities.list["RetributionAOE"] = { "sot", "inquisition", "ds", "how", "exorcism_aow",  "tv", "judgement", "hw", "consecration", "none", "none", "none", "none", "none", "none" }
  79.     --Inq > CS > HoW > Exo > TV > J > HW > Cons
  80.    
  81.     --Seal of Truth
  82.     --Inquisition (Buff)
  83.     --Crusader Strike > All
  84.     --Hammer of Wrath (Execute)
  85.     --Templar's Verdict (Finisher)
  86.     --Judgement
  87.     --Holy Wrath
  88.     --Consecrate
  89.    
  90.     self.presets.priorities.name["Protection"] =  L["Protection"]
  91.     self.presets.priorities.list["Protection"] = { "sot", "sotr", "cs", "judgement", "hw",  "as", "hw", "consecration", "none", "none", "none", "none", "none", "none", "none" }
  92.     self.presets.priorities.name["ProtectionAOE"] =  L["Protection AOE"]
  93.     self.presets.priorities.list["ProtectionAOE"] = { "sot", "hotr", "hw", "consecration", "as",  "sotr", "judgement", "none", "none", "none", "none", "none", "none", "none", "none" }
  94.     --prot:
  95.     --Shield of the Righteous / Word of Glory > Crusader's Strike > Judgement > Hammer of Wrath (when active) > Avenger's Shield > Holy Wrath > Consecration
  96.     --NOTE: SotR / Shield of the Righteous will not activate until you have at least one charge of Holy Power.
  97.     --Hammer of the Righteous > Consecration > Holy Wrath > Avenger's Shield > Shield of the Righteous / Word of Glory > Judgement
  98.    
  99.    
  100. end
  101.  
  102.  
  103. --PROT START
  104. PriorityQueue.priorityTable.name["sotr"] = C["Shield of the Righteous"]
  105. PriorityQueue.priorityTable.icon["sotr"] = C["Shield of the Righteous Icon"]
  106. PriorityQueue.priorityTable.spid["sotr"] = 53600
  107. PriorityQueue.priorityTable.actn["sotr"] = "/startattack" --ALSO PERFORM ACTION
  108. PriorityQueue.priorityTable.test["sotr"] =
  109.     function ()
  110.         if UnitPower("player", 9) == 3 then
  111.             return PriorityQueue:SpellAvailable(C["Shield of the Righteous"])
  112.         end
  113.     end
  114.  
  115. PriorityQueue.priorityTable.name["as"] = C["Avenger's Shield"]
  116. PriorityQueue.priorityTable.icon["as"] = C["Avenger's Shield Icon"]
  117. PriorityQueue.priorityTable.spid["as"] = 31935
  118. PriorityQueue.priorityTable.actn["as"] = "/startattack" --ALSO PERFORM ACTION
  119. PriorityQueue.priorityTable.test["as"] =
  120.     function ()
  121.         return PriorityQueue:SpellAvailable(C["Avenger's Shield"])
  122.     end
  123.  
  124. PriorityQueue.priorityTable.name["hotr"] = C["Hammer of the Righteous"]
  125. PriorityQueue.priorityTable.icon["hotr"] = C["Hammer of the Righteous Icon"]
  126. PriorityQueue.priorityTable.spid["hotr"] = 53595
  127. PriorityQueue.priorityTable.actn["hotr"] = "/startattack" --ALSO PERFORM ACTION
  128. PriorityQueue.priorityTable.test["hotr"] =
  129.     function ()
  130.         return PriorityQueue:SpellAvailable(C["Hammer of the Righteous"])
  131.     end
  132.  
  133. --PROT END
  134.  
  135.  
  136. --General Abilities
  137. PriorityQueue.priorityTable.name["cs"] = C["Crusader Strike"]
  138. PriorityQueue.priorityTable.icon["cs"] = C["Crusader Strike Icon"]
  139. PriorityQueue.priorityTable.spid["cs"] = 35395
  140. PriorityQueue.priorityTable.actn["cs"] = "/startattack" --ALSO PERFORM ACTION
  141. PriorityQueue.priorityTable.test["cs"] =
  142.     function ()
  143.         return PriorityQueue:SpellAvailable(C["Crusader Strike"])
  144.     end
  145.  
  146. PriorityQueue.priorityTable.name["ds"] = C["Divine Storm"]
  147. PriorityQueue.priorityTable.icon["ds"] = C["Divine Storm Icon"]
  148. PriorityQueue.priorityTable.spid["ds"] = 53385
  149. PriorityQueue.priorityTable.actn["ds"] = "/startattack" --ALSO PERFORM ACTION
  150. PriorityQueue.priorityTable.test["ds"] =
  151.     function ()
  152.         return PriorityQueue:SpellAvailable(C["Divine Storm"])
  153.     end
  154.    
  155. PriorityQueue.priorityTable.name["judgement"] = C["Judgement"]
  156. PriorityQueue.priorityTable.icon["judgement"] = C["Judgement Icon"]
  157. PriorityQueue.priorityTable.spid["judgement"] = 20271
  158. PriorityQueue.priorityTable.actn["judgement"] = "/startattack" --ALSO PERFORM ACTION
  159. PriorityQueue.priorityTable.test["judgement"] =
  160.     function ()
  161.         return PriorityQueue:SpellAvailable(C["Judgement"])
  162.     end
  163.  
  164. PriorityQueue.priorityTable.name["hw"] = C["Holy Wrath"]
  165. PriorityQueue.priorityTable.icon["hw"] = C["Holy Wrath Icon"]
  166. PriorityQueue.priorityTable.spid["hw"] = 2812
  167. PriorityQueue.priorityTable.actn["hw"] = "/startattack" --ALSO PERFORM ACTION
  168. PriorityQueue.priorityTable.test["hw"] =
  169.     function ()
  170.         return PriorityQueue:SpellAvailable(C["Holy Wrath"])
  171.     end
  172.    
  173. PriorityQueue.priorityTable.name["how"] = C["Hammer of Wrath"]
  174. PriorityQueue.priorityTable.icon["how"] = C["Hammer of Wrath Icon"]
  175. PriorityQueue.priorityTable.spid["how"] = 24275
  176. PriorityQueue.priorityTable.actn["how"] = "/startattack" --ALSO PERFORM ACTION
  177. PriorityQueue.priorityTable.test["how"] =
  178.     function ()
  179.         local sAW = UnitBuff("player", "Avenging Wrath")
  180.         local unithealth = 100 * UnitHealth("target") / UnitHealthMax("target")
  181.  
  182.         if sAW ~= nil then
  183.             return PriorityQueue:SpellAvailable(C["Hammer of Wrath"])
  184.         else
  185.             if unithealth <= 20 then -- only usable if target health < 20%
  186.                 return PriorityQueue:SpellAvailable(C["Hammer of Wrath"])
  187.             end
  188.         end
  189.     end
  190.    
  191. PriorityQueue.priorityTable.name["tv"] = C["Templar's Verdict"]
  192. PriorityQueue.priorityTable.icon["tv"] = C["Templar's Verdict Icon"]
  193. PriorityQueue.priorityTable.spid["tv"] = 85256
  194. PriorityQueue.priorityTable.actn["tv"] = "/startattack" --ALSO PERFORM ACTION
  195. PriorityQueue.priorityTable.test["tv"] =
  196.     function ()
  197.         sDivinePurpose = UnitBuff("player", "Divine Purpose")
  198.        
  199.         if UnitPower("player", 9) == 3 or sDivinePurpose ~= nil then
  200.             return PriorityQueue:SpellAvailable(C["Templar's Verdict"])
  201.         end
  202.     end
  203.    
  204. PriorityQueue.priorityTable.name["zealotry"] = C["Zealotry"]
  205. PriorityQueue.priorityTable.icon["zealotry"] = C["Zealotry Icon"]
  206. PriorityQueue.priorityTable.spid["zealotry"] = 85696
  207. PriorityQueue.priorityTable.actn["zealotry"] = "/startattack" --ALSO PERFORM ACTION
  208. PriorityQueue.priorityTable.test["zealotry"] =
  209.     function ()
  210.         sDivinePurpose = UnitBuff("player", "Divine Purpose")
  211.        
  212.         if UnitPower("player", 9) == 3 or sDivinePurpose ~= nil then
  213.             return PriorityQueue:SpellAvailable(C["Zealotry"])
  214.         end
  215.     end
  216.    
  217. PriorityQueue.priorityTable.name["inquisition"] = C["Inquisition"]
  218. PriorityQueue.priorityTable.icon["inquisition"] = C["Inquisition Icon"]
  219. PriorityQueue.priorityTable.spid["inquisition"] = 84963
  220. PriorityQueue.priorityTable.actn["inquisition"] = "/startattack" --ALSO PERFORM ACTION
  221. PriorityQueue.priorityTable.test["inquisition"] =
  222.     function ()
  223.         sDivinePurpose = UnitBuff("player", "Divine Purpose")
  224.         local inqBuff, _, _, _, _, _, inqExpireTime = UnitBuff("player", "Inquisition")
  225.        
  226.         if inqBuff ~= nil then
  227.             local inqExpire = (inqExpireTime - GetTime())
  228.             if inqExpire < 5 then
  229.                 if UnitPower("player", 9) == 3 or sDivinePurpose ~= nil then
  230.                     return PriorityQueue:SpellAvailable(C["Inquisition"])
  231.                 end
  232.             end
  233.         else
  234.             if UnitPower("player", 9) == 3 or sDivinePurpose ~= nil then
  235.                 return PriorityQueue:SpellAvailable(C["Inquisition"])
  236.             end
  237.         end
  238.     end
  239.    
  240. PriorityQueue.priorityTable.name["consecration"] = C["Consecration"]
  241. PriorityQueue.priorityTable.icon["consecration"] = C["Consecration Icon"]
  242. PriorityQueue.priorityTable.spid["consecration"] = 26573
  243. PriorityQueue.priorityTable.actn["consecration"] = "/startattack" --ALSO PERFORM ACTION
  244. PriorityQueue.priorityTable.test["consecration"] =
  245.     function ()
  246.             local manapercent = 100 * UnitPower("player") / UnitPowerMax("player")
  247.             if manapercent > 60 then
  248.                 return PriorityQueue:SpellAvailable(C["Consecration"])
  249.             end
  250.     end
  251.    
  252. PriorityQueue.priorityTable.name["exorcism_nogcd"] = L["Exorcism no other GCD"]
  253. PriorityQueue.priorityTable.icon["exorcism_nogcd"] = C["Exorcism Icon"]
  254. PriorityQueue.priorityTable.spid["exorcism_nogcd"] = 879
  255. PriorityQueue.priorityTable.actn["exorcism_nogcd"] = "/startattack" --ALSO PERFORM ACTION
  256. PriorityQueue.priorityTable.test["exorcism_nogcd"] =
  257.     function ()
  258.         --Only cast if no other ability is coming off CD within 1.5 seconds and Holy Power ~= 3.
  259.         local CSstart, CSduration, CSenabled = GetSpellCooldown(35395);
  260.         local CScooldown = (CSstart + CSduration - GetTime())
  261.         local JUstart, JUduration, JUenabled = GetSpellCooldown(20271);
  262.         local JUcooldown = (JUstart + JUduration - GetTime())
  263.        
  264.         if CScooldown <= 1.5 and JUcooldown <= 1.5 and UnitPower("player", 9) ~= 3 then
  265.             return PriorityQueue:SpellAvailable(C["Exorcism"])
  266.         end
  267.     end
  268.    
  269. PriorityQueue.priorityTable.name["exorcism_aow"] = L["Exorcism if Art of War"]
  270. PriorityQueue.priorityTable.icon["exorcism_aow"] = C["Exorcism Icon"]
  271. PriorityQueue.priorityTable.spid["exorcism_aow"] = 879
  272. PriorityQueue.priorityTable.actn["exorcism_aow"] = "/startattack" --ALSO PERFORM ACTION
  273. PriorityQueue.priorityTable.test["exorcism_aow"] =
  274.     function ()
  275.         sAoW = UnitBuff("player", "The Art of War")
  276.         if sAoW ~= nil then
  277.             return PriorityQueue:SpellAvailable(C["Exorcism"])
  278.         end
  279.     end
  280.  
  281. PriorityQueue.priorityTable.name["exorcism"] = C["Exorcism"]
  282. PriorityQueue.priorityTable.icon["exorcism"] = C["Exorcism Icon"]
  283. PriorityQueue.priorityTable.spid["exorcism"] = 879
  284. PriorityQueue.priorityTable.actn["exorcism"] = "/startattack" --ALSO PERFORM ACTION
  285. PriorityQueue.priorityTable.test["exorcism"] =
  286.     function ()
  287.         return PriorityQueue:SpellAvailable(C["Exorcism"])
  288.     end
  289.    
  290. --Seals
  291. PriorityQueue.priorityTable.name["sor"] = C["Seal of Righteousness"]
  292. PriorityQueue.priorityTable.icon["sor"] = C["Seal of Righteousness Icon"]
  293. PriorityQueue.priorityTable.spid["sor"] = 20154
  294. PriorityQueue.priorityTable.actn["sor"] = "/startattack" --ALSO PERFORM ACTION
  295. PriorityQueue.priorityTable.test["sor"] =
  296.     function ()
  297.         sSoR = UnitBuff("player", "Seal of Righteousness")
  298.        
  299.         if sSoR == nil then
  300.             return PriorityQueue:SpellAvailable(C["Seal of Righteousness"])
  301.         end
  302.     end
  303.  
  304. PriorityQueue.priorityTable.name["sot"] = C["Seal of Truth"]
  305. PriorityQueue.priorityTable.icon["sot"] = C["Seal of Truth Icon"]
  306. PriorityQueue.priorityTable.spid["sot"] = 31801
  307. PriorityQueue.priorityTable.actn["sot"] = "/startattack" --ALSO PERFORM ACTION
  308. PriorityQueue.priorityTable.test["sot"] =
  309.     function ()
  310.         sSoT = UnitBuff("player", "Seal of Truth")
  311.        
  312.         if sSoT == nil then
  313.             return PriorityQueue:SpellAvailable(C["Seal of Truth"])
  314.         end
  315.     end
  316.  
  317. PriorityQueue.priorityTable.name["soj"] = C["Seal of Justice"]
  318. PriorityQueue.priorityTable.icon["soj"] = C["Seal of Justice Icon"]
  319. PriorityQueue.priorityTable.spid["soj"] = 20164
  320. PriorityQueue.priorityTable.actn["soj"] = "/startattack" --ALSO PERFORM ACTION
  321. PriorityQueue.priorityTable.test["soj"] =
  322.     function ()
  323.         sSoJ = UnitBuff("player", "Seal of Justice")
  324.        
  325.         if sSoJ == nil then
  326.             return PriorityQueue:SpellAvailable(C["Seal of Justice"])
  327.         end
  328.     end
  329.    
  330. PriorityQueue.priorityTable.name["soi"] = C["Seal of Insight"]
  331. PriorityQueue.priorityTable.icon["soi"] = C["Seal of Insight Icon"]
  332. PriorityQueue.priorityTable.spid["soi"] = 20165
  333. PriorityQueue.priorityTable.actn["soi"] = "/startattack" --ALSO PERFORM ACTION
  334. PriorityQueue.priorityTable.test["soi"] =
  335.     function ()
  336.         sSoI = UnitBuff("player", "Seal of Insight")
  337.        
  338.         if sSoI == nil then
  339.             return PriorityQueue:SpellAvailable(C["Seal of Insight"])
  340.         end
  341.     end
  342.    
  343. PriorityQueue.priorityTable.name["soa"] = L["Seal of Anything"]
  344. PriorityQueue.priorityTable.icon["soa"] = C["Seal of Anything Icon"]
  345. PriorityQueue.priorityTable.spid["soa"] = 31801
  346. PriorityQueue.priorityTable.actn["soa"] = "/startattack" --ALSO PERFORM ACTION
  347. PriorityQueue.priorityTable.test["soa"] =
  348.     function ()
  349.         sSoR = UnitBuff("player", "Seal of Righteousness")
  350.         sSoT = UnitBuff("player", "Seal of Truth")
  351.         sSoJ = UnitBuff("player", "Seal of Justice")
  352.         sSoI = UnitBuff("player", "Seal of Insight")
  353.        
  354.         if sSoR ~= nil or sSoT ~= nil or sSoJ ~= nil or sSoI ~= nil then
  355.             --We have a seal up
  356.         else
  357.             return true
  358.         end
  359.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement