function cha:CHACHING_InitializeOptions()
local versionString = string.format(L["ADDON_NAME_AND_VERSION"])
local ConfigurationPanel = CreateFrame("FRAME","CHACHING_MainFrame")
ConfigurationPanel.name = L["ADDON_NAME"]
InterfaceOptions_AddCategory(ConfigurationPanel) -- Register the Configuration panel with LibUIDropDownMenu
-- Print a header at the top of the panel
local IntroMessageHeader = ConfigurationPanel:CreateFontString(nil, "ARTWORK","GameFontNormalLarge")
IntroMessageHeader:SetPoint("TOPLEFT", 10, -10)
IntroMessageHeader:SetText(versionString)
local AuthorSubHeader = ConfigurationPanel:CreateFontString(nil, "ARTWORK","GameFontNormal")
AuthorSubHeader:SetPoint("TOPLEFT", 20, -30)
AuthorSubHeader:SetText("Author: Shadowraith@Feathermoon")
local DescrSubHeader = ConfigurationPanel:CreateFontString(nil, "ARTWORK","GameFontNormalLarge")
DescrSubHeader:SetPoint("TOPLEFT", 20, -50)
DescrSubHeader:SetText("Enables the bulk selling of selected items in player's inventory.")
-- Create two check buttons: one to sell grey iterms and one to sell white items
local GreyQualityButton = CreateFrame("CheckButton", "CHACHING_GreyQualityButton", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
GreyQualityButton:SetPoint("TOPLEFT", 20, -80)
GreyQualityButton.tooltip = "Check to sell all poor (grey) items in your inventory."
getglobal(GreyQualityButton:GetName().."Text"):SetText("Sell Grey Items?")
GreyQualityButton:SetScript("OnClick",
function()
local isChecked = GreyQualityButton:GetChecked()
if isChecked then
sellGrey = true -- 1
else
sellGrey = false
end
end )
local WhiteQualityButton = CreateFrame("CheckButton", "CHACHING_WhiteQualityButton", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
WhiteQualityButton:SetPoint("TOPLEFT", 200, -80)
WhiteQualityButton.tooltip = L["TOOLTIP_CHECK_WHITE_BTN"]
getglobal(WhiteQualityButton:GetName().."Text"):SetText("Sell White Items (Only Armor and Weapons?")
WhiteQualityButton:SetScript("OnClick",
function()
local isChecked = WhiteQualityButton:GetChecked()
if isChecked then
sellWhite = true
else
sellWhite = false
end
end )
-- SELECT BAG BUTTONS
local Bags = ConfigurationPanel:CreateFontString(nil, "ARTWORK","GameFontNormal")
Bags:SetPoint("TOPLEFT", 20, -200)
Bags:SetText("Select a bag. All items in the selected bag will be sold!")
local checkBoxLabel = nil
local xpos = 20
local ypos = -215
local delta_y = -20
--**************************************************************************************************************************
-- BAG 1 (The player's backpack) will ALWAYS be present and available
--**************************************************************************************************************************
local bagOne = bg:getBag(0)
checkBoxLabel = string.format("Bag[1] - %s", bagOne:getName() )
local BagButtonOne = CreateFrame("CheckButton", "CHACHING_BagButtonOne", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
BagButtonOne:SetPoint("TOPLEFT", xpos, ypos)
getglobal(BagButtonOne:GetName().."Text"):SetText(checkBoxLabel)
BagButtonOne:SetScript("OnClick",
function()
local isChecked = BagButtonOne:GetChecked()
if isChecked then
isBagChecked[BAG1] = true
else
isBagChecked[BAG1] = false
end
end )
--***************************************************************************************************************************
-- BAG 2
--***************************************************************************************************************************
local bagTwo = bg:getBag(1)
if bagTwo ~= nil then
checkBoxLabel = string.format("Bag[2] - %s", bagTwo:getName())
ypos = ypos + delta_y
local BagButtonTwo = CreateFrame("CheckButton", "CHACHING_BagButtonTwo", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
BagButtonTwo:SetPoint("TOPLEFT", xpos, ypos)
getglobal(BagButtonTwo:GetName().."Text"):SetText(checkBoxLabel)
BagButtonTwo:SetScript("OnClick",
function()
if bagTwo ~= nil then
local isChecked = BagButtonTwo:GetChecked()
if isChecked then
isBagChecked[BAG2] = true
else
isBagChecked[BAG2] = false
end
end
end )
end
--**************************************************************************************************************************
-- BAG 3
--**************************************************************************************************************************
local bagThree = bg:getBag(2)
if bagThree ~= nil then
checkBoxLabel = string.format("Bag[3] - %s", bagThree:getName())
ypos = ypos + delta_y
local BagButtonThree = CreateFrame("CheckButton", "CHACHING_BagButtonThree", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
BagButtonThree:SetPoint("TOPLEFT", xpos, ypos)
getglobal(BagButtonThree:GetName().."Text"):SetText(checkBoxLabel)
BagButtonThree:SetScript("OnClick",
function()
local isChecked = BagButtonThree:GetChecked()
if isChecked then
isBagChecked[BAG3] = true
else
isBagChecked[BAG3] = false
end
end )
end
--**************************************************************************************************************************
-- BAG 4
--**************************************************************************************************************************
local bagFour = bg:getBag(3)
if bagFour ~= nil then
checkBoxLabel = string.format("Bag[4] - %s", bagFour:getName())
ypos = ypos + delta_y
local BagButtonFour = CreateFrame("CheckButton", "CHACHING_BagButtonFour", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
BagButtonFour:SetPoint("TOPLEFT", xpos, ypos)
local txt = string.format("Bag[4] - %s", bagFour:getName() )
getglobal(BagButtonFour:GetName().."Text"):SetText(txt)
BagButtonFour:SetScript("OnClick",
function()
local isChecked = BagButtonFour:GetChecked()
if isChecked then
isBagChecked[BAG4] = true
else
isBagChecked[BAG4] = false
end
end )
end
--**************************************************************************************************************************
-- BAG 5
--**************************************************************************************************************************
local bagFive = bg:getBag(4)
if bagFive ~= nil then
checkBoxLabel = string.format("Bag[5] - %s", bagFive:getName())
ypos = ypos + delta_y
local BagButtonFive = CreateFrame("CheckButton", "CHACHING_BagButtonFive", ConfigurationPanel, "ChatConfigCheckButtonTemplate")
BagButtonFive:SetPoint("TOPLEFT", xpos, ypos)
getglobal(BagButtonFive:GetName().."Text"):SetText(checkBoxLabel)
BagButtonFive:SetScript("OnClick",
function()
local isChecked = BagButtonFive:GetChecked()
if isChecked then
isBagChecked[BAG5] = true
else
isBagChecked[BAG5] = false
end
end )
end
local readmeMsg1 = string.format(" *** IMPORTANT *** \n")
local readmeMsg2 = string.format("The merchant buyback window only has 12 slots. However, the merchant\n")
local readmeMsg3 = string.format("will buy as many items as Cha-Ching is configured to sell. So, if more\n")
local readmeMsg4 = string.format("than 12 items were sold, you will only be able to buyback the last 12\n")
local ReadmeMessageTitle = ConfigurationPanel:CreateFontString(nil, "ARTWORK","GameFontNormalLarge")
ReadmeMessageTitle:SetPoint("TOPLEFT", 10, -280)
ReadmeMessageTitle:SetText(readmeMsg1..readmeMsg2..readmeMsg3..readmeMsg4 )
end