Mercurial > wow > momit-suicide-kings
view SuicideKings.lua @ 3:a55f4f2a4603 tip
intial (real) commit!
author | Kyle@Kyle-PC |
---|---|
date | Thu, 23 Feb 2012 00:34:43 -0500 |
parents | |
children |
line wrap: on
line source
--[[ Title: Suicide Kings Author: Brom Version: 0.1 ]] local ADDON_NAME = ... local ADDON_VERSION = "0.1" -- create addon SuicideKings = LibStub("AceAddon-3.0") : NewAddon("SuicideKings", "AceConsole-3.0") -- library objects local libS = LibStub:GetLibrary("AceSerializer-3.0") local libC = LibStub:GetLibrary("LibCompress") local libCE = libC:GetAddonEncodeTable() -- creating a database object local db; --[[ Ace3 Addon Object ]] function SuicideKings:OnInitialize() -- Greetings local loadingMessage = "version " .. ADDON_VERSION .. " loaded" local optionsMessage = "type /sk for options" SuicideKings:Print( loadingMessage ) SuicideKings:Print( optionsMessage ) -- Slash commands SuicideKings:RegisterChatCommand( "sk", "SlashProcessor" ) -- Database defaults self.db = LibStub("AceDB-3.0"):New("SuicideKingsDB", { profile = {} }, 'Default') -- Options LibStub("AceConfig-3.0"): RegisterOptionsTable("SuicideKingsOptions", { name = "Brohm's Suicide Kings Configuration", type = "group", args = { roster = { name = "View Roster", desc = "Prints the SK Roster", type = "execute", func = function() SuicideKings:PrintRoster() end, }, list = { name = "View Lists", desc = "Prints the SK Lists", type = "execute", func = function() SuicideKings:PrintLists() end, }, utilities = { name = "utilities", desc = "Utility functions", type = "group", args = { import = { name = "Import from KSK", desc = "Import data from Konfer Suicide Kings", type = "execute", func = function() SuicideKings:ImportFromKSK() end, }, reset = { name = "Reset Everything", desc = "Resets the database", type = "execute", func = function() self.db:ResetProfile() end, }, } } } }) end function SuicideKings:OnEnable() -- Do more initialization here, that really enables the use of your addon. -- Register Events, Hook functions, Create Frames, Get information from -- the game that wasn't available in OnInitialize end function SuicideKings:OnDisable() -- Unhook, Unregister Events, Hide frames that you created. -- You would probably only use an OnDisable if you want to -- build a "standby" mode, or be able to toggle modules on/off. end --[[ Slash Handler ]] function SuicideKings:SlashProcessor(input) if not input or input:trim() == "" then LibStub("AceConfigDialog-3.0"):Open("SuicideKingsOptions") else LibStub("AceConfigCmd-3.0").HandleCommand(MyAddon, "sk", "SuicideKingsOptions", input) end end --[[ Roster Functions ]] function SuicideKings:PrintHelp() SuicideKings:Print("usage: /sk") end function SuicideKings:PrintRoster() local one = libS:Serialize( self.db.profile.roster ) local two = LibSyncC:CompressHuffman(one) local final = LibSyncCE:Encode(two) end function SuicideKings:PrintLists() end