diff --git a/Categories/Auras.lua b/Categories/Auras.lua index b9a11d0..26aa665 100644 --- a/Categories/Auras.lua +++ b/Categories/Auras.lua @@ -215,7 +215,7 @@ DogTag:AddTag("Unit", "HasAura", { end, arg = { 'aura', 'string', '@req', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Aura#$unit#$aura", @@ -275,7 +275,7 @@ end DogTag:AddTag("Unit", "DruidForm", { code = DruidForm, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "UNIT_DISPLAYPOWER#$unit;Aura#$unit#" .. MOONKIN_FORM .. ";Aura#$unit#" .. AQUATIC_FORM .. ";Aura#$unit#" .. FLIGHT_FORM .. ";Aura#$unit#" .. SWIFT_FLIGHT_FORM .. ";Aura#$unit#" .. TRAVEL_FORM .. ";Aura#$unit#" .. TREE_OF_LIFE, @@ -313,7 +313,7 @@ DogTag:AddTag("Unit", "NumDebuffs", { return currentNumDebuffs[unit] end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "Aura#$unit", @@ -333,7 +333,7 @@ DogTag:AddTag("Unit", "AuraDuration", { end, arg = { 'aura', 'string', '@req', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, events = "Update", ret = "number;nil", @@ -346,7 +346,7 @@ local SHADOWFORM = GetSpellInfo(15473) DogTag:AddTag("Unit", "IsShadowform", { alias = ("HasAura(aura=%q, unit=unit)"):format(SHADOWFORM), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the shadowform buff"], example = ('[IsShadowform] => %q; [IsShadowform] => ""'):format(L["True"]), @@ -359,7 +359,7 @@ local PROWL = GetSpellInfo(5215) DogTag:AddTag("Unit", "IsStealthed", { alias = ("HasAura(aura=%q, unit=unit) or HasAura(aura=%q, unit=unit) or HasAura(aura=%q, unit=unit)"):format(STEALTH, SHADOWFORM, PROWL), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit is stealthed in some way"], example = ('[IsStealthed] => %q; [IsStealthed] => ""'):format(L["True"]), @@ -370,7 +370,7 @@ local SHIELD_WALL = GetSpellInfo(871) DogTag:AddTag("Unit", "HasShieldWall", { alias = ("HasAura(aura=%q, unit=unit)"):format(SHIELD_WALL), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Shield Wall buff"], example = ('[HasShieldWall] => %q; [HasShieldWall] => ""'):format(L["True"]), @@ -381,7 +381,7 @@ local LAST_STAND = GetSpellInfo(12975) DogTag:AddTag("Unit", "HasLastStand", { alias = ("HasAura(aura=%q, unit=unit)"):format(LAST_STAND), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Last Stand buff"], example = ('[HasLastStand] => %q; [HasLastStand] => ""'):format(L["True"]), @@ -392,7 +392,7 @@ local SOULSTONE_RESURRECTION = GetSpellInfo(20707) DogTag:AddTag("Unit", "HasSoulstone", { alias = ("HasAura(aura=%q, unit=unit)"):format(SOULSTONE_RESURRECTION), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Soulstone buff"], example = ('[HasSoulstone] => %q; [HasSoulstone] => ""'):format(L["True"]), @@ -403,7 +403,7 @@ local MISDIRECTION = GetSpellInfo(34477) DogTag:AddTag("Unit", "HasMisdirection", { alias = ("HasAura(aura=%q, unit=unit)"):format(MISDIRECTION), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Misdirection buff"], example = ('[HasMisdirection] => %q; [HasMisdirection] => ""'):format(L["True"]), @@ -414,7 +414,7 @@ local ICE_BLOCK = GetSpellInfo(27619) DogTag:AddTag("Unit", "HasIceBlock", { alias = ("HasAura(aura=%q, unit=unit)"):format(ICE_BLOCK), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Ice Block buff"], example = ('[HasIceBlock] => %q; [HasIceBlock] => ""'):format(L["True"]), @@ -425,7 +425,7 @@ local INVISIBILITY = GetSpellInfo(66) DogTag:AddTag("Unit", "HasInvisibility", { alias = ("HasAura(aura=%q, unit=unit)"):format(INVISIBILITY), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Invisibility buff"], example = ('[HasInvisibility] => %q; [HasInvisibility] => ""'):format(L["True"]), @@ -436,7 +436,7 @@ local DIVINE_INTERVENTION = GetSpellInfo(19752) DogTag:AddTag("Unit", "HasDivineIntervention", { alias = ("HasAura(aura=%q, unit=unit)"):format(DIVINE_INTERVENTION), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has the Divine Intervention buff"], example = ('[HasDivineIntervention] => %q; [HasDivineIntervention] => ""'):format(L["True"]), @@ -449,7 +449,7 @@ DogTag:AddTag("Unit", "HasDebuffType", { end, arg = { 'type', 'string', '@req', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Aura#$unit#$type", @@ -461,7 +461,7 @@ DogTag:AddTag("Unit", "HasDebuffType", { DogTag:AddTag("Unit", "HasMagicDebuff", { alias = ("HasDebuffType(type=%q, unit=unit)"):format(L["Magic"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has a Magic debuff"], example = ('[HasMagicDebuff] => %q; [HasMagicDebuff] => ""'):format(L["True"]), @@ -471,7 +471,7 @@ DogTag:AddTag("Unit", "HasMagicDebuff", { DogTag:AddTag("Unit", "HasCurseDebuff", { alias = ("HasDebuffType(type=%q, unit=unit)"):format(L["Curse"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has a Curse debuff"], example = ('[HasCurseDebuff] => %q; [HasCurseDebuff] => ""'):format(L["True"]), @@ -481,7 +481,7 @@ DogTag:AddTag("Unit", "HasCurseDebuff", { DogTag:AddTag("Unit", "HasPoisonDebuff", { alias = ("HasDebuffType(type=%q, unit=unit)"):format(L["Poison"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has a Poison debuff"], example = ('[HasPoisonDebuff] => %q; [HasPoisonDebuff] => ""'):format(L["True"]), @@ -491,7 +491,7 @@ DogTag:AddTag("Unit", "HasPoisonDebuff", { DogTag:AddTag("Unit", "HasDiseaseDebuff", { alias = ("HasDebuffType(type=%q, unit=unit)"):format(L["Disease"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if the unit has a Disease debuff"], example = ('[HasDiseaseDebuff] => %q; [HasDiseaseDebuff] => ""'):format(L["True"]), diff --git a/Categories/Cast.lua b/Categories/Cast.lua index 9236170..8ffa578 100644 --- a/Categories/Cast.lua +++ b/Categories/Cast.lua @@ -233,7 +233,7 @@ DogTag:AddTag("Unit", "CastName", { return castData[unit].spell end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "Cast", @@ -247,7 +247,7 @@ DogTag:AddTag("Unit", "CastTarget", { return castData[unit].target end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "Cast", @@ -261,7 +261,7 @@ DogTag:AddTag("Unit", "CastRank", { return castData[unit].rank end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "Cast", @@ -280,7 +280,7 @@ DogTag:AddTag("Unit", "CastStartDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "FastUpdate;Cast#$unit", @@ -299,7 +299,7 @@ DogTag:AddTag("Unit", "CastEndDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "FastUpdate;Cast#$unit", @@ -314,7 +314,7 @@ DogTag:AddTag("Unit", "CastDelay", { return castData[unit].delay end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "Cast#$unit", @@ -328,7 +328,7 @@ DogTag:AddTag("Unit", "CastIsChanneling", { return not castData[unit].casting end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Cast#$unit", @@ -347,7 +347,7 @@ DogTag:AddTag("Unit", "CastStopDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "FastUpdate;Cast#$unit", @@ -361,7 +361,7 @@ DogTag:AddTag("Unit", "CastStopMessage", { return castData[unit].stopMessage end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "Cast#$unit", diff --git a/Categories/Characteristics.lua b/Categories/Characteristics.lua index 6bd31be..f093a74 100644 --- a/Categories/Characteristics.lua +++ b/Categories/Characteristics.lua @@ -417,7 +417,7 @@ DogTag:AddTag("Unit", "PvPRank", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "UNIT_NAME_UPDATE#$unit;PLAYER_ENTERING_WORLD#$unit", @@ -475,7 +475,7 @@ DogTag:AddTag("Unit", "HostileColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_FACTION#$unit", @@ -497,7 +497,7 @@ DogTag:AddTag("Unit", "AggroColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_FACTION#$unit", @@ -518,7 +518,7 @@ DogTag:AddTag("Unit", "ClassColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", doc = L["Return the color or wrap value with the class color of unit"], @@ -541,7 +541,7 @@ DogTag:AddTag("Unit", "DifficultyColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_LEVEL#$unit;PLAYER_LEVEL_UP#$unit", @@ -553,7 +553,7 @@ DogTag:AddTag("Unit", "DifficultyColor", { DogTag:AddTag("Unit", "Guid", { code = UnitGUID, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", doc = L["Return the GUID for the unit, an internal identifier."], diff --git a/Categories/DruidMana.lua b/Categories/DruidMana.lua index 2a41380..ce13ef4 100644 --- a/Categories/DruidMana.lua +++ b/Categories/DruidMana.lua @@ -42,7 +42,7 @@ DogTag:AddTag("Unit", "DruidMP", { end, dynamicCode = true, args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "DruidMana", @@ -57,7 +57,7 @@ DogTag:AddTag("Unit", "MaxDruidMP", { end, dynamicCode = true, args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "DruidMana", @@ -69,7 +69,7 @@ DogTag:AddTag("Unit", "MaxDruidMP", { DogTag:AddTag("Unit", "PercentDruidMP", { alias = "[DruidMP(unit=unit) / MaxDruidMP(unit=unit) * 100]:Round(1)", args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the percentage mana of unit if unit is you and you are a druid"], example = '[PercentDruidMP] => "63.2"; [PercentDruidMP:Percent] => "63.2%"', @@ -79,7 +79,7 @@ DogTag:AddTag("Unit", "PercentDruidMP", { DogTag:AddTag("Unit", "MissingDruidMP", { alias = "MaxDruidMP(unit=unit) - DruidMP(unit=unit)", args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the missing mana of unit if unit is you and you are a druid"], example = ('[MissingDruidMP] => "%d"'):format(UnitManaMax("player")*.368), @@ -89,7 +89,7 @@ DogTag:AddTag("Unit", "MissingDruidMP", { DogTag:AddTag("Unit", "FractionalDruidMP", { alias = "Concatenate(DruidMP(unit=unit), '/', MaxDruidMP(unit=unit))", args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the current and maximum mana of unit if unit is you and you are a druid"], example = ('[FractionalDruidMP] => "%d/%d"'):format(UnitManaMax("player")*.632, UnitManaMax("player")), @@ -99,7 +99,7 @@ DogTag:AddTag("Unit", "FractionalDruidMP", { DogTag:AddTag("Unit", "IsMaxDruidMP", { alias = "Boolean(DruidMP(unit=unit) = MaxDruidMP(unit=unit))", args = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if at max mana, unit is you, and you are a druid"], example = ('[IsMaxDruidMP] => %q; [IsMaxDruidMP] => ""'):format(L["True"]), diff --git a/Categories/Experience.lua b/Categories/Experience.lua index 286897e..66a8afd 100644 --- a/Categories/Experience.lua +++ b/Categories/Experience.lua @@ -29,7 +29,7 @@ DogTag:AddTag("Unit", "XP", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UpdateExperience#$unit", @@ -50,7 +50,7 @@ DogTag:AddTag("Unit", "MaxXP", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UpdateExperience#$unit", @@ -62,7 +62,7 @@ DogTag:AddTag("Unit", "MaxXP", { DogTag:AddTag("Unit", "FractionalXP", { alias = [[XP(unit=unit) "/" MaxXP(unit=unit)]], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the current and maximum experience of unit"], example = '[FractionalXP] => "8540/10000"', @@ -72,7 +72,7 @@ DogTag:AddTag("Unit", "FractionalXP", { DogTag:AddTag("Unit", "PercentXP", { alias = [[(XP(unit=unit) / MaxXP(unit=unit) * 100):Round(1)]], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the percentage experience of unit"], example = '[PercentXP] => "85.4"; [PercentXP:Percent] => "85.4%"', @@ -82,7 +82,7 @@ DogTag:AddTag("Unit", "PercentXP", { DogTag:AddTag("Unit", "MissingXP", { alias = [[MaxXP(unit=unit) - XP(unit=unit)]], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the missing experience of unit"], example = '[MissingXP] => "1460"', @@ -98,7 +98,7 @@ DogTag:AddTag("Unit", "RestXP", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UpdateExperience#$unit", @@ -110,7 +110,7 @@ DogTag:AddTag("Unit", "RestXP", { DogTag:AddTag("Unit", "PercentRestXP", { alias = [[(RestXP(unit=unit) / MaxXP(unit=unit) * 100):Round(1)]], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the percentage accumulated rest experience of unit"], example = '[PercentRestXP] => "50"; [PercentRestXP:Percent] => "50%"', diff --git a/Categories/GuildNote.lua b/Categories/GuildNote.lua index c6b4f0a..af8753e 100644 --- a/Categories/GuildNote.lua +++ b/Categories/GuildNote.lua @@ -79,7 +79,7 @@ DogTag:AddTag("Unit", "GuildNote", { return nil end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "GUILD_ROSTER_UPDATE", @@ -97,7 +97,7 @@ DogTag:AddTag("Unit", "OfficerNote", { return nil end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "GUILD_ROSTER_UPDATE", diff --git a/Categories/Health.lua b/Categories/Health.lua index 9b021b5..451e228 100644 --- a/Categories/Health.lua +++ b/Categories/Health.lua @@ -122,7 +122,7 @@ DogTag:AddTag("Unit", "HP", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player', 'known', 'boolean', false, }, ret = function(args) @@ -144,7 +144,7 @@ DogTag:AddTag("Unit", "MaxHP", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player', 'known', 'boolean', false, }, ret = function(args) @@ -166,7 +166,7 @@ DogTag:AddTag("Unit", "PercentHP", { end, fakeAlias = "[CurHP / MaxHP * 100]:Round(1)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UNIT_HEALTH#$unit;UNIT_MAXHEALTH#$unit", @@ -178,7 +178,7 @@ DogTag:AddTag("Unit", "PercentHP", { DogTag:AddTag("Unit", "MissingHP", { alias = [=[MaxHP(unit=unit, known=known) - HP(unit=unit, known=known)]=], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player', 'known', 'boolean', false, }, ret = "number", @@ -190,7 +190,7 @@ DogTag:AddTag("Unit", "MissingHP", { DogTag:AddTag("Unit", "FractionalHP", { alias = [=[Concatenate(HP(unit=unit, known=known), "/", MaxHP(unit=unit, known=known))]=], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player', 'known', 'boolean', false, }, ret = "string", @@ -204,7 +204,7 @@ DogTag:AddTag("Unit", "IsMaxHP", { return UnitHealth(unit) == UnitHealthMax(unit) end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", doc = L["Return True if unit is at full health"], @@ -250,7 +250,7 @@ DogTag:AddTag("Unit", "HPColor", { end, arg = { 'value', 'string;undef', "@undef", - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_HEALTH#$unit;UNIT_MAXHEALTH#$unit", diff --git a/Categories/Power.lua b/Categories/Power.lua index b202ca9..2bae778 100644 --- a/Categories/Power.lua +++ b/Categories/Power.lua @@ -12,7 +12,7 @@ local L = DogTag_Unit.L DogTag:AddTag("Unit", "MP", { code = UnitMana, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UNIT_MANA#$unit;UNIT_RAGE#$unit;UNIT_FOCUS#$unit;UNIT_ENERGY#$unit;UNIT_MAXMANA#$unit;UNIT_MAXRAGE#$unit;UNIT_MAXFOCUS#$unit;UNIT_MAXENERGY#$unit;UNIT_DISPLAYPOWER#$unit", @@ -24,7 +24,7 @@ DogTag:AddTag("Unit", "MP", { DogTag:AddTag("Unit", "MaxMP", { code = UnitManaMax, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UNIT_MANA#$unit;UNIT_RAGE#$unit;UNIT_FOCUS#$unit;UNIT_ENERGY#$unit;UNIT_MAXMANA#$unit;UNIT_MAXRAGE#$unit;UNIT_MAXFOCUS#$unit;UNIT_MAXENERGY#$unit;UNIT_DISPLAYPOWER#$unit", @@ -36,7 +36,7 @@ DogTag:AddTag("Unit", "MaxMP", { DogTag:AddTag("Unit", "PercentMP", { alias = "[MP(unit=unit) / MaxMP(unit=unit) * 100]:Round(1)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the percentage mana/rage/energy of unit"], example = '[PercentMP] => "63.2"; [PercentMP:Percent] => "63.2%"', @@ -46,7 +46,7 @@ DogTag:AddTag("Unit", "PercentMP", { DogTag:AddTag("Unit", "MissingMP", { alias = "MaxMP(unit=unit) - MP(unit=unit)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the missing mana/rage/energy of unit"], example = ('[MissingMP] => "%d"'):format(UnitManaMax("player")*.368), @@ -56,7 +56,7 @@ DogTag:AddTag("Unit", "MissingMP", { DogTag:AddTag("Unit", "FractionalMP", { alias = "Concatenate(MP(unit=unit), '/', MaxMP(unit=unit))", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the current and maximum mana/rage/energy of unit"], example = ('[FractionalMP] => "%d/%d"'):format(UnitManaMax("player")*.632, UnitManaMax("player")), @@ -77,7 +77,7 @@ DogTag:AddTag("Unit", "TypePower", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_DISPLAYPOWER#$unit", @@ -90,7 +90,7 @@ DogTag:AddTag("Unit", "IsPowerType", { alias = [=[Boolean(TypePower(unit=unit) = type)]=], arg = { 'type', 'string', '@req', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "UNIT_DISPLAYPOWER#$unit", @@ -102,7 +102,7 @@ DogTag:AddTag("Unit", "IsPowerType", { DogTag:AddTag("Unit", "IsRage", { alias = ("IsPowerType(type=%q, unit=unit)"):format(L["Rage"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit currently uses rage"], example = ('[IsRage] => %q; [IsRage] => ""'):format(L["True"]), @@ -112,7 +112,7 @@ DogTag:AddTag("Unit", "IsRage", { DogTag:AddTag("Unit", "IsFocus", { alias = ("IsPowerType(type=%q, unit=unit)"):format(L["Focus"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit currently uses focus"], example = ('[IsFocus] => %q; [IsFocus] => ""'):format(L["True"]), @@ -122,7 +122,7 @@ DogTag:AddTag("Unit", "IsFocus", { DogTag:AddTag("Unit", "IsEnergy", { alias = ("IsPowerType(type=%q, unit=unit)"):format(L["Energy"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit currently uses energy"], example = ('[IsEnergy] => %q; [IsEnergy] => ""'):format(L["True"]), @@ -132,7 +132,7 @@ DogTag:AddTag("Unit", "IsEnergy", { DogTag:AddTag("Unit", "IsMana", { alias = ("IsPowerType(type=%q, unit=unit)"):format(L["Mana"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit currently uses mana"], example = ('[IsMana] => %q; [IsMana] => ""'):format(L["True"]), @@ -142,7 +142,7 @@ DogTag:AddTag("Unit", "IsMana", { DogTag:AddTag("Unit", "IsMaxMP", { alias = "Boolean(MP(unit=unit) = MaxMP(unit=unit))", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit is at full rage/mana/energy"], example = ('[IsMaxMP] => %q; [IsMaxMP] => ""'):format(L["True"]), @@ -152,7 +152,7 @@ DogTag:AddTag("Unit", "IsMaxMP", { DogTag:AddTag("Unit", "HasMP", { alias = "Boolean(MaxMP(unit=unit) > 0)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return True if unit has no power type at all"], example = ('[HasNoMP] => %q; [HasNoMP] => ""'):format(L["True"]), @@ -182,7 +182,7 @@ DogTag:AddTag("Unit", "PowerColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", events = "UNIT_DISPLAYPOWER#$unit", diff --git a/Categories/Range.lua b/Categories/Range.lua index b0cffa3..a8167d4 100644 --- a/Categories/Range.lua +++ b/Categories/Range.lua @@ -25,7 +25,7 @@ end) DogTag:AddTag("Unit", "Range", { alias = [=[IsVisible(unit=unit) & ~DeadType(unit=unit) ? MinRange(unit=unit) (Concatenate(" - ", MaxRange(unit=unit)) || "+")]=], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the approximate range of unit, if RangeCheck-1.0 is available"], example = '[Range] => "5 - 15"; [Range] => "30+"; [Range] => ""', @@ -38,7 +38,7 @@ DogTag:AddTag("Unit", "MinRange", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = function() if not RangeCheckLib then @@ -65,7 +65,7 @@ DogTag:AddTag("Unit", "MaxRange", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = function() if not RangeCheckLib then diff --git a/Categories/Status.lua b/Categories/Status.lua index 43edb77..ca52335 100644 --- a/Categories/Status.lua +++ b/Categories/Status.lua @@ -136,7 +136,7 @@ DogTag:AddTag("Unit", "OfflineDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "OfflineDuration#$unit", @@ -162,7 +162,7 @@ DogTag:AddTag("Unit", "DeadDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "DeadDuration#$unit", @@ -182,7 +182,7 @@ DogTag:AddTag("Unit", "DeadType", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "DeadDuration#$unit", @@ -194,7 +194,7 @@ DogTag:AddTag("Unit", "DeadType", { DogTag:AddTag("Unit", "Dead", { alias = "DeadType(unit=unit) Concatenate(' ', DeadDuration(unit=unit):FormatDuration:Paren)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return Dead or Ghost and the duration dead if unit is dead"], example = ('[Dead] => "%s (1:34)"; [Dead] => "%s"; [Dead] => ""'):format(L["Dead"], L["Ghost"]), @@ -211,7 +211,7 @@ DogTag:AddTag("Unit", "AFKDuration", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", events = "AFKDuration#$unit", @@ -236,7 +236,7 @@ DogTag:AddTag("Unit", "DND", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "PLAYER_FLAGS_CHANGED#$unit", @@ -256,7 +256,7 @@ DogTag:AddTag("Unit", "PvP", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", doc = L["Return PvP or FFA if the unit is PvP-enabled"], @@ -276,7 +276,7 @@ DogTag:AddTag("Unit", "IsResting", { DogTag:AddTag("Unit", "IsLeader", { code = UnitIsPartyLeader, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", doc = L["Return True if unit is a party leader"], @@ -287,7 +287,7 @@ DogTag:AddTag("Unit", "IsLeader", { DogTag:AddTag("Unit", "IsFeignedDeath", { code = UnitIsFeignDeath, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", doc = L["Return True if unit is feigning death"], @@ -343,7 +343,7 @@ DogTag:AddTag("Unit", "HappyIcon", { DogTag:AddTag("Unit", "IsTappedByMe", { code = UnitIsTappedByPlayer, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Update", @@ -357,7 +357,7 @@ DogTag:AddTag("Unit", "IsTapped", { return UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Update", @@ -369,7 +369,7 @@ DogTag:AddTag("Unit", "IsTapped", { DogTag:AddTag("Unit", "InCombat", { code = UnitAffectingCombat, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Update", @@ -393,7 +393,7 @@ DogTag:AddTag("Unit", "FKey", { return nil end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", doc = L["Return the function key to press to select unit"], @@ -416,7 +416,7 @@ DogTag:AddTag("Unit", "RaidGroup", { return nil end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number;nil", doc = L["Return the raid group that unit is in"], @@ -439,7 +439,7 @@ DogTag:AddTag("Unit", "IsMasterLooter", { return false end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", doc = L["Return True if unit is the master looter for your raid"], @@ -456,7 +456,7 @@ DogTag:AddTag("Unit", "Target", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string", doc = L["Return the unit id of unit's target"], @@ -477,7 +477,7 @@ DogTag:AddTag("Unit", "Pet", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", doc = L["Return the unit id of unit's pet"], @@ -496,7 +496,7 @@ DogTag:AddTag("Unit", "NumTargeting", { return num end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "number", events = "UNIT_TARGET;Update", @@ -522,7 +522,7 @@ DogTag:AddTag("Unit", "TargetingList", { return s end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "UNIT_TARGET;Update", @@ -545,7 +545,7 @@ DogTag:AddTag("Unit", "IsUnit", { code = UnitIsUnit, arg = { 'other', 'string', '@req', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "UNIT_FACTION#$unit", @@ -557,7 +557,7 @@ DogTag:AddTag("Unit", "IsUnit", { DogTag:AddTag("Unit", "IsCharmed", { code = UnitIsCharmed, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "UNIT_FACTION#$unit", @@ -569,7 +569,7 @@ DogTag:AddTag("Unit", "IsCharmed", { DogTag:AddTag("Unit", "IsVisible", { code = UnitIsVisible, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "UNIT_PORTRAIT_UPDATE", @@ -599,7 +599,7 @@ DogTag:AddTag("Unit", "StatusColor", { end, arg = { 'value', 'string;undef', '@undef', - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "DeadDuration#$unit", @@ -643,7 +643,7 @@ local DIVINE_INTERVENTION = GetSpellInfo(19752) DogTag:AddTag("Unit", "Status", { alias = ("Offline(unit=unit) or (HasDivineIntervention(unit=unit) ? %q) or (IsFeignedDeath(unit=unit) ? %q) or [if Dead(unit=unit) then ((HasSoulstone(unit=unit) ? %q) or Dead(unit=unit))]"):format(DIVINE_INTERVENTION, L["Feigned Death"], L["Soulstoned"]), arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return whether unit is offline, has divine intervention, is dead, feigning death, or has a soulstone while dead"], example = ('[Status] => "Offline"; [Status] => "Dead"; [Status] => ""'), diff --git a/Categories/Talent.lua b/Categories/Talent.lua index 444cd95..c0a21de 100644 --- a/Categories/Talent.lua +++ b/Categories/Talent.lua @@ -102,7 +102,7 @@ DogTag:AddTag("Unit", "TalentSpec", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "Talent", @@ -117,7 +117,7 @@ DogTag:AddTag("Unit", "TalentTree", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "Talent", diff --git a/Categories/Threat.lua b/Categories/Threat.lua index 01f12f2..32c79a9 100644 --- a/Categories/Threat.lua +++ b/Categories/Threat.lua @@ -67,7 +67,7 @@ DogTag:AddTag("Unit", "Threat", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = function() if ThreatLib then @@ -88,7 +88,7 @@ DogTag:AddTag("Unit", "MaxThreat", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = function() if ThreatLib then @@ -106,7 +106,7 @@ DogTag:AddTag("Unit", "MaxThreat", { DogTag:AddTag("Unit", "PercentThreat", { alias = [=[(Threat(unit=unit) / MaxThreat(unit=unit) * 100):Round(1)]=], arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the percentage threat that you have against enemy unit or that friendly unit has against your target, if ThreatLib is available"], example = '[PercentThreat] => "62.5"; [PercentThreat:Percent] => "62.5%"', @@ -117,7 +117,7 @@ DogTag:AddTag("Unit", "PercentThreat", { DogTag:AddTag("Unit", "MissingThreat", { alias = "MaxThreat(unit=unit) - Threat(unit=unit)", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the missing threat that you have against enemy unit or that friendly unit has against your target, if ThreatLib is available"], example = '[MissingThreat] => "30"', @@ -127,7 +127,7 @@ DogTag:AddTag("Unit", "MissingThreat", { DogTag:AddTag("Unit", "FractionalThreat", { alias = "Concatenate(Threat(unit=unit), '/', MaxThreat(unit=unit))", arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, doc = L["Return the current and maximum threat that you have against enemy unit or that friendly unit has against your target, if ThreatLib is available"], example = '[FractionalThreat] => "50/80"', @@ -140,7 +140,7 @@ DogTag:AddTag("Unit", "HasThreat", { end, dynamicCode = true, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "boolean", events = "Threat#$unit", diff --git a/Categories/TooltipScanning.lua b/Categories/TooltipScanning.lua index 10194a8..e5b1580 100644 --- a/Categories/TooltipScanning.lua +++ b/Categories/TooltipScanning.lua @@ -120,7 +120,7 @@ DogTag:AddTag("Unit", "Guild", { end end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", doc = L["Return the guild name or title of unit"], @@ -153,7 +153,7 @@ DogTag:AddTag("Unit", "Owner", { return nil end, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", doc = L["Return the name of the owner of unit, if a pet"], @@ -164,7 +164,7 @@ DogTag:AddTag("Unit", "Owner", { DogTag:AddTag("Unit", "Faction", { code = FigureFaction, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "UNIT_FACTION", @@ -176,7 +176,7 @@ DogTag:AddTag("Unit", "Faction", { DogTag:AddTag("Unit", "Zone", { code = FigureZone, arg = { - 'unit', 'string', 'player', + 'unit', 'string;undef', 'player' }, ret = "string;nil", events = "SlowUpdate", diff --git a/LibDogTag-Unit-3.0.lua b/LibDogTag-Unit-3.0.lua index 7ed96e8..ad0164d 100644 --- a/LibDogTag-Unit-3.0.lua +++ b/LibDogTag-Unit-3.0.lua @@ -216,7 +216,9 @@ DogTag:AddCompilationStep("Unit", "tag", function(ast, t, tag, tagData, kwargs, t[#t+1] = "\n" end else - t[#t+1] = [=[if not DogTag.IsLegitimateUnit[]=] + t[#t+1] = [=[if ]=] + t[#t+1] = compiledKwargs["unit"][1] + t[#t+1] = [=[ and not DogTag.IsLegitimateUnit[]=] t[#t+1] = compiledKwargs["unit"][1] t[#t+1] = [=[] then]=] t[#t+1] = "\n" @@ -260,7 +262,9 @@ end) DogTag:AddCompilationStep("Unit", "tagevents", function(ast, t, u, tag, tagData, kwargs, extraKwargs, compiledKwargs, events, returns) if compiledKwargs["unit"] and kwargs["unit"] ~= extraKwargs and kwargs["unit"] ~= "player" then - t[#t+1] = [=[if UnitExists(]=] + t[#t+1] = [=[if ]=] + t[#t+1] = compiledKwargs["unit"][1] + t[#t+1] = [=[ and UnitExists(]=] t[#t+1] = compiledKwargs["unit"][1] t[#t+1] = [=[) then]=] t[#t+1] = "\n" diff --git a/test.lua b/test.lua index b0aa499..cd091b8 100644 --- a/test.lua +++ b/test.lua @@ -433,6 +433,7 @@ MyValue_data = "fakeunit" assert_equal(DogTag:Evaluate("[HP(MyValue)]", "Unit"), 'Bad unit: "fakeunit"') MyValue_data = 50 assert_equal(DogTag:Evaluate("[HP(MyValue)]", "Unit"), 'Bad unit: "50"') +assert_equal(DogTag:Evaluate("[HP(nil)]", "Unit"), nil) MyValue_data = nil assert_equal(DogTag:Evaluate("[HP(MyValue)]", "Unit"), nil)