mirror of
https://github.com/parnic/LibDogTag-Unit-3.0.git
synced 2025-06-16 21:41:53 -05:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
8d7646c83a | |||
4265d57599
|
|||
e970a958ac | |||
bde510f09c | |||
0c66028b9d | |||
7a2e432488 | |||
fc9ba7ac27 | |||
7cf02c9037 | |||
712fef34ae
|
|||
4c4262904d | |||
380bd0f06a
|
|||
e03b5c50cc | |||
aa2817b5db | |||
0217b0ba80 | |||
2641d29079 | |||
b2442ff568 | |||
1c161b436d | |||
9a939cca8b | |||
7f9d5db1e5 | |||
32583d92e0 | |||
05afef899d
|
|||
1ebf467ef4
|
|||
3576a67d39
|
|||
18a36c0cfc
|
|||
9e00585ce1
|
|||
dd28e38868
|
|||
5266af87c8
|
|||
122f129942
|
|||
79b632e7f4
|
|||
93696c41b6
|
|||
95ad2adeeb | |||
4f86740c25 | |||
c862c495f7
|
|||
0097e66d66
|
|||
e53fd70d70
|
|||
2f07b4d995
|
|||
07d6c46c18 | |||
39f70e711c
|
|||
4884525113
|
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@ -31,25 +31,31 @@ jobs:
|
||||
|
||||
# we first have to clone the AddOn project, this is a required step
|
||||
- name: Clone project
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# once cloned, we just run the GitHub Action for the packager project
|
||||
- name: Package and release
|
||||
uses: BigWigsMods/packager@master
|
||||
uses: BigWigsMods/packager@v2
|
||||
|
||||
# another example where we supply additional arguments, this example is specifically to release
|
||||
# for the Classic version of the game
|
||||
- name: Package and release for Classic
|
||||
uses: BigWigsMods/packager@master
|
||||
uses: BigWigsMods/packager@v2
|
||||
with:
|
||||
args: -g classic -w 0
|
||||
|
||||
- name: Package and release for TBC
|
||||
uses: BigWigsMods/packager@master
|
||||
uses: BigWigsMods/packager@v2
|
||||
with:
|
||||
args: -g bcc -w 0
|
||||
|
||||
- name: Package and release for TBC
|
||||
uses: BigWigsMods/packager@master
|
||||
- name: Package and release for Wrath
|
||||
uses: BigWigsMods/packager@v2
|
||||
with:
|
||||
args: -g wrath -w 0
|
||||
|
||||
- name: Package and release for Cataclysm
|
||||
uses: BigWigsMods/packager@v2
|
||||
with:
|
||||
args: -g cata -w 0
|
||||
|
@ -6,8 +6,22 @@ if MINOR_VERSION > _G.DogTag_Unit_MINOR_VERSION then
|
||||
end
|
||||
|
||||
local select, pairs, rawget, GetTime, setmetatable = select, pairs, rawget, GetTime, setmetatable
|
||||
local GetSpellInfo, UnitAura, UnitIsFriend, UnitClass, UnitPowerType =
|
||||
GetSpellInfo, UnitAura, UnitIsFriend, UnitClass, UnitPowerType
|
||||
local UnitAura, UnitIsFriend, UnitClass, UnitPowerType =
|
||||
UnitAura, UnitIsFriend, UnitClass, UnitPowerType
|
||||
|
||||
if not UnitAura and C_UnitAuras and C_UnitAuras.GetAuraDataByIndex then
|
||||
UnitAura = function(unitToken, index, filter)
|
||||
local auraData = C_UnitAuras.GetAuraDataByIndex(unitToken, index, filter)
|
||||
if not auraData then
|
||||
return nil
|
||||
end
|
||||
|
||||
return AuraUtil.UnpackAuraData(auraData)
|
||||
end
|
||||
end
|
||||
|
||||
-- GetSpellInfo removed in WoW 11.0
|
||||
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
|
||||
|
||||
DogTag_Unit_funcs[#DogTag_Unit_funcs+1] = function(DogTag_Unit, DogTag)
|
||||
|
||||
@ -300,12 +314,12 @@ DogTag:AddTag("Unit", "RaidStacks", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local MOONKIN_FORM = GetSpellInfo(24858)
|
||||
local AQUATIC_FORM = GetSpellInfo(1066)
|
||||
local FLIGHT_FORM = GetSpellInfo(33943)
|
||||
local SWIFT_FLIGHT_FORM = GetSpellInfo(40120)
|
||||
local TRAVEL_FORM = GetSpellInfo(783)
|
||||
local TREE_OF_LIFE = GetSpellInfo(33891)
|
||||
local MOONKIN_FORM = GetSpellName(24858)
|
||||
local AQUATIC_FORM = GetSpellName(1066)
|
||||
local FLIGHT_FORM = GetSpellName(33943)
|
||||
local SWIFT_FLIGHT_FORM = GetSpellName(40120)
|
||||
local TRAVEL_FORM = GetSpellName(783)
|
||||
local TREE_OF_LIFE = GetSpellName(33891)
|
||||
|
||||
local function DruidForm(unit)
|
||||
local _, c = UnitClass(unit)
|
||||
@ -403,7 +417,7 @@ DogTag:AddTag("Unit", "AuraDuration", {
|
||||
category = L["Auras"],
|
||||
})
|
||||
|
||||
local SHADOWFORM = GetSpellInfo(15473) or GetSpellInfo(232698)
|
||||
local SHADOWFORM = GetSpellName(15473) or GetSpellName(232698)
|
||||
if SHADOWFORM then
|
||||
DogTag:AddTag("Unit", "IsShadowform", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(SHADOWFORM),
|
||||
@ -416,13 +430,13 @@ DogTag:AddTag("Unit", "IsShadowform", {
|
||||
})
|
||||
end
|
||||
|
||||
local STEALTH = GetSpellInfo(1784)
|
||||
local STEALTH = GetSpellName(1784)
|
||||
local SHADOWMELD =
|
||||
GetSpellInfo(58984) -- BFA
|
||||
or GetSpellInfo(20580) -- Classic TBC
|
||||
or GetSpellInfo(743) -- Classic Vanilla
|
||||
GetSpellName(58984) -- BFA
|
||||
or GetSpellName(20580) -- Classic TBC
|
||||
or GetSpellName(743) -- Classic Vanilla
|
||||
|
||||
local PROWL = GetSpellInfo(5215)
|
||||
local PROWL = GetSpellName(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, SHADOWMELD, PROWL),
|
||||
arg = {
|
||||
@ -433,7 +447,7 @@ DogTag:AddTag("Unit", "IsStealthed", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local SHIELD_WALL = GetSpellInfo(871)
|
||||
local SHIELD_WALL = GetSpellName(871)
|
||||
DogTag:AddTag("Unit", "HasShieldWall", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(SHIELD_WALL),
|
||||
arg = {
|
||||
@ -444,7 +458,7 @@ DogTag:AddTag("Unit", "HasShieldWall", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local LAST_STAND = GetSpellInfo(12975)
|
||||
local LAST_STAND = GetSpellName(12975)
|
||||
DogTag:AddTag("Unit", "HasLastStand", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(LAST_STAND),
|
||||
arg = {
|
||||
@ -455,7 +469,7 @@ DogTag:AddTag("Unit", "HasLastStand", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local SOULSTONE_RESURRECTION = GetSpellInfo(20707)
|
||||
local SOULSTONE_RESURRECTION = GetSpellName(20707)
|
||||
DogTag:AddTag("Unit", "HasSoulstone", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(SOULSTONE_RESURRECTION),
|
||||
arg = {
|
||||
@ -466,7 +480,7 @@ DogTag:AddTag("Unit", "HasSoulstone", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local MISDIRECTION = GetSpellInfo(34477)
|
||||
local MISDIRECTION = GetSpellName(34477)
|
||||
if MISDIRECTION then -- WoW Classic compat
|
||||
DogTag:AddTag("Unit", "HasMisdirection", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(MISDIRECTION),
|
||||
@ -479,7 +493,7 @@ if MISDIRECTION then -- WoW Classic compat
|
||||
})
|
||||
end
|
||||
|
||||
local ICE_BLOCK = GetSpellInfo(27619)
|
||||
local ICE_BLOCK = GetSpellName(27619)
|
||||
DogTag:AddTag("Unit", "HasIceBlock", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(ICE_BLOCK),
|
||||
arg = {
|
||||
@ -490,7 +504,7 @@ DogTag:AddTag("Unit", "HasIceBlock", {
|
||||
category = L["Auras"]
|
||||
})
|
||||
|
||||
local INVISIBILITY = GetSpellInfo(66)
|
||||
local INVISIBILITY = GetSpellName(66)
|
||||
DogTag:AddTag("Unit", "HasInvisibility", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(INVISIBILITY),
|
||||
arg = {
|
||||
@ -502,7 +516,7 @@ DogTag:AddTag("Unit", "HasInvisibility", {
|
||||
})
|
||||
|
||||
-- Parnic: DI removed in Cataclysm
|
||||
local DIVINE_INTERVENTION = GetSpellInfo(19752)
|
||||
local DIVINE_INTERVENTION = GetSpellName(19752)
|
||||
if DIVINE_INTERVENTION then
|
||||
DogTag:AddTag("Unit", "HasDivineIntervention", {
|
||||
alias = ("HasAura(aura=%q, unit=unit)"):format(DIVINE_INTERVENTION),
|
||||
|
@ -103,7 +103,7 @@ DogTag:AddTag("Unit", "SimpleName", {
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
},
|
||||
ret = "string",
|
||||
ret = "string;nil",
|
||||
events = "UNIT_NAME_UPDATE#$unit",
|
||||
doc = L["Return the name of unit"],
|
||||
example = ('[SimpleName] => %q'):format(UnitName("player")),
|
||||
@ -167,13 +167,14 @@ DogTag:AddTag("Unit", "Level", {
|
||||
category = L["Characteristics"]
|
||||
})
|
||||
|
||||
local maxLevel = GetMaxPlayerLevel and GetMaxPlayerLevel() or _G.MAX_PLAYER_LEVEL
|
||||
DogTag:AddTag("Unit", "IsMaxLevel", {
|
||||
alias = ("Boolean(Level(unit=unit) >= %d)"):format(_G.MAX_PLAYER_LEVEL),
|
||||
alias = ("Boolean(Level(unit=unit) >= %d)"):format(maxLevel),
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
},
|
||||
doc = L["Return True if the level of unit is %d"]:format(_G.MAX_PLAYER_LEVEL),
|
||||
example = ('[IsMaxLevel] => %q'):format(UnitLevel("player") >= _G.MAX_PLAYER_LEVEL and L["True"] or ""),
|
||||
doc = L["Return True if the level of unit is %d"]:format(maxLevel),
|
||||
example = ('[IsMaxLevel] => %q'):format(UnitLevel("player") >= maxLevel and L["True"] or ""),
|
||||
category = L["Characteristics"],
|
||||
})
|
||||
|
||||
|
@ -69,7 +69,11 @@ end)
|
||||
|
||||
DogTag:AddTimerHandler("Unit", function(num, currentTime)
|
||||
if currentTime > nextGuildRosterUpdate then
|
||||
if IsInGuild() then
|
||||
if IsInGuild()
|
||||
-- CommunitiesFrame check workaround for
|
||||
-- https://github.com/parnic/LibDogTag-Unit-3.0/issues/12
|
||||
and (not CommunitiesFrame or not CommunitiesFrame:IsVisible())
|
||||
then
|
||||
GuildRoster()
|
||||
end
|
||||
nextGuildRosterUpdate = currentTime + 20
|
||||
|
@ -13,6 +13,10 @@ local SPELL_POWER_MANA, SPELL_POWER_RUNES, SPELL_POWER_CHI, SPELL_POWER_ECLIPSE,
|
||||
SPELL_POWER_MANA, SPELL_POWER_RUNES, SPELL_POWER_CHI, SPELL_POWER_ECLIPSE, SPELL_POWER_SOUL_SHARDS, SPELL_POWER_ARCANE_CHARGES
|
||||
local SPELL_POWER_BURNING_EMBERS, SPELL_POWER_HOLY_POWER, SPELL_POWER_LIGHT_FORCE, SPELL_POWER_SHADOW_ORBS =
|
||||
SPELL_POWER_BURNING_EMBERS, SPELL_POWER_HOLY_POWER, SPELL_POWER_LIGHT_FORCE, SPELL_POWER_SHADOW_ORBS
|
||||
local SPELL_POWER_RAGE, SPELL_POWER_FOCUS, SPELL_POWER_ENERGY, SPELL_POWER_COMBO_POINTS, SPELL_POWER_RUNIC_POWER, SPELL_POWER_LUNAR_POWER =
|
||||
SPELL_POWER_RAGE, SPELL_POWER_FOCUS, SPELL_POWER_ENERGY, SPELL_POWER_COMBO_POINTS, SPELL_POWER_RUNIC_POWER, SPELL_POWER_LUNAR_POWER
|
||||
local SPELL_POWER_MAELSTROM, SPELL_POWER_INSANITY, SPELL_POWER_FURY, SPELL_POWER_PAIN =
|
||||
SPELL_POWER_MAELSTROM, SPELL_POWER_INSANITY, SPELL_POWER_FURY, SPELL_POWER_PAIN
|
||||
|
||||
DogTag_Unit_funcs[#DogTag_Unit_funcs+1] = function(DogTag_Unit, DogTag)
|
||||
|
||||
@ -25,67 +29,130 @@ if Enum and Enum.PowerType then
|
||||
Enum.PowerType.Mana, Enum.PowerType.Runes, Enum.PowerType.Chi, Enum.PowerType.LunarPower, Enum.PowerType.SoulShards, Enum.PowerType.ArcaneCharges
|
||||
SPELL_POWER_BURNING_EMBERS, SPELL_POWER_HOLY_POWER, SPELL_POWER_LIGHT_FORCE, SPELL_POWER_SHADOW_ORBS =
|
||||
Enum.PowerType.Obsolete, Enum.PowerType.HolyPower, Enum.PowerType.Obsolete, Enum.PowerType.Obsolete
|
||||
SPELL_POWER_RAGE, SPELL_POWER_FOCUS, SPELL_POWER_ENERGY, SPELL_POWER_COMBO_POINTS, SPELL_POWER_RUNIC_POWER, SPELL_POWER_LUNAR_POWER =
|
||||
Enum.PowerType.Rage, Enum.PowerType.Focus, Enum.PowerType.Energy, Enum.PowerType.ComboPoints, Enum.PowerType.RunicPower, Enum.PowerType.LunarPower
|
||||
SPELL_POWER_MAELSTROM, SPELL_POWER_INSANITY, SPELL_POWER_FURY, SPELL_POWER_PAIN =
|
||||
Enum.PowerType.Maelstrom, Enum.PowerType.Insanity, Enum.PowerType.Fury, Enum.PowerType.Pain
|
||||
end
|
||||
|
||||
-- copied from Blizzard_CombatText, which isn't exposed anywhere else
|
||||
local powerEnumFromStringLookup =
|
||||
{
|
||||
[MANA:lower()] = SPELL_POWER_MANA,
|
||||
[RAGE:lower()] = SPELL_POWER_RAGE,
|
||||
[FOCUS:lower()] = SPELL_POWER_FOCUS,
|
||||
[ENERGY:lower()] = SPELL_POWER_ENERGY,
|
||||
[COMBO_POINTS:lower()] = SPELL_POWER_COMBO_POINTS,
|
||||
}
|
||||
|
||||
if RUNES then
|
||||
powerEnumFromStringLookup[RUNES:lower()] = SPELL_POWER_RUNES
|
||||
end
|
||||
if RUNIC_POWER then
|
||||
powerEnumFromStringLookup[RUNIC_POWER:lower()] = SPELL_POWER_RUNIC_POWER
|
||||
end
|
||||
if SOUL_SHARDS then
|
||||
powerEnumFromStringLookup[SOUL_SHARDS:lower()] = SPELL_POWER_SOUL_SHARDS
|
||||
end
|
||||
if LUNAR_POWER then
|
||||
powerEnumFromStringLookup[LUNAR_POWER:lower()] = SPELL_POWER_LUNAR_POWER
|
||||
end
|
||||
if HOLY_POWER then
|
||||
powerEnumFromStringLookup[HOLY_POWER:lower()] = SPELL_POWER_HOLY_POWER
|
||||
end
|
||||
if MAELSTROM then
|
||||
powerEnumFromStringLookup[MAELSTROM:lower()] = SPELL_POWER_MAELSTROM
|
||||
end
|
||||
if CHI then
|
||||
powerEnumFromStringLookup[CHI:lower()] = SPELL_POWER_CHI
|
||||
end
|
||||
if INSANITY then
|
||||
powerEnumFromStringLookup[INSANITY:lower()] = SPELL_POWER_INSANITY
|
||||
end
|
||||
if ARCANE_CHARGES then
|
||||
powerEnumFromStringLookup[ARCANE_CHARGES:lower()] = SPELL_POWER_ARCANE_CHARGES
|
||||
end
|
||||
if FURY then
|
||||
powerEnumFromStringLookup[FURY:lower()] = SPELL_POWER_FURY
|
||||
end
|
||||
if PAIN then
|
||||
powerEnumFromStringLookup[PAIN:lower()] = SPELL_POWER_PAIN
|
||||
end
|
||||
|
||||
DogTag:AddTag("Unit", "MP", {
|
||||
code = UnitPower,
|
||||
code = function(unit, type)
|
||||
local enum
|
||||
if type then
|
||||
enum = powerEnumFromStringLookup[type:lower()]
|
||||
end
|
||||
return UnitPower(unit, enum)
|
||||
end,
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
ret = "number",
|
||||
events = "UNIT_POWER_FREQUENT#$unit;UNIT_DISPLAYPOWER#$unit",
|
||||
doc = L["Return the current mana/rage/energy of unit"],
|
||||
example = ('[MP] => "%d"'):format(UnitPowerMax("player")*.632),
|
||||
example = ('[MP] => "%d"; [MP("player", "Energy")] => "65"'):format(UnitPowerMax("player")*.632),
|
||||
category = L["Power"]
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "MaxMP", {
|
||||
code = UnitPowerMax,
|
||||
code = function(unit, type)
|
||||
local enum
|
||||
if type then
|
||||
enum = powerEnumFromStringLookup[type:lower()]
|
||||
end
|
||||
return UnitPowerMax(unit, enum)
|
||||
end,
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
ret = "number",
|
||||
events = "UNIT_MAXPOWER#$unit",
|
||||
doc = L["Return the maximum mana/rage/energy of unit"],
|
||||
example = ('[MaxMP] => "%d"'):format(UnitPowerMax("player")),
|
||||
example = ('[MaxMP] => "%d"; [MaxMP("player", "Energy")] => "100"'):format(UnitPowerMax("player")),
|
||||
category = L["Power"]
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "PercentMP", {
|
||||
alias = "[MP(unit=unit) / MaxMP(unit=unit) * 100]:Round(1)",
|
||||
alias = "[MP(unit=unit, type=type) / MaxMP(unit=unit, type=type) * 100]:Round(1)",
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
doc = L["Return the percentage mana/rage/energy of unit"],
|
||||
example = '[PercentMP] => "63.2"; [PercentMP:Percent] => "63.2%"',
|
||||
example = '[PercentMP] => "63.2"; [PercentMP:Percent] => "63.2%"; [PercentMP("player", "Energy")] => "65"',
|
||||
category = L["Power"]
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "MissingMP", {
|
||||
alias = "MaxMP(unit=unit) - MP(unit=unit)",
|
||||
alias = "MaxMP(unit=unit, type=type) - MP(unit=unit, type=type)",
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
doc = L["Return the missing mana/rage/energy of unit"],
|
||||
example = ('[MissingMP] => "%d"'):format(UnitPowerMax("player")*.368),
|
||||
example = ('[MissingMP] => "%d"; [MissingMP("player", "Energy")] => "35"'):format(UnitPowerMax("player")*.368),
|
||||
category = L["Power"]
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "FractionalMP", {
|
||||
alias = "Concatenate(MP(unit=unit), '/', MaxMP(unit=unit))",
|
||||
alias = "Concatenate(MP(unit=unit, type=type), '/', MaxMP(unit=unit, type=type))",
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
doc = L["Return the current and maximum mana/rage/energy of unit"],
|
||||
example = ('[FractionalMP] => "%d/%d"'):format(UnitPowerMax("player")*.632, UnitPowerMax("player")),
|
||||
example = ('[FractionalMP] => "%d/%d"; [FractionalMP("player", "Energy")] => "65/100"'):format(UnitPowerMax("player")*.632, UnitPowerMax("player")),
|
||||
category = L["Power"]
|
||||
})
|
||||
|
||||
|
||||
DogTag:AddTag("Unit", "Mana", {
|
||||
code = function(unit)
|
||||
return UnitPower(unit, SPELL_POWER_MANA)
|
||||
end,
|
||||
alias = ("MP(unit=unit, type=%q)"):format(MANA:lower()),
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
},
|
||||
@ -97,9 +164,7 @@ DogTag:AddTag("Unit", "Mana", {
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "MaxMana", {
|
||||
code = function(unit)
|
||||
return UnitPowerMax(unit, SPELL_POWER_MANA)
|
||||
end,
|
||||
alias = ("MaxMP(unit=unit, type=%q)"):format(MANA:lower()),
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
},
|
||||
@ -348,9 +413,10 @@ if GetRuneCooldown then
|
||||
end
|
||||
|
||||
DogTag:AddTag("Unit", "IsMaxMP", {
|
||||
alias = "Boolean(MP(unit=unit) = MaxMP(unit=unit))",
|
||||
alias = "Boolean(MP(unit=unit, type=type) = MaxMP(unit=unit, type=type))",
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
doc = L["Return True if unit is at full rage/mana/energy"],
|
||||
example = ('[IsMaxMP] => %q; [IsMaxMP] => ""'):format(L["True"]),
|
||||
@ -358,9 +424,10 @@ DogTag:AddTag("Unit", "IsMaxMP", {
|
||||
})
|
||||
|
||||
DogTag:AddTag("Unit", "HasMP", {
|
||||
alias = "Boolean(MaxMP(unit=unit) > 0)",
|
||||
alias = "Boolean(MaxMP(unit=unit, type=type) > 0)",
|
||||
arg = {
|
||||
'unit', 'string;undef', 'player'
|
||||
'unit', 'string;undef', 'player',
|
||||
'type', 'string;undef', '@undef',
|
||||
},
|
||||
doc = L["Return True if unit has any power type at all"],
|
||||
example = ('[HasMP] => %q; [HasMP] => ""'):format(L["True"]),
|
||||
|
@ -25,7 +25,7 @@ local function formatMinMax(min, max)
|
||||
end
|
||||
|
||||
local found = false
|
||||
DogTag:AddAddonFinder("Unit", "LibStub", "LibRangeCheck-2.0", function(RangeCheckLib)
|
||||
DogTag:AddAddonFinder("Unit", "LibStub", "LibRangeCheck-3.0", function(RangeCheckLib)
|
||||
found = true
|
||||
function MinRange_func(unit)
|
||||
return (RangeCheckLib:getRange(unit))
|
||||
|
@ -7,15 +7,61 @@ end
|
||||
|
||||
local _G, coroutine = _G, coroutine
|
||||
local wrap, yield = coroutine.wrap, coroutine.yield
|
||||
local GetWatchedFactionInfo, GetNumFactions, GetFactionInfo, ExpandFactionHeader, CollapseFactionHeader =
|
||||
GetWatchedFactionInfo, GetNumFactions, GetFactionInfo, ExpandFactionHeader, CollapseFactionHeader
|
||||
|
||||
local GetWatchedFactionInfo = C_Reputation and C_Reputation.GetWatchedFactionData and function()
|
||||
local data = C_Reputation.GetWatchedFactionData()
|
||||
return data.name, data.reaction, data.currentReactionThreshold, data.nextReactionThreshold, data.currentStanding
|
||||
end or _G.GetWatchedFactionInfo
|
||||
|
||||
DogTag_Unit_funcs[#DogTag_Unit_funcs+1] = function(DogTag_Unit, DogTag)
|
||||
|
||||
local L = DogTag_Unit.L
|
||||
|
||||
local IterateFactions, TerminateIterateFactions
|
||||
do
|
||||
if C_Reputation and C_Reputation.GetNumFactions then
|
||||
local GetNumFactions = C_Reputation.GetNumFactions
|
||||
local GetFactionDataByIndex = C_Reputation.GetFactionDataByIndex
|
||||
local ExpandFactionHeader = C_Reputation.ExpandFactionHeader
|
||||
local CollapseFactionHeader = C_Reputation.CollapseFactionHeader
|
||||
|
||||
local currentOpenHeader
|
||||
local function iter()
|
||||
for i = 1, GetNumFactions() do
|
||||
local data = GetFactionDataByIndex(i)
|
||||
if data then
|
||||
if data.isHeader == 1 then
|
||||
if data.isCollapsed == 1 then
|
||||
local NumFactions = GetNumFactions()
|
||||
ExpandFactionHeader(i)
|
||||
currentOpenHeader = i
|
||||
NumFactions = GetNumFactions() - NumFactions
|
||||
for j = i+1, i+NumFactions do
|
||||
yield(GetFactionInfo(j))
|
||||
end
|
||||
CollapseFactionHeader(i)
|
||||
currentOpenHeader = nil
|
||||
end
|
||||
else
|
||||
yield(data.name, data.description, data.reaction, data.currentReactionThreshold, data.nextReactionThreshold, data.currentStanding)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function TerminateIterateFactions()
|
||||
if currentOpenHeader then
|
||||
CollapseFactionHeader(currentOpenHeader)
|
||||
currentOpenHeader = nil
|
||||
end
|
||||
end
|
||||
|
||||
function IterateFactions()
|
||||
currentOpenHeader = nil
|
||||
return wrap(iter)
|
||||
end
|
||||
else
|
||||
local GetNumFactions, GetFactionInfo, ExpandFactionHeader, CollapseFactionHeader =
|
||||
GetNumFactions, GetFactionInfo, ExpandFactionHeader, CollapseFactionHeader
|
||||
|
||||
local currentOpenHeader
|
||||
local function iter()
|
||||
for i = 1, GetNumFactions() do
|
||||
|
@ -968,7 +968,7 @@ DogTag:AddTag("Unit", "HappyColor", {
|
||||
end
|
||||
|
||||
-- Parnic: DI removed in Cataclysm
|
||||
local DIVINE_INTERVENTION = GetSpellInfo(19752)
|
||||
local DIVINE_INTERVENTION = (GetSpellInfo or C_Spell.GetSpellName)(19752)
|
||||
if DIVINE_INTERVENTION then
|
||||
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"]),
|
||||
|
@ -17,21 +17,36 @@ DogTag_Unit_funcs[#DogTag_Unit_funcs+1] = function(DogTag_Unit, DogTag)
|
||||
|
||||
local L = DogTag_Unit.L
|
||||
|
||||
local tt = CreateFrame("GameTooltip")
|
||||
tt:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
tt.left = {}
|
||||
tt.right = {}
|
||||
for i = 1, 30 do
|
||||
tt.left[i] = tt:CreateFontString()
|
||||
tt.left[i]:SetFontObject(GameFontNormal)
|
||||
tt.right[i] = tt:CreateFontString()
|
||||
tt.right[i]:SetFontObject(GameFontNormal)
|
||||
tt:AddFontStrings(tt.left[i], tt.right[i])
|
||||
local tt
|
||||
if not C_TooltipInfo then
|
||||
tt = CreateFrame("GameTooltip", "LibDogTag-Unit-3.0-"..MAJOR_VERSION.."."..MINOR_VERSION)
|
||||
tt:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
tt.left = {}
|
||||
tt.right = {}
|
||||
for i = 1, 30 do
|
||||
tt.left[i] = tt:CreateFontString()
|
||||
tt.left[i]:SetFontObject(GameFontNormal)
|
||||
tt.right[i] = tt:CreateFontString()
|
||||
tt.right[i]:SetFontObject(GameFontNormal)
|
||||
tt:AddFontStrings(tt.left[i], tt.right[i])
|
||||
end
|
||||
end
|
||||
local nextTime = 0
|
||||
local lastName
|
||||
local lastUnit
|
||||
local function updateTT(unit)
|
||||
if C_TooltipInfo then
|
||||
local tooltipData = C_TooltipInfo.GetUnit(unit)
|
||||
if TooltipUtil.SurfaceArgs then
|
||||
TooltipUtil.SurfaceArgs(tooltipData)
|
||||
for _, line in ipairs(tooltipData.lines) do
|
||||
TooltipUtil.SurfaceArgs(line)
|
||||
end
|
||||
end
|
||||
|
||||
return tooltipData
|
||||
end
|
||||
|
||||
local name = UnitName(unit)
|
||||
local time = GetTime()
|
||||
if lastUnit == unit and lastName == name and nextTime < time then
|
||||
@ -52,13 +67,38 @@ local function updateTT(unit)
|
||||
end
|
||||
end
|
||||
|
||||
-- tooltips can contain any data, including quest info, so check for the type of the line before using it, if present
|
||||
local function TooltipLineCouldBeGuild(line)
|
||||
if not line then
|
||||
return false
|
||||
end
|
||||
if not Enum or not Enum.TooltipDataLineType then
|
||||
return false
|
||||
end
|
||||
|
||||
return line.type == Enum.TooltipDataLineType.None
|
||||
end
|
||||
|
||||
-- there's no special flag for factions vs guilds as of this writing, but if that gets added, this will make things easier
|
||||
local function TooltipLineCouldBeFaction(line)
|
||||
return TooltipLineCouldBeGuild(line)
|
||||
end
|
||||
|
||||
local LEVEL_start = "^" .. (type(LEVEL) == "string" and LEVEL or "Level")
|
||||
local function FigureNPCGuild(unit)
|
||||
updateTT(unit)
|
||||
local left_2 = tt.left[2]:GetText()
|
||||
local info = updateTT(unit)
|
||||
local left_2
|
||||
if info then
|
||||
left_2 = info.lines[2] and info.lines[2].leftText or nil
|
||||
elseif tt then
|
||||
left_2 = tt.left[2] and tt.left[2]:GetText() or nil
|
||||
end
|
||||
if not left_2 or left_2:find(LEVEL_start) then
|
||||
return nil
|
||||
end
|
||||
if info and not TooltipLineCouldBeGuild(info.lines[2]) then
|
||||
return nil
|
||||
end
|
||||
return left_2
|
||||
end
|
||||
|
||||
@ -71,14 +111,27 @@ local function FigureFaction(unit)
|
||||
return faction
|
||||
end
|
||||
|
||||
updateTT(unit)
|
||||
local left_2 = tt.left[2]:GetText()
|
||||
local left_3 = tt.left[3]:GetText()
|
||||
local info = updateTT(unit)
|
||||
local left_2
|
||||
local left_3
|
||||
if info then
|
||||
left_2 = info.lines[2] and info.lines[2].leftText or nil
|
||||
left_3 = info.lines[3] and info.lines[3].leftText or nil
|
||||
elseif tt then
|
||||
left_2 = tt.left[2] and tt.left[2]:GetText() or nil
|
||||
left_3 = tt.left[3] and tt.left[3]:GetText() or nil
|
||||
end
|
||||
if not left_2 or not left_3 then
|
||||
return faction
|
||||
end
|
||||
local hasGuild = not left_2:find(LEVEL_start)
|
||||
local factionText = not hasGuild and left_3 or tt.left[4]:GetText()
|
||||
local left_4
|
||||
if info and info.lines[4] then
|
||||
left_4 = info.lines[4].leftText
|
||||
elseif tt and tt.left[4] then
|
||||
left_4 = tt.left[4]:GetText()
|
||||
end
|
||||
local factionText = not hasGuild and left_3 or left_4
|
||||
if factionText == PVP then
|
||||
return faction
|
||||
end
|
||||
@ -94,22 +147,45 @@ local function FigureZone(unit)
|
||||
if not UnitIsConnected(unit) then
|
||||
return nil
|
||||
end
|
||||
updateTT(unit)
|
||||
local left_2 = tt.left[2]:GetText()
|
||||
local left_3 = tt.left[3]:GetText()
|
||||
local info = updateTT(unit)
|
||||
local left_2
|
||||
local left_3
|
||||
local left_4
|
||||
local left_5
|
||||
if info then
|
||||
left_2 = info.lines[2] and info.lines[2].leftText or nil
|
||||
left_3 = info.lines[3] and info.lines[3].leftText or nil
|
||||
left_4 = info.lines[4] and info.lines[4].leftText or nil
|
||||
left_5 = info.lines[5] and info.lines[5].leftText or nil
|
||||
elseif tt then
|
||||
left_2 = tt.left[2] and tt.left[2]:GetText() or nil
|
||||
left_3 = tt.left[3] and tt.left[3]:GetText() or nil
|
||||
left_4 = tt.left[4] and tt.left[4]:GetText() or nil
|
||||
left_5 = tt.left[5] and tt.left[5]:GetText() or nil
|
||||
end
|
||||
if not left_2 or not left_3 then
|
||||
return nil
|
||||
end
|
||||
local hasGuild = not left_2:find(LEVEL_start)
|
||||
local factionText = not hasGuild and left_3 or tt.left[4]:GetText()
|
||||
if info and not TooltipLineCouldBeGuild(info.lines[2]) then
|
||||
hasGuild = false
|
||||
end
|
||||
local factionText = not hasGuild and left_3 or left_4
|
||||
if info then
|
||||
if not hasGuild then
|
||||
factionText = TooltipLineCouldBeFaction(info.lines[3]) and left_3 or nil
|
||||
else
|
||||
factionText = TooltipLineCouldBeFaction(info.lines[4]) and left_4 or nil
|
||||
end
|
||||
end
|
||||
if factionText == PVP then
|
||||
factionText = nil
|
||||
end
|
||||
local hasFaction = factionText and not UnitPlayerControlled(unit) and not UnitIsPlayer(unit) and (UnitFactionGroup(unit) or factionList[factionText])
|
||||
if hasGuild and hasFaction then
|
||||
return tt.left[5]:GetText()
|
||||
return left_5
|
||||
elseif hasGuild or hasFaction then
|
||||
return tt.left[4]:GetText()
|
||||
return left_4
|
||||
else
|
||||
return left_3
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
## Interface: 100000
|
||||
## Interface-Retail: 100000
|
||||
## Interface-Classic: 11403
|
||||
## Interface: 110105
|
||||
## Interface-Retail: 110105
|
||||
## Interface-Classic: 11507
|
||||
## Interface-BCC: 20504
|
||||
## Interface-Wrath: 30400
|
||||
## Interface-Wrath: 30403
|
||||
## Interface-Cata: 40402
|
||||
## LoadOnDemand: 1
|
||||
## Title: Lib: DogTag-Unit-3.0
|
||||
## Notes: A library to provide unit-oriented tags to LibDogTag-3.0
|
||||
@ -14,5 +15,17 @@
|
||||
## X-Curse-Project-ID: 14282
|
||||
## Dependencies: LibDogTag-3.0
|
||||
## OptionalDeps: LibDruidMana-1.0, RangeCheck-1.0, LibTalentQuery-1.0
|
||||
## Category-enUS: Libraries
|
||||
## Category-deDE: Bibliotheken
|
||||
## Category-esES: Bibliotecas
|
||||
## Category-esMX: Bibliotecas
|
||||
## Category-frFR: Bibliothèques
|
||||
## Category-itIT:
|
||||
## Category-koKR:
|
||||
## Category-ptBR: Bibliotecas
|
||||
## Category-ruRU: Библиотеки
|
||||
## Category-zhCN: 函数库
|
||||
## Category-zhTW: 函式庫
|
||||
## Group: LibDogTag
|
||||
|
||||
lib.xml
|
||||
|
Reference in New Issue
Block a user