add custom-conditional support to visibility driver, does not validate the syntax yet, so take care
This commit is contained in:
@@ -291,22 +291,26 @@ function Bar:InitVisibilityDriver()
|
||||
self.hidedriver = {}
|
||||
UnregisterStateDriver(self, 'visibility')
|
||||
|
||||
for key, value in pairs(self.config.visibility) do
|
||||
if value then
|
||||
if key == "always" then
|
||||
table_insert(self.hidedriver, "hide")
|
||||
elseif key == "possess" then
|
||||
table_insert(self.hidedriver, "[bonusbar:5]hide")
|
||||
elseif directVisCond[key] then
|
||||
table_insert(self.hidedriver, ("[%s]hide"):format(key))
|
||||
elseif key == "stance" then
|
||||
for k,v in pairs(value) do
|
||||
if v then
|
||||
table_insert(self.hidedriver, ("[stance:%d]hide"):format(k))
|
||||
if self.config.visibility.custom then
|
||||
table_insert(self.hidedriver, self.config.visibility.customdata or "")
|
||||
else
|
||||
for key, value in pairs(self.config.visibility) do
|
||||
if value then
|
||||
if key == "always" then
|
||||
table_insert(self.hidedriver, "hide")
|
||||
elseif key == "possess" then
|
||||
table_insert(self.hidedriver, "[bonusbar:5]hide")
|
||||
elseif directVisCond[key] then
|
||||
table_insert(self.hidedriver, ("[%s]hide"):format(key))
|
||||
elseif key == "stance" then
|
||||
for k,v in pairs(value) do
|
||||
if v then
|
||||
table_insert(self.hidedriver, ("[stance:%d]hide"):format(k))
|
||||
end
|
||||
end
|
||||
else
|
||||
Bartender4:Print("Invalid visibility state: "..key)
|
||||
end
|
||||
else
|
||||
Bartender4:Print("Invalid visibility state: "..key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -116,7 +116,7 @@ function module:GetOptionsObject()
|
||||
type = "group",
|
||||
name = L["State Configuration"],
|
||||
cmdInline = true,
|
||||
order = 2,
|
||||
order = 5,
|
||||
args = self:GetStateOptionsTable(),
|
||||
}
|
||||
obj:NewCategory("state", states)
|
||||
|
||||
+27
-1
@@ -9,7 +9,7 @@ local Bar = Bartender4.Bar.prototype
|
||||
local barregistry = Bartender4.Bar.barregistry
|
||||
|
||||
-- option utilty functions
|
||||
local optGetter, optSetter, visibilityGetter, visibilitySetter
|
||||
local optGetter, optSetter, visibilityGetter, visibilitySetter, customEnabled
|
||||
do
|
||||
local getBar, optionMap, callFunc
|
||||
-- maps option keys to function names
|
||||
@@ -60,6 +60,11 @@ do
|
||||
local option = info[#info]
|
||||
bar:SetVisibilityOption(option, ...)
|
||||
end
|
||||
|
||||
function customEnabled(info)
|
||||
local bar = getBar(info[2])
|
||||
return bar:GetVisibilityOption("custom")
|
||||
end
|
||||
end
|
||||
|
||||
local function getStanceTable()
|
||||
@@ -153,6 +158,7 @@ function Bar:GetOptionObject()
|
||||
name = L["Always Hide"],
|
||||
desc = L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."],
|
||||
width = "full",
|
||||
disabled = customEnabled,
|
||||
},
|
||||
possess = {
|
||||
order = 15,
|
||||
@@ -160,30 +166,35 @@ function Bar:GetOptionObject()
|
||||
name = L["Hide when Possessing"],
|
||||
desc = L["Hide this bar when you are possessing a NPC."],
|
||||
width = "full",
|
||||
disabled = customEnabled,
|
||||
},
|
||||
combat = {
|
||||
order = 20,
|
||||
type = "toggle",
|
||||
name = L["Hide in Combat"],
|
||||
desc = L["This bar will be hidden once you enter combat."],
|
||||
disabled = customEnabled,
|
||||
},
|
||||
nocombat = {
|
||||
order = 21,
|
||||
type = "toggle",
|
||||
name = L["Hide out of Combat"],
|
||||
desc = L["This bar will be hidden whenever you are not in combat."],
|
||||
disabled = customEnabled,
|
||||
},
|
||||
pet = {
|
||||
order = 30,
|
||||
type = "toggle",
|
||||
name = L["Hide with pet"],
|
||||
desc = L["Hide this bar when you have a pet."],
|
||||
disabled = customEnabled,
|
||||
},
|
||||
nopet = {
|
||||
order = 31,
|
||||
type = "toggle",
|
||||
name = L["Hide without pet"],
|
||||
desc = L["Hide this bar when you have no pet."],
|
||||
disabled = customEnabled,
|
||||
},
|
||||
stance = {
|
||||
order = 50,
|
||||
@@ -192,6 +203,21 @@ function Bar:GetOptionObject()
|
||||
desc = L["Hide this bar in a specific Stance or Form."],
|
||||
values = getStanceTable,
|
||||
hidden = function() return (GetNumShapeshiftForms() < 1) end,
|
||||
disabled = customEnabled,
|
||||
},
|
||||
custom = {
|
||||
order = 100,
|
||||
type = "toggle",
|
||||
name = L["Use Custom Condition"],
|
||||
desc = L["Enable the use of a custom condition, disabling all of the above."],
|
||||
width = "full",
|
||||
},
|
||||
customdata = {
|
||||
order = 101,
|
||||
type = "input",
|
||||
name = L["Custom Conditionals"],
|
||||
desc = L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"],
|
||||
width = "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,6 +31,7 @@ if not L then return end
|
||||
-- L["Configure the alpha of the bar."] = true
|
||||
-- L["Configure the padding of the buttons."] = true
|
||||
-- L["Configure the scale of the bar."] = true
|
||||
-- L["Custom Conditionals"] = true
|
||||
-- L["Default Bar State"] = true
|
||||
-- L["Disabled"] = true
|
||||
-- L["Disabled in Combat"] = true
|
||||
@@ -42,6 +43,7 @@ if not L then return end
|
||||
-- L["Enable the Micro Menu"] = true
|
||||
-- L["Enable the PetBar"] = true
|
||||
-- L["Enable the StanceBar"] = true
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
-- L["Enable/Disable the bar."] = true
|
||||
-- L["Enabled"] = true
|
||||
-- L["FAQ"] = true
|
||||
@@ -103,6 +105,8 @@ if not L then return end
|
||||
-- L["Toggle the button grid."] = true
|
||||
-- L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
-- L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
-- L["Zoom"] = true
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = true
|
||||
L["Configure the alpha of the bar."] = true
|
||||
L["Configure the padding of the buttons."] = true
|
||||
L["Configure the scale of the bar."] = true
|
||||
L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = true
|
||||
L["Disabled"] = true
|
||||
L["Disabled in Combat"] = true
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = true
|
||||
L["Enable the Micro Menu"] = true
|
||||
L["Enable the PetBar"] = true
|
||||
L["Enable the StanceBar"] = true
|
||||
L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = true
|
||||
L["Enabled"] = true
|
||||
L["FAQ"] = true
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = true
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
L["Use Custom Condition"] = true
|
||||
L["Visibility"] = true
|
||||
L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = true
|
||||
|
||||
@@ -31,6 +31,7 @@ if not L then return end
|
||||
-- L["Configure the alpha of the bar."] = true
|
||||
-- L["Configure the padding of the buttons."] = true
|
||||
-- L["Configure the scale of the bar."] = true
|
||||
-- L["Custom Conditionals"] = true
|
||||
-- L["Default Bar State"] = true
|
||||
-- L["Disabled"] = true
|
||||
-- L["Disabled in Combat"] = true
|
||||
@@ -42,6 +43,7 @@ if not L then return end
|
||||
-- L["Enable the Micro Menu"] = true
|
||||
-- L["Enable the PetBar"] = true
|
||||
-- L["Enable the StanceBar"] = true
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
-- L["Enable/Disable the bar."] = true
|
||||
-- L["Enabled"] = true
|
||||
-- L["FAQ"] = true
|
||||
@@ -103,6 +105,8 @@ if not L then return end
|
||||
-- L["Toggle the button grid."] = true
|
||||
-- L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
-- L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
-- L["Zoom"] = true
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = "Configure la barre du familier."
|
||||
L["Configure the alpha of the bar."] = "Configure la transparence de la barre."
|
||||
L["Configure the padding of the buttons."] = "Configure l'espacement entre les boutons."
|
||||
L["Configure the scale of the bar."] = "Configure l'échelle de la barre."
|
||||
-- L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = "État par défaut de la barre"
|
||||
L["Disabled"] = "Désactivée"
|
||||
L["Disabled in Combat"] = "Désactivée en combat"
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = "Active le mode Fondu."
|
||||
L["Enable the Micro Menu"] = "Active le micro menu."
|
||||
L["Enable the PetBar"] = "Active la barre du familier."
|
||||
L["Enable the StanceBar"] = "Active la barre des postures."
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = "Active/Désactive la barre."
|
||||
L["Enabled"] = "Activée"
|
||||
L["FAQ"] = "FAQ"
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = "Affiche ou non la grille des boutons."
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "Utilise ou non la fonctionnalité de ciblage auto. basé sur les modificateurs."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "Utilise ou non la fonctionnalité de ciblage auto. au clic droit."
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = "Zoom"
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = "소환수 바 설정"
|
||||
L["Configure the alpha of the bar."] = "바의 투명도를 변경합니다."
|
||||
L["Configure the padding of the buttons."] = "버튼 간격을 변경합니다."
|
||||
L["Configure the scale of the bar."] = "바의 크기를 변경합니다."
|
||||
-- L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = "기본 바 형세"
|
||||
L["Disabled"] = "비활성화"
|
||||
L["Disabled in Combat"] = "전투중 비활성화"
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = "사라짐 모드를 사용합니다."
|
||||
L["Enable the Micro Menu"] = "게임 메뉴를 사용합니다."
|
||||
L["Enable the PetBar"] = "소환수바를 사용합니다."
|
||||
L["Enable the StanceBar"] = "태세바를 사용합니다."
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = "바를 사용하거나 사용하지 않습니다."
|
||||
L["Enabled"] = "사용"
|
||||
L["FAQ"] = "묻고 답하기"
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = "버튼 무늬를 전환합니다."
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "기능키-기반 자신에게 시전 기능의 사용을 전환합니다."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "우-클릭시 자신에게 시전 기능의 사용을 전환합니다."
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = "확대"
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = "Настройка панели питомца"
|
||||
L["Configure the alpha of the bar."] = "Настройка степени прозрачности панели (1 - непрозрачная)."
|
||||
L["Configure the padding of the buttons."] = "Настройка ширины промежутков между кнопками."
|
||||
L["Configure the scale of the bar."] = "Настройка масштаба панели"
|
||||
-- L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = "Состояние по-умолчанию"
|
||||
L["Disabled"] = "Отключено"
|
||||
L["Disabled in Combat"] = "Отключать в бою"
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = "Включить режим сокрытия п
|
||||
L["Enable the Micro Menu"] = "Включить Микроменю"
|
||||
L["Enable the PetBar"] = "Включить панель питомца"
|
||||
L["Enable the StanceBar"] = "Включить панель стоек"
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = "Включить/Отключить панель"
|
||||
L["Enabled"] = "Включено"
|
||||
L["FAQ"] = "ЧАВО"
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = "Переключение отображения пустых кнопок."
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "Переключение использования функции Чтение на себя по умолчанию."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "Переключение использования функции ПКМ Чтение на себя."
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = "Увеличение"
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = "配置宠物栏"
|
||||
L["Configure the alpha of the bar."] = "设置动作条的透明度。"
|
||||
L["Configure the padding of the buttons."] = "配置按钮之间的距离"
|
||||
L["Configure the scale of the bar."] = "设置动作条缩放。"
|
||||
-- L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = "默认动作条状态"
|
||||
L["Disabled"] = "关闭"
|
||||
L["Disabled in Combat"] = "战斗中关闭"
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = "开启淡出模式"
|
||||
L["Enable the Micro Menu"] = "开启微型主菜单"
|
||||
L["Enable the PetBar"] = "开启宠物栏"
|
||||
L["Enable the StanceBar"] = "开启姿态栏"
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = "开启/关闭 该动作条。"
|
||||
L["Enabled"] = "开启"
|
||||
L["FAQ"] = "帮助"
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = "勾选该选项将显示空的按钮。"
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "关闭/开启 自我施法功能。"
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "关闭/开启 使用右键点击对自己施法功能。"
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = "缩放"
|
||||
|
||||
@@ -31,6 +31,7 @@ L["Configure the Pet Bar"] = "設定寵物列"
|
||||
L["Configure the alpha of the bar."] = "設定動作條透明度"
|
||||
L["Configure the padding of the buttons."] = "設定按鈕間距"
|
||||
L["Configure the scale of the bar."] = "設定動作條大小"
|
||||
-- L["Custom Conditionals"] = true
|
||||
L["Default Bar State"] = "預設動作條狀態"
|
||||
L["Disabled"] = "關閉"
|
||||
L["Disabled in Combat"] = "戰鬥中關閉"
|
||||
@@ -42,6 +43,7 @@ L["Enable the FadeOut mode"] = "開啟淡出模式"
|
||||
L["Enable the Micro Menu"] = "開啟微型選單"
|
||||
L["Enable the PetBar"] = "開啟寵物列"
|
||||
L["Enable the StanceBar"] = "開啟姿勢列"
|
||||
-- L["Enable the use of a custom condition, disabling all of the above."] = true
|
||||
L["Enable/Disable the bar."] = "開啟/關閉動作條"
|
||||
L["Enabled"] = "開啟"
|
||||
L["FAQ"] = "問與答"
|
||||
@@ -103,6 +105,8 @@ L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"]
|
||||
L["Toggle the button grid."] = "顯示空白按鈕"
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "切換使用自我施法功能"
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "切換使用右鍵自我施法功能"
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
-- L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"] = true
|
||||
L["Zoom"] = "放大"
|
||||
|
||||
Reference in New Issue
Block a user