--Texture registering
local surface = AceLibrary("Surface-1.0")
surface:Register("Otravi", "Interface\\AddOns\\FuBar_WarlockTimerFu\\Textures\\otravi")
surface:Register("Smooth", "Interface\\AddOns\\FuBar_WarlockTimerFu\\Textures\\smooth")
surface:Register("Glaze", "Interface\\AddOns\\FuBar_WarlockTimerFu\\Textures\\glaze")
surface:Register("Charcoal", "Interface\\AddOns\\FuBar_WarlockTimerFu\\Textures\\Charcoal")
surface:Register("BantoBar", "Interface\\AddOns\\FuBar_WarlockTimerFu\\Textures\\default")

--Locals  
local L = AceLibrary("AceLocale-2.2"):new("WarlockTimerFu")
 
--Ace2 Registering
WarlockTimerFu = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceEvent-2.0", "AceDB-2.0", "FuBarPlugin-2.0", "CandyBar-2.0")
WarlockTimerFu.defaults = { rules = {}, bars = {}}
--Mod Options
WarlockTimerFu.Menu = { 
    type ="group",
    args = {
		[L["Bars To Show"]] = {
			type = "header",
			name = L["Bars To Show"],
			order = 1,
		},
		["spacer1"] = {
			type = "header",
			name = " ",
			order = 10,
		},
	},
} 

function WarlockTimerFu:OnInitialize()
--Revision 
self.revision = tonumber(string.sub("$Rev: 30601 $", 7, -3))
self.version = self.version .. " |cffff8888r"..self.revision.."|r"
--Saved Information
self:RegisterDB("WarlockTimerFuDB")
self:RulesInit()
local playerClass, englishClass = UnitClass("player");
	if (englishClass == "WARLOCK") then
	self:ToggleActive(true)
	else
	self:ToggleActive(false)
end
self:RegisterChatCommand({"/WarlockTimerFu", "/wtf"}, self.Menu)
self:RegisterDefaults("profile", self.defaults)
end

function WarlockTimerFu:OnEnable()
self:BarSetup()
self:RulesSetup()
end

function WarlockTimerFu:OnDisable()
parser:UnregisterAllEvents("WarlockTimerFu")
end
 
--FuBar Stuff
WarlockTimerFu.OnMenuRequest = WarlockTimerFu.Menu
WarlockTimerFu.hasNoColor = true
WarlockTimerFu.hasIcon = "Interface\\Icons\\Spell_Shadow_Cripple"
WarlockTimerFu.defaultMinimapPosition = 180
WarlockTimerFu.cannotDetachTooltip = true
WarlockTimerFu.hideWithoutStandby = true 