Index: SpellWatch.lua =================================================================== --- SpellWatch.lua (revision 31748) +++ SpellWatch.lua (working copy) @@ -36,6 +36,26 @@ get = function () return SpellWatch.db.profile.anchor1.scale; end, set = function (value) SpellWatch.db.profile.anchor1.scale = value; end, }, + width = { + name = "width", + type = 'range', + desc = "Timer bar width", + min = 50, + max = 400, + step = 1, + get = function () return SpellWatch.db.profile.anchor1.width; end, + set = function (text) SpellWatch.db.profile.anchor1.width = text; end, + }, + height = { + name = "height", + type = 'range', + desc = "Timer bar height", + min = 8, + max = 30, + step = 1, + get = function () return SpellWatch.db.profile.anchor1.height; end, + set = function (text) SpellWatch.db.profile.anchor1.height = text; end, + }, font = { name = "font", type = 'range', @@ -86,6 +106,26 @@ get = function () return SpellWatch.db.profile.anchor2.scale; end, set = function (value) SpellWatch.db.profile.anchor2.scale = value; end, }, + width = { + name = "width", + type = 'range', + desc = "Timer bar width", + min = 50, + max = 400, + step = 1, + get = function () return SpellWatch.db.profile.anchor2.width; end, + set = function (text) SpellWatch.db.profile.anchor2.width = text; end, + }, + height = { + name = "height", + type = 'range', + desc = "Timer bar height", + min = 8, + max = 30, + step = 1, + get = function () return SpellWatch.db.profile.anchor2.height; end, + set = function (text) SpellWatch.db.profile.anchor2.height = text; end, + }, font = { name = "font", type = 'range', @@ -136,6 +176,26 @@ get = function () return SpellWatch.db.profile.anchor3.scale; end, set = function (value) SpellWatch.db.profile.anchor3.scale = value; end, }, + width = { + name = "width", + type = 'range', + desc = "Timer bar width", + min = 50, + max = 400, + step = 1, + get = function () return SpellWatch.db.profile.anchor3.width; end, + set = function (text) SpellWatch.db.profile.anchor3.width = text; end, + }, + height = { + name = "height", + type = 'range', + desc = "Timer bar height", + min = 8, + max = 30, + step = 1, + get = function () return SpellWatch.db.profile.anchor3.height; end, + set = function (text) SpellWatch.db.profile.anchor3.height = text; end, + }, font = { name = "font", type = 'range', @@ -216,9 +276,9 @@ SpellWatch:RegisterChatCommand({"/spellwatch", "/sw"}, options); SpellWatch:RegisterDB("SpellWatchDB"); SpellWatch:RegisterDefaults("profile", { - anchor1 = { scale = 1.0, font = 12 }, - anchor2 = { scale = 1.0, font = 12 }, - anchor3 = { scale = 1.0, font = 12 }, + anchor1 = { scale = 1.0, font = 12, height = nil, width = nil }, + anchor2 = { scale = 1.0, font = 12, height = nil, width = nil }, + anchor3 = { scale = 1.0, font = 12, height = nil, width = nil }, config = { texture = "smooth", fade = 0.5, resist = true }, timers = { } }); @@ -360,7 +420,7 @@ for name, entry in pairs(self.db.profile.timers) do if ( entry.type == SPELLWATCH_TYPE_SPELL ) and (( entry.spell == self.cast.name ) and (( entry.rank == nil ) or ( entry.rank == self.cast.rank ))) then - self:TriggerSpellCast(name, self.cast.target, self.cast.targetsex, self.cast.targetlevel, self.cast.targeticon, self.cast.cp); + self:TriggerSpellCast(name, self.cast.rank, self.cast.target, self.cast.targetsex, self.cast.targetlevel, self.cast.targeticon, self.cast.cp); end end @@ -504,8 +564,7 @@ -- cancel any active self buff/debuff timers with matching name local active; for _, active in pairs(self.active) do - if ((active.config.type == SPELLWATCH_TYPE_SELFBUFF) or (active.config.type == SPELLWATCH_TYPE_SELFDEBUFF)) - and ( buff == active.config.spell ) and ( not active.config.nocancel ) then + if ( buff == active.config.spell ) and ( not active.config.nocancel ) then self:UnregisterTimer(active.bar); end end @@ -593,7 +652,7 @@ -- Timer Setup -- ------------------------- -function SpellWatch:TriggerSpellCast(name, target, targetsex, targetlevel, targeticon, cp) +function SpellWatch:TriggerSpellCast(name, rank, target, targetsex, targetlevel, targeticon, cp) local config = self.db.profile.timers[name]; @@ -605,8 +664,17 @@ timer.targetsex = config.targeted and targetsex; timer.targetlevel = config.targeted and targetlevel; timer.targeticon = config.targeted and targeticon; - - local duration = config.duration + (config.percp or 0)*(cp and (cp > 2) and (cp - 1) or 0); + + + local duration + if ( cp and cp > 0 ) then + -- Combo point timer modifications. + duration = config.duration + (config.percp or 0)*(cp and (cp > 2) and (cp - 1) or 0); + else + -- Rank modifications. Can only be used for spells which always gain duration each rank, ie: Banish, Fear, Howl of Terror + duration = config.duration + (config.percp or 0)*(rank and rank - 1) + end + local label = string.gsub(config.label, "$n", config.spell); label = string.gsub(label, "$t", timer.target or ""); @@ -617,7 +685,7 @@ for _, active in pairs(self.active) do -- if group matches - if config.group and ( config.group == active.config.group ) then + if config.group and config.group ~= "" and ( config.group == active.config.group ) then -- if targeted, cancel other timers of same group and target -- if not targeted, cancel other timers regardless of target if not config.targeted or (( target == active.target ) and ( targetsex == active.targetsex ) @@ -661,7 +729,7 @@ for _, active in pairs(self.active) do -- cancel other timers of same group and target - if config.group and ( config.group == active.config.group ) and ( target == active.target ) then + if config.group and config.group ~= "" and ( config.group == active.config.group ) and ( target == active.target ) then self:UnregisterTimer(active.bar); -- if same spell @@ -693,6 +761,8 @@ self:RegisterCandyBar(timer.bar, duration, label, icon, color, color); self:RegisterCandyBarWithGroup(timer.bar, "SpellWatchTimers"..(timer.config.anchor or 1)); self:SetCandyBarScale(timer.bar, self.db.profile["anchor"..(timer.config.anchor or 1)].scale); + if self.db.profile["anchor"..timer.config.anchor].width then self:SetCandyBarWidth(timer.bar, self.db.profile["anchor"..timer.config.anchor].width); end + if self.db.profile["anchor"..timer.config.anchor].height then self:SetCandyBarHeight(timer.bar, self.db.profile["anchor"..timer.config.anchor].height); end self:SetCandyBarFontSize(timer.bar, self.db.profile["anchor"..(timer.config.anchor or 1)].font); self:SetCandyBarTexture(timer.bar, self.texture[self.db.profile.config.texture]); self:SetCandyBarFade(timer.bar, self.db.profile.config.fade);