mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-07-27 09:44:44 +00:00
feat: implement auto-swap profile system and add safety null checks for skin configuration data
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
## Interface: 11200
|
## Interface: 11200
|
||||||
## Title: HealBotBlue
|
## Title: HealBotBlue
|
||||||
## Version: 1.5
|
## Version: 1.5.1
|
||||||
## Author: Bluewhale
|
## Author: Bluewhale
|
||||||
## Notes: Adds panel with skinable bars for healing and decursive
|
## Notes: Adds panel with skinable bars for healing and decursive
|
||||||
## SavedVariablesPerCharacter: HealBot_Config
|
## SavedVariablesPerCharacter: HealBot_Config
|
||||||
|
|||||||
@@ -2,6 +2,20 @@ HealBot_ConfigDefaults = {
|
|||||||
ShowManaBars=0,
|
ShowManaBars=0,
|
||||||
ManaBarsHealersOnly=0,
|
ManaBarsHealersOnly=0,
|
||||||
Version = HEALBOT_VERSION,
|
Version = HEALBOT_VERSION,
|
||||||
|
AutoSwap_Enabled = 0,
|
||||||
|
AutoSwap_Profiles = {
|
||||||
|
[1] = HEALBOT_SKINS_STD,
|
||||||
|
[2] = HEALBOT_SKINS_STD,
|
||||||
|
[3] = HEALBOT_SKINS_STD,
|
||||||
|
[4] = HEALBOT_SKINS_STD,
|
||||||
|
[5] = HEALBOT_SKINS_STD,
|
||||||
|
},
|
||||||
|
bmaxrows = {
|
||||||
|
[HEALBOT_SKINS_STD] = 0,
|
||||||
|
},
|
||||||
|
GridOrientation = {
|
||||||
|
[HEALBOT_SKINS_STD] = 1,
|
||||||
|
},
|
||||||
AlertLevel = 0.95,
|
AlertLevel = 0.95,
|
||||||
AutoClose = 1,
|
AutoClose = 1,
|
||||||
PanelSounds = 1,
|
PanelSounds = 1,
|
||||||
|
|||||||
+2
-2
@@ -314,8 +314,8 @@ function HealBot_Options_SetSkins()
|
|||||||
HealBot_Options_BarHeightS:SetValue(HealBot_Config.bheight[HealBot_Config.Current_Skin])
|
HealBot_Options_BarHeightS:SetValue(HealBot_Config.bheight[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_BarWidthS:SetValue(HealBot_Config.bwidth[HealBot_Config.Current_Skin])
|
HealBot_Options_BarWidthS:SetValue(HealBot_Config.bwidth[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_BarNumColsS:SetValue(HealBot_Config.numcols[HealBot_Config.Current_Skin])
|
HealBot_Options_BarNumColsS:SetValue(HealBot_Config.numcols[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_BarMaxRowsS:SetValue(HealBot_Config.bmaxrows[HealBot_Config.Current_Skin] or 0)
|
HealBot_Options_BarMaxRowsS:SetValue((HealBot_Config.bmaxrows and HealBot_Config.bmaxrows[HealBot_Config.Current_Skin]) or 0)
|
||||||
HealBot_Options_GridOrientation:SetChecked((HealBot_Config.GridOrientation[HealBot_Config.Current_Skin] == 2) and 1 or nil)
|
HealBot_Options_GridOrientation:SetChecked(((HealBot_Config.GridOrientation and HealBot_Config.GridOrientation[HealBot_Config.Current_Skin]) == 2) and 1 or nil)
|
||||||
HealBot_Options_BarBRSpaceS:SetValue(HealBot_Config.brspace[HealBot_Config.Current_Skin])
|
HealBot_Options_BarBRSpaceS:SetValue(HealBot_Config.brspace[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_BarBCSpaceS:SetValue(HealBot_Config.bcspace[HealBot_Config.Current_Skin])
|
HealBot_Options_BarBCSpaceS:SetValue(HealBot_Config.bcspace[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_FramePaddingS:SetValue((HealBot_Config.bpadding and HealBot_Config.bpadding[HealBot_Config.Current_Skin]) or 10)
|
HealBot_Options_FramePaddingS:SetValue((HealBot_Config.bpadding and HealBot_Config.bpadding[HealBot_Config.Current_Skin]) or 10)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ function HealBot_Options_Auto_Initialize()
|
|||||||
info.text = HealBot_Config.Skins[i]
|
info.text = HealBot_Config.Skins[i]
|
||||||
info.func = HealBot_Options_Auto_OnSelect
|
info.func = HealBot_Options_Auto_OnSelect
|
||||||
info.value = id
|
info.value = id
|
||||||
|
if not HealBot_Config.AutoSwap_Profiles then HealBot_Config.AutoSwap_Profiles = {} end
|
||||||
if HealBot_Config.AutoSwap_Profiles[id] == HealBot_Config.Skins[i] then
|
if HealBot_Config.AutoSwap_Profiles[id] == HealBot_Config.Skins[i] then
|
||||||
info.checked = 1
|
info.checked = 1
|
||||||
else
|
else
|
||||||
@@ -34,6 +35,7 @@ function HealBot_Options_Auto_OnSelect()
|
|||||||
local id = this.value
|
local id = this.value
|
||||||
if not id or not skin then return end
|
if not id or not skin then return end
|
||||||
|
|
||||||
|
if not HealBot_Config.AutoSwap_Profiles then HealBot_Config.AutoSwap_Profiles = {} end
|
||||||
HealBot_Config.AutoSwap_Profiles[id] = skin
|
HealBot_Config.AutoSwap_Profiles[id] = skin
|
||||||
|
|
||||||
local dropdowns = {
|
local dropdowns = {
|
||||||
@@ -45,7 +47,7 @@ function HealBot_Options_Auto_OnSelect()
|
|||||||
}
|
}
|
||||||
local dropdownName = dropdowns[id]
|
local dropdownName = dropdowns[id]
|
||||||
local dropdownFrame = getglobal(dropdownName)
|
local dropdownFrame = getglobal(dropdownName)
|
||||||
UIDropDownMenu_SetSelectedValue(dropdownFrame, skin)
|
HealBot_UIDropDownMenu_SetSelectedValue(dropdownFrame, skin)
|
||||||
UIDropDownMenu_SetText(skin, dropdownFrame)
|
UIDropDownMenu_SetText(skin, dropdownFrame)
|
||||||
|
|
||||||
HealBot_Action_PartyChanged()
|
HealBot_Action_PartyChanged()
|
||||||
@@ -69,9 +71,10 @@ function HealBot_Options_Auto_OnShow(this)
|
|||||||
local dropdownFrame = getglobal(name)
|
local dropdownFrame = getglobal(name)
|
||||||
if dropdownFrame then
|
if dropdownFrame then
|
||||||
UIDropDownMenu_SetWidth(150, dropdownFrame)
|
UIDropDownMenu_SetWidth(150, dropdownFrame)
|
||||||
|
if not HealBot_Config.AutoSwap_Profiles then HealBot_Config.AutoSwap_Profiles = {} end
|
||||||
local skin = HealBot_Config.AutoSwap_Profiles[id]
|
local skin = HealBot_Config.AutoSwap_Profiles[id]
|
||||||
if skin then
|
if skin then
|
||||||
UIDropDownMenu_SetSelectedValue(dropdownFrame, skin)
|
HealBot_UIDropDownMenu_SetSelectedValue(dropdownFrame, skin)
|
||||||
UIDropDownMenu_SetText(skin, dropdownFrame)
|
UIDropDownMenu_SetText(skin, dropdownFrame)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
-- Split from original HealBot_Options.lua
|
-- Split from original HealBot_Options.lua
|
||||||
|
|
||||||
function HealBot_Options_BarMaxRowsS_OnValueChanged(this)
|
function HealBot_Options_BarMaxRowsS_OnValueChanged(this)
|
||||||
|
if not HealBot_Config.bmaxrows then HealBot_Config.bmaxrows = {} end
|
||||||
HealBot_Config.bmaxrows[HealBot_Config.Current_Skin] = this:GetValue()
|
HealBot_Config.bmaxrows[HealBot_Config.Current_Skin] = this:GetValue()
|
||||||
HealBot_Action_PartyChanged()
|
HealBot_Action_PartyChanged()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HealBot_Options_GridOrientation_OnClick(this)
|
function HealBot_Options_GridOrientation_OnClick(this)
|
||||||
|
if not HealBot_Config.GridOrientation then HealBot_Config.GridOrientation = {} end
|
||||||
if this:GetChecked() then
|
if this:GetChecked() then
|
||||||
HealBot_Config.GridOrientation[HealBot_Config.Current_Skin] = 2 -- Horizontal
|
HealBot_Config.GridOrientation[HealBot_Config.Current_Skin] = 2 -- Horizontal
|
||||||
else
|
else
|
||||||
@@ -25,8 +27,10 @@ function HealBot_Options_NewSkin_OnTextChanged(this)
|
|||||||
end
|
end
|
||||||
function HealBot_Options_NewSkinb_OnClick(this)
|
function HealBot_Options_NewSkinb_OnClick(this)
|
||||||
HealBot_Config.numcols[HealBot_Options_NewSkin:GetText()] = HealBot_Config.numcols[HealBot_Config.Current_Skin]
|
HealBot_Config.numcols[HealBot_Options_NewSkin:GetText()] = HealBot_Config.numcols[HealBot_Config.Current_Skin]
|
||||||
HealBot_Config.bmaxrows[HealBot_Options_NewSkin:GetText()] = HealBot_Config.bmaxrows[HealBot_Config.Current_Skin]
|
if not HealBot_Config.bmaxrows then HealBot_Config.bmaxrows = {} end
|
||||||
HealBot_Config.GridOrientation[HealBot_Options_NewSkin:GetText()] = HealBot_Config.GridOrientation[HealBot_Config.Current_Skin]
|
if not HealBot_Config.GridOrientation then HealBot_Config.GridOrientation = {} end
|
||||||
|
HealBot_Config.bmaxrows[HealBot_Options_NewSkin:GetText()] = HealBot_Config.bmaxrows[HealBot_Config.Current_Skin] or 0
|
||||||
|
HealBot_Config.GridOrientation[HealBot_Options_NewSkin:GetText()] = HealBot_Config.GridOrientation[HealBot_Config.Current_Skin] or 1
|
||||||
HealBot_Config.btexture[HealBot_Options_NewSkin:GetText()] = HealBot_Config.btexture[HealBot_Config.Current_Skin]
|
HealBot_Config.btexture[HealBot_Options_NewSkin:GetText()] = HealBot_Config.btexture[HealBot_Config.Current_Skin]
|
||||||
HealBot_Config.bcspace[HealBot_Options_NewSkin:GetText()] = HealBot_Config.bcspace[HealBot_Config.Current_Skin]
|
HealBot_Config.bcspace[HealBot_Options_NewSkin:GetText()] = HealBot_Config.bcspace[HealBot_Config.Current_Skin]
|
||||||
HealBot_Config.brspace[HealBot_Options_NewSkin:GetText()] = HealBot_Config.brspace[HealBot_Config.Current_Skin]
|
HealBot_Config.brspace[HealBot_Options_NewSkin:GetText()] = HealBot_Config.brspace[HealBot_Config.Current_Skin]
|
||||||
@@ -72,8 +76,8 @@ end
|
|||||||
function HealBot_Options_DeleteSkin_OnClick(this)
|
function HealBot_Options_DeleteSkin_OnClick(this)
|
||||||
if HealBot_Config.Current_Skin~=HEALBOT_SKINS_STD then
|
if HealBot_Config.Current_Skin~=HEALBOT_SKINS_STD then
|
||||||
HealBot_Config.numcols[HealBot_Options_SkinsText:GetText()] = nil
|
HealBot_Config.numcols[HealBot_Options_SkinsText:GetText()] = nil
|
||||||
HealBot_Config.bmaxrows[HealBot_Options_SkinsText:GetText()] = nil
|
if HealBot_Config.bmaxrows then HealBot_Config.bmaxrows[HealBot_Options_SkinsText:GetText()] = nil end
|
||||||
HealBot_Config.GridOrientation[HealBot_Options_SkinsText:GetText()] = nil
|
if HealBot_Config.GridOrientation then HealBot_Config.GridOrientation[HealBot_Options_SkinsText:GetText()] = nil end
|
||||||
HealBot_Config.btexture[HealBot_Options_SkinsText:GetText()] = nil
|
HealBot_Config.btexture[HealBot_Options_SkinsText:GetText()] = nil
|
||||||
HealBot_Config.bcspace[HealBot_Options_SkinsText:GetText()] = nil
|
HealBot_Config.bcspace[HealBot_Options_SkinsText:GetText()] = nil
|
||||||
HealBot_Config.brspace[HealBot_Options_SkinsText:GetText()] = nil
|
HealBot_Config.brspace[HealBot_Options_SkinsText:GetText()] = nil
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ function HealBot_Action_PartyChanged()
|
|||||||
threshold = 5 -- Raid40
|
threshold = 5 -- Raid40
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not HealBot_Config.AutoSwap_Profiles then HealBot_Config.AutoSwap_Profiles = {} end
|
||||||
local swapSkin = HealBot_Config.AutoSwap_Profiles[threshold]
|
local swapSkin = HealBot_Config.AutoSwap_Profiles[threshold]
|
||||||
if swapSkin and swapSkin ~= HealBot_Config.Current_Skin then
|
if swapSkin and swapSkin ~= HealBot_Config.Current_Skin then
|
||||||
HealBot_Config.Current_Skin = swapSkin
|
HealBot_Config.Current_Skin = swapSkin
|
||||||
@@ -769,8 +770,8 @@ function HealBot_Action_PartyChanged()
|
|||||||
local MaxOffsetY = 0;
|
local MaxOffsetY = 0;
|
||||||
local MaxOffsetX = 0;
|
local MaxOffsetX = 0;
|
||||||
|
|
||||||
local maxRows = HealBot_Config.bmaxrows[HealBot_Config.Current_Skin] or 0
|
local maxRows = (HealBot_Config.bmaxrows and HealBot_Config.bmaxrows[HealBot_Config.Current_Skin]) or 0
|
||||||
local orientation = HealBot_Config.GridOrientation[HealBot_Config.Current_Skin] or 1
|
local orientation = (HealBot_Config.GridOrientation and HealBot_Config.GridOrientation[HealBot_Config.Current_Skin]) or 1
|
||||||
|
|
||||||
if cols > (numBars - numHeaders) and maxRows == 0 then
|
if cols > (numBars - numHeaders) and maxRows == 0 then
|
||||||
cols = numBars - numHeaders;
|
cols = numBars - numHeaders;
|
||||||
|
|||||||
Reference in New Issue
Block a user