Mercurial > wow > reaction
diff ReAction.lua @ 33:c54c481ad0ed
- Moved bar control frame from ConfigUI to Bar
- Added LICENSE.txt
- added profile management options
- other minor cleanup
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 03 Apr 2008 20:25:40 +0000 |
parents | 0d95ce7a9ec2 |
children | 52ac6db0c8ca |
line wrap: on
line diff
--- a/ReAction.lua Thu Apr 03 16:59:16 2008 +0000 +++ b/ReAction.lua Thu Apr 03 20:25:40 2008 +0000 @@ -1,18 +1,14 @@ -- ReAction.lua -- See modules/ReAction_ModuleTemplate for Module API listing -- See Bar.lua for Bar object listing -local MAJOR_VERSION = GetAddOnMetadata("ReAction","Version") - ------- LIBRARIES ------ -local L = LibStub("AceLocale-3.0"):GetLocale("ReAction") ------ CORE ------ local ReAction = LibStub("AceAddon-3.0"):NewAddon( "ReAction", - "AceConsole-3.0" + "AceConsole-3.0", + "AceEvent-3.0" ) -ReAction.revision = tonumber(("$Revision: 1 $"):match("%d+")) -ReAction.version = MAJOR_VERSION -ReAction.L = L +ReAction.version = GetAddOnMetadata("ReAction","Version") +ReAction.revision = tonumber(("$Revision$"):match("%d+")) ------ GLOBALS ------ _G["ReAction"] = ReAction @@ -28,6 +24,10 @@ ReAction.print = function() end end +------ LIBRARIES ------ +local L = LibStub("AceLocale-3.0"):GetLocale("ReAction") +ReAction.L = L + ------ PRIVATE ------ local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, SafeCall, CheckMethod, SlashHandler do @@ -112,25 +112,25 @@ end local function CallOptsModule(method,...) - local m = ReAction:GetModule("ConfigUI",true) - if not m then - LoadAddOn("ReAction_ConfigUI") - m = ReAction:GetModule("ConfigUI") - end - if m and type(m) == "table" and type(m[method]) == "function" then - m[method](m,...) - else - ReAction:Print("Options module not found") - end + local m = ReAction:GetModule("ConfigUI",true) + if not m then + LoadAddOn("ReAction_ConfigUI") + m = ReAction:GetModule("ConfigUI") + end + if m and type(m) == "table" and type(m[method]) == "function" then + m[method](m,...) + else + ReAction:Print("Options module not found") + end end SlashHandler = function(option) if option == "config" then CallOptsModule("OpenConfig",true) elseif option == "unlock" then - CallOptsModule("SetConfigMode",true) + ReAction:SetConfigMode(true) elseif option == "lock" then - CallOptsModule("SetConfigMode",false) + ReAction:SetConfigMode(false) else ReAction:Print(ReAction.version) ReAction:Print("/reaction config") @@ -156,6 +156,7 @@ self.callbacks = LibStub("CallbackHandler-1.0"):New(self) self:RegisterChatCommand("reaction", SlashHandler) self:RegisterChatCommand("rxn", SlashHandler) + self:RegisterEvent("PLAYER_REGEN_DISABLED") self.bars = {} end @@ -169,8 +170,8 @@ end function ReAction:OnProfileChanged() - self.TearDownBars() - self.InitializeBars() + TearDownBars() + InitializeBars() end function ReAction:OnModuleEnable(module) @@ -193,6 +194,14 @@ end end +function ReAction:PLAYER_REGEN_DISABLED() + if self.configMode == true then + UIErrorsFrame:AddMessage(L["ReAction config mode disabled during combat."]) + self:SetConfigMode(false) + end +end + + ------ API ------ function ReAction:CallMethodOnAllModules(method, ...) @@ -229,6 +238,10 @@ self:CallMethodOnAllModules("ApplyToBar", bar) self.bars[name] = bar self.callbacks:Fire("OnCreateBar", bar) + if self.configMode then + bar:ShowControls(true) + end + return bar end @@ -295,3 +308,9 @@ function ReAction:RefreshOptions() self.callbacks:Fire("OnOptionsRefreshed") end + +function ReAction:SetConfigMode( mode ) + self:CallMethodOnAllBars("ShowControls",mode) + self:CallMethodOnAllModules("ApplyConfigMode",mode,self.bars) + self.configMode = mode +end