Skip to content

Commit

Permalink
Cata Classic Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NinerBull committed Sep 25, 2024
1 parent 3ae4fae commit d4f7e90
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 17 deletions.
64 changes: 52 additions & 12 deletions BlockBlizzChatChannels/BlockBlizzChatChannels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ local function OnSettingChanged(_, setting, value)
BlockBlizzChatChannels_Frame.CheckForChatBlock()
end


BlockBlizzChatChannels_UseNewRegisterSetting = true

if ((select(4, GetBuildInfo())) == 40400) then
BlockBlizzChatChannels_UseNewRegisterSetting = false
end




BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, arg2)

if (event == "ADDON_LOADED" and arg1 == "BlockBlizzChatChannels") then
Expand Down Expand Up @@ -47,7 +57,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = false
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -56,7 +66,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end

do
Expand All @@ -66,7 +81,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = false
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -75,7 +90,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end

-- Services channel only exists in Retail
Expand All @@ -87,7 +107,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = true
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -96,7 +116,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end
end

Expand All @@ -107,7 +132,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = false
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -116,7 +141,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end

-- WorldDefense channel is only in Classic
Expand All @@ -128,7 +158,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = false
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -137,7 +167,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end
end

Expand All @@ -148,7 +183,7 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
local defaultValue = false
local setting = nil

if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
-- New Style of Tickbox
setting = Settings.RegisterAddOnSetting(category, variable, variable, BlockBlizzChatChannelsData, type(defaultValue), name, (BlockBlizzChatChannelsData[variable] or defaultValue))
else
Expand All @@ -157,7 +192,12 @@ BlockBlizzChatChannels_Frame:SetScript("OnEvent", function(self, event, arg1, ar
end

Settings.SetOnValueChangedCallback(variable, OnSettingChanged)
Settings.CreateCheckbox(category, setting, tooltip)

if (BlockBlizzChatChannels_UseNewRegisterSetting == true) then
Settings.CreateCheckbox(category, setting, tooltip)
else
Settings.CreateCheckBox(category, setting, tooltip)
end
end

do
Expand Down
4 changes: 2 additions & 2 deletions BlockBlizzChatChannels/BlockBlizzChatChannels.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 110002, 40400, 11503
## Interface: 110002, 110005, 40400, 40401, 11504
## Title: Block Blizzard Chat Channels
## Version: 1.0.3
## Version: 1.0.4
## Notes: Prevent all characters on your account from joining various default chat channels. /blockblizzchatchannels
## Author: ConineSpiritwolf
## SavedVariables: BlockBlizzChatChannelsData
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ This addon allows you to prevent all of your characters on your account from joi


## Compatibility
* **The War Within** - 11.0.2
* **Cataclysm Classic** - 4.4.0
* **Classic Era** - 1.15.3
* **The War Within** - 11.0.2 & 11.0.5
* **Cataclysm Classic** - 4.4.0 & 4.4.1
* **Classic Era** - 1.15.4


## Installation
Expand Down

0 comments on commit d4f7e90

Please sign in to comment.