Originally Posted by
Magally
Or use DBM and stop jumping through all these hoops.
What hoops did he jump through, he just sat there and had me do the work. Or are you suggesting I was going through hoops? Modifying a few simple WA scripts isn't what I'd call hoops. All in all, I'd rather people actually have real reasons for using DBM over Big Wigs not something like a WA script. The only issue here is that no one has wrote one for BW, we already provide the functionality.
Not only that, but I also cleaned up his script and made it even simpler to use because now he can just set the bar text name instead of "jumping through hoops" looking for the bar spell id.
Anyway, I tested the following using the test bars and they work fine.
Trigger:
Code:
function()
-- === CONFIG SETTINGS BEGIN ===
-- barName: Exact bar name used by Big Wigs
local barName = "Barkskin";
local config = WeakAuras.CustomValues and WeakAuras.CustomValues.BWTimers and WeakAuras.CustomValues.BWTimers[barName] and WeakAuras.CustomValues.BWTimers[barName].config or {};
-- time: Time remaining at which to trigger (in seconds), can be
-- decimal. If zero or negative, time is
-- automatically set to the total timer duration.
config.time = 10;
-- duration: Duration the trigger should remain active before
-- untrigger, can be decimal. If set to default of 0 (zero), trigger
-- expires when timer expires. If set to a positive value of say 5,
-- trigger will expire 5 seconds after trigger started, as specified
-- by "time" above.
config.duration = 3;
-- === CONFIG SETTINGS END ===
if BigWigsAnchor then
if not WeakAuras.CustomValues then WeakAuras.CustomValues = {}; end
if not WeakAuras.CustomValues.BWTimers then WeakAuras.CustomValues.BWTimers = {}; end
if not WeakAuras.CustomValues.BWTimers[barName] then WeakAuras.CustomValues.BWTimers[barName] = {}; end
if not WeakAuras.CustomValues.BWTimers[barName].config then WeakAuras.CustomValues.BWTimers[barName].config = config; end
if WeakAuras.CustomValues.BWTimers[barName].fired then return false; end
local bar;
for b in next, BigWigsAnchor.bars do
if b.candyBarLabel:GetText() == barName then
bar = b
break
end
end
if not bar and BigWigsEmphasizeAnchor then
for b in next, BigWigsEmphasizeAnchor.bars do
if b.candyBarLabel:GetText() == barName then
bar = b
break
end
end
end
if bar then -- Bar exists
if config.time <= 0 then
local min, max = bar:GetMinMaxValues()
config.time = max - min
end
-- Trigger if time remaining < time
if config.duration > 0 then
if bar.remaining <= config.time and bar.remaining > (config.time - config.duration) then
WeakAuras.CustomValues.BWTimers[barName].fired = true;
return true;
end
elseif bar.remaining <= config.time then
WeakAuras.CustomValues.BWTimers[barName].fired = true;
return true;
end
end
end
return false;
end
Untrigger:
Code:
function()
-- === CONFIG SETTINGS BEGIN ===
-- barName: Exact bar name used by Big Wigs
local barName = "Barkskin";
-- === CONFIG SETTINGS END ===
if BigWigsAnchor then
if not (WeakAuras.CustomValues and WeakAuras.CustomValues.BWTimers and WeakAuras.CustomValues.BWTimers[barName]) then return false; end
local config = WeakAuras.CustomValues.BWTimers[barName].config;
local bar;
for b in next, BigWigsAnchor.bars do
if b.candyBarLabel:GetText() == barName then
bar = b
break
end
end
if not bar and BigWigsEmphasizeAnchor then
for b in next, BigWigsEmphasizeAnchor.bars do
if b.candyBarLabel:GetText() == barName then
bar = b
break
end
end
end
if not bar then -- Bar doesn't exist
WeakAuras.CustomValues.BWTimers[barName].fired = false;
return true;
else
if config.time <= 0 then
local min, max = bar:GetMinMaxValues()
config.time = max - min
end
if not WeakAuras.CustomValues.BWTimers[barName].fired then return false; end
-- Trigger if time remaining > time
if config.duration > 0 then
if (config.time - config.duration) >= 0 and bar.remaining <= (config.time - config.duration) then
WeakAuras.CustomValues.BWTimers[barName].fired = false;
return true;
end
elseif bar.remaining > config.time then
WeakAuras.CustomValues.BWTimers[barName].fired = false;
return true;
end
end
end
return false;
end