- updated SunderCount/LacerateCount modules to use the new UnitDebuff return values in wotlk properly/register the changed wotlk events

- updated SliceAndDice module to be more efficient outside of combat (avoids unnecessary OnUpdate stuff)
- updated SliceAndDice module to use the new UnitBuff return values in wotlk properly/register the changed wotlk events/new combo point parameters
- updated DruidMana module to update every frame in wotlk since the other mana frames need to...this still needs dogtag to be updated to work fully in wotlk
- updated ComboPoints module to use the new combo point functionality and events in wotlk
This commit is contained in:
Parnic
2008-08-24 03:20:43 +00:00
parent 4cc00dde52
commit 5474530f8f
5 changed files with 105 additions and 21 deletions

View File

@ -126,7 +126,11 @@ function ComboPoints.prototype:Enable(core)
ComboPoints.super.prototype.Enable(self, core) ComboPoints.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints")
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints") if IceHUD.WowVer >= 30000 then
self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateComboPoints")
else
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints")
end
end end
@ -204,7 +208,12 @@ end
function ComboPoints.prototype:UpdateComboPoints() function ComboPoints.prototype:UpdateComboPoints()
local points = GetComboPoints("target") local points
if IceHUD.WowVer >= 30000 then
points = GetComboPoints("player", "target")
else
points = GetComboPoints("target")
end
if (points == 0) then if (points == 0) then
points = nil points = nil

View File

@ -44,8 +44,17 @@ function DruidMana.prototype:Enable(core)
if LibDruidMana then if LibDruidMana then
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "Update") self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "Update")
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXMANA", "Update") self:RegisterEvent("UNIT_MAXMANA", "Update")
if IceHUD.WowVer >= 30000 then
if GetCVarBool("predictedPower") and self.frame then
self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end)
else
self:RegisterEvent("UNIT_MANA", "Update")
end
else
self:RegisterEvent("UNIT_MANA", "Update")
end
end end
end end

View File

@ -205,7 +205,12 @@ end
function LacerateCount.prototype:GetDebuffCount(unit, ability, onlyMine) function LacerateCount.prototype:GetDebuffCount(unit, ability, onlyMine)
for i = 1, MAX_DEBUFF_COUNT do for i = 1, MAX_DEBUFF_COUNT do
local name, _, texture, applications, _, duration = UnitDebuff(unit, i) local name, texture, applications, duration
if IceHUD.WowVer >= 30000 then
name, _, texture, applications, _, _, duration = UnitDebuff(unit, i)
else
name, _, texture, applications, _, duration = UnitDebuff(unit, i)
end
if not texture then if not texture then
break break

View File

@ -13,6 +13,8 @@ local impSndTalentPage = 2
local impSndTalentIdx = 4 local impSndTalentIdx = 4
local impSndBonusPerRank = 0.15 local impSndBonusPerRank = 0.15
local maxComboPoints = 5 local maxComboPoints = 5
local sndEndTime = 0
local sndDuration = 0
local CurrMaxSnDDuration = 0 local CurrMaxSnDDuration = 0
local PotentialSnDDuration = 0 local PotentialSnDDuration = 0
@ -35,11 +37,14 @@ end
function SliceAndDice.prototype:Enable(core) function SliceAndDice.prototype:Enable(core)
SliceAndDice.super.prototype.Enable(self, core) SliceAndDice.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_AURAS_CHANGED", "UpdateSliceAndDice")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateDurationBar") self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateDurationBar")
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateDurationBar") if IceHUD.WowVer >= 30000 then
self:RegisterEvent("UNIT_AURA", "UpdateSliceAndDice")
self:ScheduleRepeatingEvent(self.elementName, self.UpdateSliceAndDice, 0.1, self) self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateDurationBar")
else
self:RegisterEvent("PLAYER_AURAS_CHANGED", "UpdateSliceAndDice")
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateDurationBar")
end
self:Show(false) self:Show(false)
@ -159,47 +164,94 @@ end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
function _GetBuffDuration(unitName, buffName) function SliceAndDice.prototype:GetBuffDuration(unitName, buffName)
local i = 1 local i = 1
local buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i) local buff, rank, texture, count, type, duration, endTime, remaining
if IceHUD.WowVer >= 30000 then
buff, rank, texture, count, type, duration, endTime = UnitBuff(unitName, i)
else
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
end
while buff do while buff do
if (texture and string.match(texture, buffName)) then if (texture and string.match(texture, buffName)) then
if endTime and not remaining then
remaining = endTime - GetTime()
end
return duration, remaining return duration, remaining
end end
i = i + 1; i = i + 1;
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i) if IceHUD.WowVer >= 30000 then
buff, rank, texture, count, type, duration, endTime = UnitBuff(unitName, i)
else
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
end
end end
return nil, nil return nil, nil
end end
function SliceAndDice.prototype:UpdateSliceAndDice() function SliceAndDice.prototype:UpdateSliceAndDice(unit, fromUpdate)
local duration, remaining = _GetBuffDuration("player", "Ability_Rogue_SliceDice") if unit and unit ~= self.unit then
return
end
local now = GetTime()
local remaining = nil
if not fromUpdate or IceHUD.WowVer < 30000 then
sndDuration, remaining = self:GetBuffDuration(self.unit, "Ability_Rogue_SliceDice")
if not remaining then
sndEndTime = 0
else
sndEndTime = remaining + now
end
end
if sndEndTime and sndEndTime >= now then
if not fromUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateSliceAndDice(self.unit, true) end)
end
if duration ~= nil and remaining ~= nil then
self:Show(true) self:Show(true)
self:UpdateBar(remaining / (self.moduleSettings.showAsPercentOfMax and CurrMaxSnDDuration or duration), "SliceAndDice") if not remaining then
remaining = sndEndTime - now
end
self:UpdateBar(remaining / (self.moduleSettings.showAsPercentOfMax and CurrMaxSnDDuration or sndDuration), "SliceAndDice")
formatString = self.moduleSettings.upperText or '' formatString = self.moduleSettings.upperText or ''
else else
self:UpdateBar(0, "SliceAndDice") self:UpdateBar(0, "SliceAndDice")
if GetComboPoints("target") == 0 or not UnitExists("target") then if ((IceHUD.WowVer >= 30000 and GetComboPoints(self.unit, "target") == 0) or (IceHUD.WowVer < 30000 and GetComboPoints("target") == 0)) or not UnitExists("target") then
self:Show(false) if self.bIsVisible then
self.frame:SetScript("OnUpdate", nil)
end
self:Show(false)
end end
end end
-- somewhat redundant, but we also need to check potential remaining time -- somewhat redundant, but we also need to check potential remaining time
if (duration ~= nil and remaining ~= nil) or PotentialSnDDuration > 0 then if (remaining ~= nil) or PotentialSnDDuration > 0 then
self:SetBottomText1(self.moduleSettings.upperText .. tostring(floor(remaining or 0)) .. " (" .. PotentialSnDDuration .. ")") self:SetBottomText1(self.moduleSettings.upperText .. tostring(floor(remaining or 0)) .. " (" .. PotentialSnDDuration .. ")")
end end
end end
function SliceAndDice.prototype:UpdateDurationBar() function SliceAndDice.prototype:UpdateDurationBar(unit)
local points = GetComboPoints("target") if unit and unit ~= self.unit then
return
end
local points
if IceHUD.WowVer >= 30000 then
points = GetComboPoints(self.unit, "target")
else
points = GetComboPoints("target")
end
local scale local scale
-- first, set the cached upper limit of SnD duration -- first, set the cached upper limit of SnD duration
@ -226,6 +278,10 @@ function SliceAndDice.prototype:UpdateDurationBar()
else else
self.durationFrame.bar:SetTexCoord(0, 1, 1-scale, 1) self.durationFrame.bar:SetTexCoord(0, 1, 1-scale, 1)
end end
if sndEndTime < GetTime() then
self:SetBottomText1(self.moduleSettings.upperText .. "0 (" .. PotentialSnDDuration .. ")")
end
end end
function SliceAndDice.prototype:GetMaxBuffTime(numComboPoints) function SliceAndDice.prototype:GetMaxBuffTime(numComboPoints)

View File

@ -205,7 +205,12 @@ end
function SunderCount.prototype:GetDebuffCount(unit, ability, onlyMine) function SunderCount.prototype:GetDebuffCount(unit, ability, onlyMine)
for i = 1, MAX_DEBUFF_COUNT do for i = 1, MAX_DEBUFF_COUNT do
local name, _, texture, applications, _, duration = UnitDebuff(unit, i) local name, texture, applications, duration
if IceHUD.WowVer >= 30000 then
name, _, texture, applications, _, _, duration = UnitDebuff(unit, i)
else
name, _, texture, applications, _, duration = UnitDebuff(unit, i)
end
if not texture then if not texture then
break break