From 7fa7d9530349c05f65934e6d368afd1b80514687 Mon Sep 17 00:00:00 2001 From: Parnic Date: Thu, 26 May 2016 06:06:05 +0000 Subject: [PATCH] - Legion priest updates: replaced Shadow Orbs with Insanity for 7.0 clients, added ShadowPriestMP for 7.0 clients --- Categories/Power.lua | 36 ++++++++---- Categories/ShadowPriestMana.lua | 97 +++++++++++++++++++++++++++++++++ lib.xml | 1 + 3 files changed, 122 insertions(+), 12 deletions(-) create mode 100644 Categories/ShadowPriestMana.lua diff --git a/Categories/Power.lua b/Categories/Power.lua index 3b5b11e..c3e05f4 100644 --- a/Categories/Power.lua +++ b/Categories/Power.lua @@ -331,12 +331,6 @@ local specialPowers = { arg2 = SPELL_POWER_DEMONIC_FURY, eventPowerIdentifier = "DEMONIC_FURY", }, - { - class = "PRIEST", - tag = "ShadowOrbs", - arg2 = SPELL_POWER_SHADOW_ORBS, - eventPowerIdentifier = "SHADOW_ORBS", - }, { class = "DRUID", tag = "EclipsePower", @@ -356,19 +350,37 @@ local specialPowers = { eventPowerIdentifier = wow_501 and "CHI" or "LIGHT_FORCE", }, } +local wow_700 = select(4, GetBuildInfo()) >= 70000 +if not wow_700 then -- Parnic: shadow orbs are no more in 7.0 + specialPowers[#specialPowers + 1] = + { + class = "PRIEST", + tag = "ShadowOrbs", + arg2 = SPELL_POWER_SHADOW_ORBS, + eventPowerIdentifier = "SHADOW_ORBS", + } +else + specialPowers[#specialPowers + 1] = + { + class = "PRIEST", + tag = "Insanity", + arg2 = SPELL_POWER_INSANITY, + eventPowerIdentifier = "INSANITY_POWER", + } +end for _, data in pairs(specialPowers) do local class = data.class local tag = data.tag local arg2 = data.arg2 local arg3 = data.arg3 - - local _, pclass = UnitClass("player") - + + local _, pclass = UnitClass("player") + --local category = class == pclass and L["Power"] or nil --local noDoc = class ~= pclass - + local specialPowerEvents = "UNIT_POWER#player#" .. data.eventPowerIdentifier .. ";UNIT_MAXPOWER#player#" .. data.eventPowerIdentifier .. ";UNIT_DISPLAYPOWER#player" - + DogTag:AddTag("Unit", tag, { code = function() return UnitPower("player", arg2, arg3) @@ -419,7 +431,7 @@ for _, data in pairs(specialPowers) do example = class == pclass and ('[Fractional' .. tag .. '] => "%d/%d"'):format(UnitPowerMax("player",arg2, arg3)*.632, UnitPowerMax("player",arg2, arg3)) or nil, category = category, }) - + ]] end diff --git a/Categories/ShadowPriestMana.lua b/Categories/ShadowPriestMana.lua new file mode 100644 index 0000000..3d422d1 --- /dev/null +++ b/Categories/ShadowPriestMana.lua @@ -0,0 +1,97 @@ +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 diff --git a/lib.xml b/lib.xml index f25452f..8cfa78f 100644 --- a/lib.xml +++ b/lib.xml @@ -19,6 +19,7 @@