Added generic Mana tags

There are too many classes that have mana in the background alongside some other power type, so I've added Mana, MaxMana, etc. tags to support "always get me my mana values, no matter my current power type" use cases.
Deleted the new ShadowPriestMana module, but left DruidMP and MonkMP alone since they have existed for a long while.
This commit is contained in:
Parnic
2016-05-28 01:55:53 -05:00
parent a2d03e1568
commit dedbf942a3
3 changed files with 59 additions and 98 deletions

View File

@ -75,6 +75,65 @@ DogTag:AddTag("Unit", "FractionalMP", {
})
DogTag:AddTag("Unit", "Mana", {
code = function(unit)
return UnitPower(unit, SPELL_POWER_MANA)
end,
arg = {
'unit', 'string;undef', 'player'
},
ret = "number",
events = mpEvents .. ";FastPower#$unit",
doc = L["Return the current mana of unit, regardless of their current power type"],
example = ('[Mana] => "%d"'):format(UnitPowerMax("player", SPELL_POWER_MANA)*.632),
category = L["Power"]
})
DogTag:AddTag("Unit", "MaxMana", {
code = function(unit)
return UnitPowerMax(unit, SPELL_POWER_MANA)
end,
arg = {
'unit', 'string;undef', 'player'
},
ret = "number",
events = mpEvents,
doc = L["Return the maximum mana of unit, regardless of their current power type"],
example = ('[MaxMana] => "%d"'):format(UnitPowerMax("player", SPELL_POWER_MANA)),
category = L["Power"]
})
DogTag:AddTag("Unit", "PercentMana", {
alias = "[Mana(unit=unit) / MaxMana(unit=unit) * 100]:Round(1)",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the percentage mana of unit, regardless of their current power type"],
example = '[PercentMana] => "63.2"; [PercentMana:Percent] => "63.2%"',
category = L["Power"]
})
DogTag:AddTag("Unit", "MissingMana", {
alias = "MaxMana(unit=unit) - Mana(unit=unit)",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the missing mana of unit, regardless of their current power type"],
example = ('[MissingMana] => "%d"'):format(UnitPowerMax("player", SPELL_POWER_MANA)*.368),
category = L["Power"]
})
DogTag:AddTag("Unit", "FractionalMana", {
alias = "Concatenate(Mana(unit=unit), '/', MaxMana(unit=unit))",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the current and maximum mana of unit, regardless of their current power type"],
example = ('[FractionalMana] => "%d/%d"'):format(UnitPowerMax("player", SPELL_POWER_MANA)*.632, UnitPowerMax("player", SPELL_POWER_MANA)),
category = L["Power"]
})
DogTag:AddTag("Unit", "AltP", {
code = UnitPower,
arg = {

View File

@ -1,97 +0,0 @@
local MAJOR_VERSION = "LibDogTag-Unit-3.0"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 281 $"):match("%d+")) or 0
if MINOR_VERSION > _G.DogTag_Unit_MINOR_VERSION then
_G.DogTag_Unit_MINOR_VERSION = MINOR_VERSION
end
local _G, select = _G, select
local UnitClass, UnitPowerMax, UnitPower, UnitPowerType =
UnitClass, UnitPowerMax, UnitPower, UnitPowerType
DogTag_Unit_funcs[#DogTag_Unit_funcs+1] = function(DogTag_Unit, DogTag)
local L = DogTag_Unit.L
local wow_700 = select(4, GetBuildInfo()) >= 70000
local mpEvents = "ShadowPriestMana;UNIT_POWER#$unit;UNIT_MAXPOWER#$unit"
if wow_700 then
DogTag:AddTag("Unit", "ShadowPriestMP", {
code = function(unit)
if select(2, UnitClass(unit)) == "PRIEST" and UnitPowerType(unit) == SPELL_POWER_INSANITY then
return UnitPower(unit, SPELL_POWER_MANA)
else
return nil
end
end,
arg = {
'unit', 'string;undef', 'player'
},
ret = "number;nil",
events = mpEvents,
doc = L["Return the current mana of unit if unit is a shadow priest"],
example = ('[ShadowPriestMP] => "%d"'):format(UnitPowerMax("player",SPELL_POWER_MANA)*.632),
category = L["ShadowPriest"],
})
DogTag:AddTag("Unit", "MaxShadowPriestMP", {
code = function(unit)
if select(2, UnitClass(unit)) == "PRIEST" and UnitPowerType(unit) == SPELL_POWER_INSANITY then
return UnitPowerMax(unit, SPELL_POWER_MANA)
else
return nil
end
end,
arg = {
'unit', 'string;undef', 'player'
},
ret = "number;nil",
events = mpEvents,
doc = L["Return the maximum mana of unit if unit is a shadow priest"],
example = ('[MaxShadowPriestMP] => "%d"'):format(UnitPowerMax("player",SPELL_POWER_MANA)),
category = L["ShadowPriest"],
})
DogTag:AddTag("Unit", "PercentShadowPriestMP", {
alias = "[ShadowPriestMP(unit=unit) / MaxShadowPriestMP(unit=unit) * 100]:Round(1)",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the percentage mana of unit if unit is a shadow priest"],
example = '[PercentShadowPriestMP] => "63.2"; [PercentShadowPriestMP:Percent] => "63.2%"',
category = L["ShadowPriest"],
})
DogTag:AddTag("Unit", "MissingShadowPriestMP", {
alias = "MaxShadowPriestMP(unit=unit) - ShadowPriestMP(unit=unit)",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the missing mana of unit if unit is a shadow priest"],
example = ('[MissingShadowPriestMP] => "%d"'):format(UnitPowerMax("player",0)*.368),
category = L["ShadowPriest"]
})
DogTag:AddTag("Unit", "FractionalShadowPriestMP", {
alias = "Concatenate(ShadowPriestMP(unit=unit), '/', MaxShadowPriestMP(unit=unit))",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return the current and maximum mana of unit if unit is a shadow priest"],
example = ('[FractionalShadowPriestMP] => "%d/%d"'):format(UnitPowerMax("player",0)*.632, UnitPowerMax("player",0)),
category = L["ShadowPriest"]
})
DogTag:AddTag("Unit", "IsMaxShadowPriestMP", {
alias = "Boolean(ShadowPriestMP(unit=unit) = MaxShadowPriestMP(unit=unit))",
arg = {
'unit', 'string;undef', 'player'
},
doc = L["Return True if at max mana or unit is not a shadow priest"],
example = ('[IsMaxShadowPriestMP] => %q; [IsMaxShadowPriestMP] => ""'):format(L["True"]),
category = L["ShadowPriest"]
})
end -- wow_700
end

View File

@ -19,7 +19,6 @@
<Script file="Categories\Power.lua" />
<Script file="Categories\Range.lua" />
<Script file="Categories\Reputation.lua" />
<Script file="Categories\ShadowPriestMana.lua" />
<Script file="Categories\Status.lua" />
<Script file="Categories\Talent.lua" />
<Script file="Categories\Threat.lua" />