From aee5d1e3cf4c020567cd0adff5094353af702add Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 23 Feb 2009 16:19:18 +0100 Subject: [PATCH] Properly unset the statedriver when its disabled with custom conditionals active. --- StateBar.lua | 60 ++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/StateBar.lua b/StateBar.lua index bc4a5af..c330347 100644 --- a/StateBar.lua +++ b/StateBar.lua @@ -103,45 +103,45 @@ function StateBar:UpdateStates(returnOnly) self:ForAll("UpdateStates") local statedriver - if returnOnly or not self:GetStateOption("customEnabled") then + if not self:GetStateOption("enabled") then + statedriver = "0" + elseif returnOnly or not self:GetStateOption("customEnabled") then statedriver = {} local stateconfig = self.config.states - if self:GetStateOption("enabled") then - -- arguments will be parsed from left to right, so we have a priority here + -- arguments will be parsed from left to right, so we have a priority here - if self:GetStateOption("possess") then - table_insert(statedriver, "[bonusbar:5]11") + if self:GetStateOption("possess") then + table_insert(statedriver, "[bonusbar:5]11") + end + + -- highest priority have our temporary quick-swap keys + for _,v in pairs(modifiers) do + local page = self:GetStateOption(v) + if page and page ~= 0 then + table_insert(statedriver, fmt("[mod:%s]%s", v, page)) end + end - -- highest priority have our temporary quick-swap keys - for _,v in pairs(modifiers) do - local page = self:GetStateOption(v) - if page and page ~= 0 then - table_insert(statedriver, fmt("[mod:%s]%s", v, page)) - end + -- second priority the manual changes using the StateBar options + if self:GetStateOption("StateBar") then + for i=2,6 do + table_insert(statedriver, fmt("[bar:%s]%s", i, i)) end + end - -- second priority the manual changes using the StateBar options - if self:GetStateOption("StateBar") then - for i=2,6 do - table_insert(statedriver, fmt("[bar:%s]%s", i, i)) - end - end - - -- third priority the stances - if stancemap then - if not stateconfig.stance[playerclass] then stateconfig.stance[playerclass] = {} end - for i,v in pairs(stancemap) do - local state = self:GetStanceState(v) - if state and state ~= 0 and v.index then - if playerclass == "DRUID" and v.id == "cat" then - local prowl = self:GetStanceState("prowl") - if prowl then - table_insert(statedriver, fmt("[bonusbar:%s,stealth:1]%s", v.index, prowl)) - end + -- third priority the stances + if stancemap then + if not stateconfig.stance[playerclass] then stateconfig.stance[playerclass] = {} end + for i,v in pairs(stancemap) do + local state = self:GetStanceState(v) + if state and state ~= 0 and v.index then + if playerclass == "DRUID" and v.id == "cat" then + local prowl = self:GetStanceState("prowl") + if prowl then + table_insert(statedriver, fmt("[bonusbar:%s,stealth:1]%s", v.index, prowl)) end - table_insert(statedriver, fmt("[%s:%s]%s", v.type or "bonusbar", v.index, state)) end + table_insert(statedriver, fmt("[%s:%s]%s", v.type or "bonusbar", v.index, state)) end end end