diff --git a/config.lua b/config.lua index d70ca18..7029158 100644 --- a/config.lua +++ b/config.lua @@ -78,6 +78,7 @@ end) settings.load = function(self) settings.entries = settings.entries or {} + local expansion = ShaguTweaks:GetExpansion() local entry = 1 for title, module in pairs(ShaguTweaks.mods) do @@ -113,7 +114,16 @@ settings.load = function(self) end) text:SetText(title) - entry = entry + 1 + if module.expansions[expansion] then + entry = entry + 1 + button:Enable() + text:SetTextColor(1,.8,0,1) + elseif ShaguTweaks.debug then + entry = entry + 1 + button:SetChecked(nil) + button:Disable() + text:SetTextColor(.5,.5,.5,.5) + end end settings:SetHeight(80 + math.floor(entry/2)*30) @@ -124,6 +134,7 @@ settings.defaults = function() for title, mod in pairs(ShaguTweaks.mods) do current_config[title] = mod.enabled and 1 or 0 end + settings:load() end diff --git a/main.lua b/main.lua index f57bfa3..1d5c4ff 100644 --- a/main.lua +++ b/main.lua @@ -18,9 +18,11 @@ ShaguTweaks.mods = {} -- load translation tables ShaguTweaks.L = (ShaguTweaks_locale[GetLocale()] or ShaguTweaks_locale["enUS"]) - ShaguTweaks:RegisterEvent("VARIABLES_LOADED") ShaguTweaks:SetScript("OnEvent", function() + -- load current expansion + local expansion = ShaguTweaks:GetExpansion() + -- initialize empty config if not ShaguTweaks_config then ShaguTweaks_config = {} end @@ -32,7 +34,7 @@ ShaguTweaks:SetScript("OnEvent", function() end -- load enabled mods - if ShaguTweaks_config[title] == 1 then + if mod.expansions[expansion] and ShaguTweaks_config[title] == 1 then mod:enable() end end diff --git a/mods/auto-dismount.lua b/mods/auto-dismount.lua index 98054dc..d1facdf 100644 --- a/mods/auto-dismount.lua +++ b/mods/auto-dismount.lua @@ -1,12 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - --- This is already part of the default options in TBC -if GetExpansion() == "tbc" then return end local module = ShaguTweaks:register({ title = "Auto Dismount", description = "Automatically dismounts whenever a spell is casted.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = nil, }) diff --git a/mods/auto-stance.lua b/mods/auto-stance.lua index fe89dae..7fccc29 100644 --- a/mods/auto-stance.lua +++ b/mods/auto-stance.lua @@ -1,13 +1,10 @@ local _G = _G or getfenv(0) local strsplit = ShaguTweaks.strsplit -local GetExpansion = ShaguTweaks.GetExpansion - --- It's not possible to achieve it like that in TBC -if GetExpansion() == "tbc" then return end local module = ShaguTweaks:register({ title = "Auto Stance", description = "Automatically switch to the required warrior or druid stance on spell cast.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = nil, }) diff --git a/mods/blue-shaman.lua b/mods/blue-shaman.lua index 6b2f667..b82e3da 100644 --- a/mods/blue-shaman.lua +++ b/mods/blue-shaman.lua @@ -1,12 +1,10 @@ local _G = _G or getfenv(0) local GetExpansion = ShaguTweaks.GetExpansion --- shaman class color is already blue in TBC -if GetExpansion() == "tbc" then return end - local module = ShaguTweaks:register({ title = "Blue Shaman Class Colors", description = "Changes the class color code of shamans to blue, as known from TBC+.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = true, }) diff --git a/mods/chat-links.lua b/mods/chat-links.lua index 51b5006..a42696a 100644 --- a/mods/chat-links.lua +++ b/mods/chat-links.lua @@ -10,6 +10,7 @@ local strsplit = ShaguTweaks.strsplit local module = ShaguTweaks:register({ title = "Chat Hyperlinks", description = "Copy website URLs from the chat, transforms CLINKs into real items and handles quest links.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, }) diff --git a/mods/chat-tweaks.lua b/mods/chat-tweaks.lua index eab7672..d618d9d 100644 --- a/mods/chat-tweaks.lua +++ b/mods/chat-tweaks.lua @@ -4,6 +4,7 @@ local scrollspeed = 1 local module = ShaguTweaks:register({ title = "Chat Tweaks", description = "Allows to scroll using the mouse wheel, enables sticky chat channels and repeats message on arrow up.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, }) diff --git a/mods/dark-ui-elements.lua b/mods/dark-ui-elements.lua index cce084b..8028e70 100644 --- a/mods/dark-ui-elements.lua +++ b/mods/dark-ui-elements.lua @@ -6,6 +6,7 @@ local AddBorder = ShaguTweaks.AddBorder local module = ShaguTweaks:register({ title = "Darkened UI", description = "Turns the entire interface into darker colors.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, color = { r = .3, g = .3, b = .3, a = .9} }) diff --git a/mods/equip-compare.lua b/mods/equip-compare.lua index 740a5bd..daa3400 100644 --- a/mods/equip-compare.lua +++ b/mods/equip-compare.lua @@ -1,12 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - --- already part of the game -if GetExpansion() ~= "vanilla" then return end local module = ShaguTweaks:register({ title = "Equip Compare", description = "Shows currently equipped items on tooltips while the shift key is pressed.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = true, }) diff --git a/mods/health-numbers.lua b/mods/health-numbers.lua index 163c85f..0d0e485 100644 --- a/mods/health-numbers.lua +++ b/mods/health-numbers.lua @@ -6,6 +6,7 @@ local vanilla = ShaguTweaks.GetExpansion() == "vanilla" or nil local module = ShaguTweaks:register({ title = "Real Health Numbers", description = "Estimates health numbers, and shows numbers on player, pet and target unit frames.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, }) diff --git a/mods/hide-errors.lua b/mods/hide-errors.lua index f51d41d..838fb8d 100644 --- a/mods/hide-errors.lua +++ b/mods/hide-errors.lua @@ -3,6 +3,7 @@ local _G = _G or getfenv(0) local module = ShaguTweaks:register({ title = "Hide Errors", description = "Hides and ignores all Lua errors produced by broken addons.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/item-colors.lua b/mods/item-colors.lua index 979ce37..65bf1a0 100644 --- a/mods/item-colors.lua +++ b/mods/item-colors.lua @@ -6,6 +6,7 @@ local HookAddonOrVariable = ShaguTweaks.HookAddonOrVariable local module = ShaguTweaks:register({ title = "Item Rarity Borders", description = "Show item rarity as the border color on bags, bank, character and inspect frames.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, }) diff --git a/mods/minimap-clock.lua b/mods/minimap-clock.lua index cab2cdc..a45b1cd 100644 --- a/mods/minimap-clock.lua +++ b/mods/minimap-clock.lua @@ -1,12 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - --- tbc already has a clock -if GetExpansion() ~= "vanilla" then return end local module = ShaguTweaks:register({ title = "MiniMap Clock", description = "Adds a small 24h clock to the mini map.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = nil, }) diff --git a/mods/minimap-square.lua b/mods/minimap-square.lua index 17e6dd5..89bc6af 100644 --- a/mods/minimap-square.lua +++ b/mods/minimap-square.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "MiniMap Square", description = "Draw the mini map in a squared shape instead of a round one.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/minimap-tweaks.lua b/mods/minimap-tweaks.lua index df85abe..7495f50 100644 --- a/mods/minimap-tweaks.lua +++ b/mods/minimap-tweaks.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "MiniMap Tweaks", description = "Hides unnecessary mini map buttons and allows to zoom using the mouse wheel.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/move-unitframes.lua b/mods/move-unitframes.lua index 2895422..45c606a 100644 --- a/mods/move-unitframes.lua +++ b/mods/move-unitframes.lua @@ -3,6 +3,7 @@ local _G = _G or getfenv(0) local module = ShaguTweaks:register({ title = "Movable Unit Frames", description = "Player and Target unit frames can be moved while and are pressed together.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/nameplate-classcolor.lua b/mods/nameplate-classcolor.lua index 28397df..3411cdd 100644 --- a/mods/nameplate-classcolor.lua +++ b/mods/nameplate-classcolor.lua @@ -4,6 +4,7 @@ local GetUnitData = ShaguTweaks.GetUnitData local module = ShaguTweaks:register({ title = "Nameplate Class Colors", description = "Changes the nameplate health bar color to the class color.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/nameplate-scale.lua b/mods/nameplate-scale.lua index 26ad11b..1df1dc0 100644 --- a/mods/nameplate-scale.lua +++ b/mods/nameplate-scale.lua @@ -1,12 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - --- tbc does not allow to rescale nameplates (secure_frames) -if GetExpansion() == "tbc" then return end local module = ShaguTweaks:register({ title = "Nameplate Scale", description = "Makes all nameplates honor the UI-Scale setting.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = true, }) diff --git a/mods/sell-junk.lua b/mods/sell-junk.lua index b76cbcc..71d5dab 100644 --- a/mods/sell-junk.lua +++ b/mods/sell-junk.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "Sell Junk", description = "Adds a “Sell Junk” button to every merchant window, that sells all grey items.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, }) diff --git a/mods/social-colors.lua b/mods/social-colors.lua index 95510c5..deb9b0d 100644 --- a/mods/social-colors.lua +++ b/mods/social-colors.lua @@ -12,6 +12,7 @@ local friendinfo = gsub(gsub(FRIENDS_LEVEL_TEMPLATE,"%%s","%%s %%s"),"%%d","%%s" local module = ShaguTweaks:register({ title = "Social Colors", description = "Show class colors in Who, Guild, Friends and Chat.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/target-castbar.lua b/mods/target-castbar.lua index 2a94d64..fe42645 100644 --- a/mods/target-castbar.lua +++ b/mods/target-castbar.lua @@ -3,14 +3,10 @@ local GetExpansion = ShaguTweaks.GetExpansion local UnitCastingInfo = ShaguTweaks.UnitCastingInfo local UnitChannelInfo = ShaguTweaks.UnitChannelInfo -local GetExpansion = ShaguTweaks.GetExpansion - --- TBC already has casting bars -if GetExpansion() ~= "vanilla" then return end - local module = ShaguTweaks:register({ title = "Enemy Castbars", description = "Shows an enemy castbar on target unit frame.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = true, }) diff --git a/mods/target-debufftimer.lua b/mods/target-debufftimer.lua index bc0ee3a..cf8910c 100644 --- a/mods/target-debufftimer.lua +++ b/mods/target-debufftimer.lua @@ -1,17 +1,14 @@ local _G = _G or getfenv(0) -local libdebuff = ShaguTweaks.libdebuff -local GetExpansion = ShaguTweaks.GetExpansion - --- there are already debuff timers in tbc+ -if GetExpansion() ~= "vanilla" then return end local module = ShaguTweaks:register({ title = "Debuff Timer", description = "Show debuff durations on the target unit frame.", + expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = true, }) -local UnitDebuff = ShaguTweaks.libdebuff.UnitDebuff +local libdebuff = ShaguTweaks.libdebuff +local UnitDebuff = libdebuff and libdebuff.UnitDebuff local function TimeConvert(remaining) local color = "|cffffffff" diff --git a/mods/tooltip-details.lua b/mods/tooltip-details.lua index a70a03e..1743075 100644 --- a/mods/tooltip-details.lua +++ b/mods/tooltip-details.lua @@ -6,6 +6,7 @@ local Abbreviate = ShaguTweaks.Abbreviate local module = ShaguTweaks:register({ title = "Tooltip Details", description = "Display health, class color, guild name, guild rank and current target on unit tooltips.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/unitframes-classcolor.lua b/mods/unitframes-classcolor.lua index eff659d..0df06c0 100644 --- a/mods/unitframes-classcolor.lua +++ b/mods/unitframes-classcolor.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "Unit Frame Class Colors", description = "Adds class colors to the player, target and party unit frames.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/vendor-values.lua b/mods/vendor-values.lua index cc132c3..ede1417 100644 --- a/mods/vendor-values.lua +++ b/mods/vendor-values.lua @@ -1,3 +1,13 @@ +local _G = _G or getfenv(0) +local GetExpansion = ShaguTweaks.GetExpansion + +local module = ShaguTweaks:register({ + title = "Vendor Values", + description = "Shows the vendor sell values on all item tooltips.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, + enabled = true, +}) + local data = { [25]=7, [35]=9, [36]=7, [37]=7, [38]=1, [39]=1, [40]=1, [43]=1, [44]=1, [45]=1, [47]=1, [48]=1, @@ -3735,15 +3745,6 @@ local data_tbc = { [38506]=25500, [38518]=37, [38576]=0, [38626]=2, [38628]=100000 } -local module = ShaguTweaks:register({ - title = "Vendor Values", - description = "Shows the vendor sell values on all item tooltips.", - enabled = true, -}) - -local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - if GetExpansion() == "tbc" then for k,v in pairs(data_tbc) do data[k] = v end end diff --git a/mods/worldmap-coordinates.lua b/mods/worldmap-coordinates.lua index 487d16a..3b021f4 100644 --- a/mods/worldmap-coordinates.lua +++ b/mods/worldmap-coordinates.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "WorldMap Coordinates", description = "Adds coordinates to the bottom of the World Map.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = nil, }) diff --git a/mods/worldmap-window.lua b/mods/worldmap-window.lua index 0bb64da..c64f5ba 100644 --- a/mods/worldmap-window.lua +++ b/mods/worldmap-window.lua @@ -1,9 +1,9 @@ local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion local module = ShaguTweaks:register({ title = "WorldMap Window", description = "Turns the world map into a movable window. The map can be scaled with + Mousewheel.", + expansions = { ["vanilla"] = true, ["tbc"] = true }, enabled = true, })