-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathLM_Nagrand.lua
63 lines (46 loc) · 1.72 KB
/
LM_Nagrand.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--[[----------------------------------------------------------------------------
LiteMount/LM_Nagrand.lua
Nagrand mounts, Telaari Talbuk and Frostwolf War Wolf.
Draenor Ability spells are weird.
The name of the Garrison Ability (localized) is
name = C_Spell.GetSpellName(161691)
But,
C_Spell.GetSpellName(name)
returns the actual current spell that's active.
Copyright 2011 Mike Battersby
----------------------------------------------------------------------------]]--
local _, LM = ...
local C_Spell = LM.C_Spell or C_Spell
LM.Nagrand = setmetatable({ }, LM.Spell)
LM.Nagrand.__index = LM.Nagrand
function LM.Nagrand:Get(spellID, faction, ...)
local m = LM.Spell.Get(self, spellID, ...)
if m then
m.baseSpellID = LM.SPELL.GARRISON_ABILITY
m.baseSpellName = C_Spell.GetSpellName(m.baseSpellID)
m.needsFaction = faction
end
return m
end
function LM.Nagrand:IsHidden()
local playerFaction = UnitFactionGroup("player")
return playerFaction ~= self.needsFaction
end
function LM.Nagrand:IsCollected()
return not self:IsHidden() and IsPlayerSpell(self.baseSpellID)
end
function LM.Nagrand:GetCastAction(context)
return LM.SecureAction:Spell(self.baseSpellName)
end
-- Check if the spell is in one of the zone spell slots.
function LM.Nagrand:IsCastable()
local zoneAbilities = C_ZoneAbility.GetActiveAbilities()
for _,info in ipairs(zoneAbilities) do
local zoneSpellName = C_Spell.GetSpellName(info.spellID)
local zoneSpellID = C_Spell.GetSpellInfo(zoneSpellName).spellID
if zoneSpellID == self.spellID then
return C_Spell.IsSpellUsable(info.spellID) and LM.Mount.IsCastable(self)
end
end
return false
end