mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
Fix the Vengeance module
One of the return values of UnitAura is the Vengeance amount and the GameTooltip scanning thing is no longer working.
This commit is contained in:
16
IceHUD.lua
16
IceHUD.lua
@ -486,7 +486,7 @@ end
|
|||||||
|
|
||||||
function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
||||||
if not unit or not ability then
|
if not unit or not ability then
|
||||||
return 0
|
return 0, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if unit == "main hand weapon" or unit == "off hand weapon" then
|
if unit == "main hand weapon" or unit == "off hand weapon" then
|
||||||
@ -494,21 +494,21 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
|||||||
= GetWeaponEnchantInfo()
|
= GetWeaponEnchantInfo()
|
||||||
|
|
||||||
if unit == "main hand weapon" and hasMainHandEnchant then
|
if unit == "main hand weapon" and hasMainHandEnchant then
|
||||||
return mainHandCharges
|
return mainHandCharges, nil
|
||||||
elseif unit == "off hand weapon" and hasOffHandEnchant then
|
elseif unit == "off hand weapon" and hasOffHandEnchant then
|
||||||
return offHandCharges
|
return offHandCharges, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return 0
|
return 0, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Support for Spell IDs
|
-- Support for Spell IDs
|
||||||
if (IceHUD.GetPlayerAuraBySpellID and tonumber(ability) ~= nil) then
|
if (IceHUD.GetPlayerAuraBySpellID and tonumber(ability) ~= nil) then
|
||||||
local aura = C_UnitAuras.GetPlayerAuraBySpellID(ability)
|
local aura = C_UnitAuras.GetPlayerAuraBySpellID(ability)
|
||||||
if aura ~= nil then
|
if aura ~= nil then
|
||||||
return aura.applications
|
return aura.applications, nil
|
||||||
else
|
else
|
||||||
return 0
|
return 0, nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -522,7 +522,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
|||||||
while name do
|
while name do
|
||||||
if (not matchByName and string.match(texture:upper(), ability:upper()))
|
if (not matchByName and string.match(texture:upper(), ability:upper()))
|
||||||
or (matchByName and string.match(name:upper(), ability:upper())) then
|
or (matchByName and string.match(name:upper(), ability:upper())) then
|
||||||
return applications
|
return applications, i
|
||||||
end
|
end
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -533,7 +533,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return 0
|
return 0, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
v1.14.42:
|
||||||
|
|
||||||
|
- Fix Vengeance module in Cataclysm Classic
|
||||||
|
|
||||||
v1.14.41:
|
v1.14.41:
|
||||||
|
|
||||||
- Fix swapped DK runes in Cataclysm Classic
|
- Fix swapped DK runes in Cataclysm Classic
|
||||||
|
@ -50,41 +50,16 @@ end
|
|||||||
-- scan the tooltip and extract the vengeance value
|
-- scan the tooltip and extract the vengeance value
|
||||||
do
|
do
|
||||||
-- making these local as they're not used anywhere else
|
-- making these local as they're not used anywhere else
|
||||||
local regions = {}
|
|
||||||
local spellName = GetSpellInfo(VENGEANCE_SPELL_ID)
|
local spellName = GetSpellInfo(VENGEANCE_SPELL_ID)
|
||||||
local tooltipBuffer = CreateFrame("GameTooltip","tooltipBuffer",nil,"GameTooltipTemplate")
|
|
||||||
tooltipBuffer:SetOwner(WorldFrame, "ANCHOR_NONE")
|
|
||||||
|
|
||||||
-- suggested by Antiarc as a way to repopulate the same table instead of repeatedly creating a new one
|
|
||||||
local function makeTable(t, ...)
|
|
||||||
wipe(t)
|
|
||||||
for i = 1, select("#", ...) do
|
|
||||||
t[i] = select(i, ...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Vengeance.prototype:UpdateCurrent(event, unit)
|
function Vengeance.prototype:UpdateCurrent(event, unit)
|
||||||
if (unit and (unit ~= self.unit)) then
|
if (unit and (unit ~= self.unit)) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = UnitAura(self.unit, spellName)
|
local _, idx = IceHUD:GetBuffCount(self.unit, spellName, true, true)
|
||||||
if name then
|
if idx then
|
||||||
-- Buff found, copy it into the buffer for scanning
|
self.current = select(17, UnitAura(self.unit, idx))
|
||||||
tooltipBuffer:ClearLines()
|
|
||||||
tooltipBuffer:SetUnitBuff(self.unit, name)
|
|
||||||
|
|
||||||
-- Grab all regions, stuff em into our table
|
|
||||||
makeTable(regions, tooltipBuffer:GetRegions())
|
|
||||||
|
|
||||||
-- Convert FontStrings to strings, replace anything else with ""
|
|
||||||
for i=1, #regions do
|
|
||||||
local region = regions[i]
|
|
||||||
regions[i] = region:GetObjectType() == "FontString" and region:GetText() or ""
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Find the number, save it
|
|
||||||
self.current = tonumber(string.match(table.concat(regions),"%d+")) or 0
|
|
||||||
else
|
else
|
||||||
self.current = 0
|
self.current = 0
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
v1.14.42:
|
||||||
|
|
||||||
|
- Fix Vengeance module in Cataclysm Classic
|
||||||
|
|
||||||
v1.14.41:
|
v1.14.41:
|
||||||
|
|
||||||
- Fix swapped DK runes in Cataclysm Classic
|
- Fix swapped DK runes in Cataclysm Classic
|
||||||
|
Reference in New Issue
Block a user