📄 bag_status_meters.lua
字号:
getglobal("BSM_Check_Title"):Disable();
getglobal("BSM_Check_Back"):Disable();
getglobal("BSM_Check_OverallLabels"):Disable();
getglobal("BSM_Check_OverallColor"):Disable();
getglobal("BSM_Check_OverallTotals"):Disable();
getglobal("BSM_Check_OverallSlots"):Disable();
end
elseif name == "BSM_Check_Title" then
getglobal(name.."Text"):SetText(BSM_TEXT_TITLE);
if BSM_Save.O.title then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_Back" then
getglobal(name.."Text"):SetText(BSM_TEXT_BACK);
if BSM_Save.O.back then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OverallLabels" then
getglobal(name.."Text"):SetText(BSM_TEXT_LABELS);
if BSM_Save.O.showlabels then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OverallColor" then
getglobal(name.."Text"):SetText(BSM_TEXT_COLOR);
if BSM_Save.O.color then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OverallTotals" then
getglobal(name.."Text"):SetText(BSM_TEXT_TOTALS);
if BSM_Save.O.totals then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OverallSlots" then
getglobal(name.."Text"):SetText(BSM_TEXT_SLOTS);
if BSM_Save.O.slots == BSM_SLOTS_FREE then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OverallLock" then
getglobal(name.."Text"):SetText(BSM_TEXT_OVERALLLOCK);
if BSM_Save.O.lock then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Options_Position" then
getglobal(name.."Text"):SetText(BSM_TEXT_OVERALLPOS);
elseif name == "BSM_Check_Notify" then
getglobal(name.."Text"):SetText(BSM_TEXT_NOTIFY);
if BSM_Save.notify then
b:SetChecked(1);
else
b:SetChecked(0);
end
elseif name == "BSM_Check_OptionsButton" then
getglobal(name.."Text"):SetText(BSM_TEXT_OPTBUTTON);
if BSM_Save.optbutton then
b:SetChecked(1);
else
b:SetChecked(0);
end
end
end
--BSM_Chk_Individual:
-- Purpose - Enables/Disables all individual meter elements in options and in UI when the "Enable Individual" option is clicked
-- Parameters - b: the "Enable Individual" check box
-- Returns - Nothing
function BSM_Chk_Individual(b)
if b:GetChecked() == 1 then
BSM_EnableIndividualChecks();
BSM_Save.I.enable = true;
BSM_EnableAllIndividual();
BSM_updateFreeSlots();
else
BSM_DisableIndividualChecks();
BSM_Save.I.enable = false;
BSM_DisableAllIndividual();
end
end
--BSM_Chk_Overall:
-- Purpose - Enables/Disables all overall meter elements in options and in UI when the "Enable Overall" option is clicked
-- Parameters - b: the "Enable Overall" check box
-- Returns - Nothing
function BSM_Chk_Overall(b)
if b:GetChecked() == 1 then
getglobal("BSM_Check_Title"):Enable();
getglobal("BSM_Check_Back"):Enable();
getglobal("BSM_Check_OverallLabels"):Enable();
getglobal("BSM_Check_OverallColor"):Enable();
getglobal("BSM_Check_OverallTotals"):Enable();
getglobal("BSM_Check_OverallSlots"):Enable();
getglobal("BSM_Check_OverallLock"):Enable();
getglobal("BSM_Options_PositionSet"):Enable();
BSM_Save.O.enable = true;
getglobal(BSM_FRAME):Show();
BSM_updateFreeSlots();
else
getglobal("BSM_Check_Title"):Disable();
getglobal("BSM_Check_Back"):Disable();
getglobal("BSM_Check_OverallLabels"):Disable();
getglobal("BSM_Check_OverallColor"):Disable();
getglobal("BSM_Check_OverallTotals"):Disable();
getglobal("BSM_Check_OverallSlots"):Disable();
getglobal("BSM_Check_OverallLock"):Disable();
getglobal("BSM_Options_PositionSet"):Disable();
BSM_Save.O.enable = false;
getglobal(BSM_FRAME):Hide();
end
end
--BSM_CheckOnClick:
-- Purpose - Makes the necessary checks for enabling/disabling child check boxes and sets necessary variables
-- Parameters - b: the check box that's being clicked
-- Returns - Nothing
function BSM_CheckOnClick(b)
local name = b:GetName();
if name == "BSM_Check_Individual" then
BSM_Chk_Individual(b);
elseif name == "BSM_Check_Overlay" then
if b:GetChecked() == 1 then
getglobal("BSM_Check_Bars"):Enable();
getglobal("BSM_Check_Labels"):Enable();
BSM_Save.I.overlay = true;
--if BSM_Save.I.enabled then
if BSM_Save.I.bars then
getglobal(BSM_BARS):Show();
end
if BSM_Save.I.showlabels and (BSM_Save.I.bars or BSM_Save.I.labels) then
getglobal(BSM_BARS_LABELS):Show();
end
BSM_updateFreeSlots();
--end
else
getglobal("BSM_Check_Bars"):Disable();
getglobal("BSM_Check_Labels"):Disable();
BSM_Save.I.overlay = false;
getglobal(BSM_BARS_LABELS):Hide();
getglobal(BSM_BARS):Hide();
end
elseif name == "BSM_Check_Bars" then
b:SetChecked(1);
getglobal("BSM_Check_Labels"):SetChecked(0);
BSM_Save.I.bars = true;
BSM_Save.I.labels = false;
--if BSM_Save.I.enabled then
if BSM_Save.I.showlabels then
getglobal(BSM_BARS_LABELS):Show();
end
getglobal(BSM_BARS):Show();
BSM_updateFreeSlots();
--end
elseif name == "BSM_Check_Labels" then
b:SetChecked(1);
getglobal("BSM_Check_Bars"):SetChecked(0);
BSM_Save.I.labels = true;
BSM_Save.I.bars = false;
getglobal(BSM_BARS):Hide();
--if BSM_Save.I.enabled then
if BSM_Save.I.showlabels then
getglobal(BSM_BARS_LABELS):Show();
BSM_updateFreeSlots();
end
--end
elseif name == "BSM_Check_Dropdown" then
if b:GetChecked() == 1 then
getglobal("BSM_Check_Bindings"):Enable();
BSM_Save.I.dropdowns = true;
--if BSM_Save.I.enabled then
getglobal(BSM_DROPDOWNS):Show();
if BSM_Save.I.showlabels then
getglobal(BSM_DROPDOWNS_LABELS):Show();
end
BSM_updateFreeSlots();
--end
else
getglobal("BSM_Check_Bindings"):Disable();
BSM_Save.I.dropdowns = false;
getglobal(BSM_DROPDOWNS):Hide();
getglobal(BSM_DROPDOWNS_LABELS):Hide();
end
elseif name == "BSM_Check_Bindings" then
if b:GetChecked() == 1 then
BSM_Save.I.bindings = true;
--if BSM_Save.I.enabled then
if BSM_Save.I.bindings then
for i = 0, 4, 1 do
getglobal(BSM_DROPDOWNS..i.."Key"):Show();
end
end
--end
else
BSM_Save.I.bindings = false;
for i = 0, 4, 1 do
getglobal(BSM_DROPDOWNS..i.."Key"):Hide();
end
end
elseif name == "BSM_Check_IndvLabels" then
if b:GetChecked() == 1 then
BSM_Save.I.showlabels = true;
--if BSM_Save.I.enabled then
if (BSM_Save.I.bars or BSM_Save.I.labels) and BSM_Save.I.overlay then
getglobal(BSM_BARS_LABELS):Show();
end
getglobal(BSM_DROPDOWNS_LABELS):Show();
BSM_updateFreeSlots();
--end
else
BSM_Save.I.showlabels = false;
getglobal(BSM_BARS_LABELS):Hide();
getglobal(BSM_DROPDOWNS_LABELS):Hide();
end
elseif name == "BSM_Check_IndvColor" then
if b:GetChecked() == 1 then
BSM_Save.I.color = true;
else
BSM_Save.I.color = false;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_IndvTotals" then
if b:GetChecked() == 1 then
BSM_Save.I.totals = true;
else
BSM_Save.I.totals = false;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_IndvSlots" then
if b:GetChecked() == 1 then
BSM_Save.I.slots = BSM_SLOTS_FREE;
else
BSM_Save.I.slots = BSM_SLOTS_USED;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_Overall" then
BSM_Chk_Overall(b);
elseif name == "BSM_Check_Title" then
if b:GetChecked() == 1 then
BSM_Save.O.title = true;
--if BSM_Save.O.enabled then
getglobal("BSM_FrameButtonLabel"):Show();
--end
else
BSM_Save.O.title = false;
getglobal("BSM_FrameButtonLabel"):Hide();
end
elseif name == "BSM_Check_Back" then
if b:GetChecked() == 1 then
BSM_Save.O.back = true;
--if BSM_Save.O.enabled then
getglobal(BSM_FRAME.."BackAlpha"):Show();
getglobal(BSM_FRAME.."Border"):Show();
BSM_FrameStatus:Show();
--end
else
BSM_Save.O.back = false;
getglobal(BSM_FRAME.."BackAlpha"):Hide();
getglobal(BSM_FRAME.."Border"):Hide();
BSM_FrameStatus:Hide();
end
elseif name == "BSM_Check_OverallLabels" then
if b:GetChecked() == 1 then
BSM_Save.O.showlabels = true;
--if BSM_Save.O.enabled then
getglobal("BSM_FrameText"):Show();
BSM_updateFreeSlots();
--end
else
BSM_Save.O.showlabels = false;
getglobal("BSM_FrameText"):Hide();
end
elseif name == "BSM_Check_OverallColor" then
if b:GetChecked() == 1 then
BSM_Save.O.color = true;
else
BSM_Save.O.color = false;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_OverallTotals" then
if b:GetChecked() == 1 then
BSM_Save.O.totals = true;
else
BSM_Save.O.totals = false;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_OverallSlots" then
if b:GetChecked() == 1 then
BSM_Save.O.slots = BSM_SLOTS_FREE;
else
BSM_Save.O.slots = BSM_SLOTS_USED;
end
BSM_updateFreeSlots();
elseif name == "BSM_Check_OverallLock" then
if b:GetChecked() == 1 then
BSM_Save.O.lock = true;
else
BSM_Save.O.lock = false;
end
elseif name == "BSM_Check_Notify" then
if b:GetChecked() == 1 then
BSM_Save.notify = true;
else
BSM_Save.notify = false;
end
elseif name == "BSM_Check_OptionsButton" then
if b:GetChecked() == 1 then
BSM_Save.optbutton = true;
getglobal("BSM_OptionsButton"):Show();
else
BSM_Save.optbutton = false;
getglobal("BSM_OptionsButton"):Hide();
end
end
end
--BSM_SetPosition:
-- Purpose - Sets the position of the Overall Meter frame according to what is in the X/Y text boxes in the Options frame
-- Parameters - None
-- Returns - Nothing
function BSM_SetPosition()
local x, y;
--convert the text in the text boxes to numbers
x = tonumber(getglobal("BSM_Options_PositionX"):GetText());
y = tonumber(getglobal("BSM_Options_PositionY"):GetText());
--if the text converted correctly to a number, set the position of the Overall Meter
if x then
BSM_Save.dispX = x;
end
if y then
BSM_Save.dispY = y;
end
getglobal(BSM_FRAME):ClearAllPoints();
getglobal(BSM_FRAME):SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", BSM_Save.dispX, BSM_Save.dispY);
end
--BSM_openBag:
-- Purpose - Opens the appropriate bag when hitting a key binding button
-- Parameters - b: the button that was pressed
-- Returns - Nothing
function BSM_openBag(b)
--name: the name of the button that was pressed
local name = b:GetName();
--Find the number in the button's name
name = string.sub( name, string.len(BSM_DROPDOWNS)+1, string.len(BSM_DROPDOWNS)+1 );
--Convert the number string to an actual number and toggle that bag
ToggleBag( tonumber(name) );
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -