Mercurial > wow > momit-suicide-kings
comparison SuicideKings.lua @ 3:a55f4f2a4603 tip
intial (real) commit!
| author | Kyle@Kyle-PC |
|---|---|
| date | Thu, 23 Feb 2012 00:34:43 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2:37321677b4d9 | 3:a55f4f2a4603 |
|---|---|
| 1 --[[ | |
| 2 Title: Suicide Kings | |
| 3 Author: Brom | |
| 4 Version: 0.1 | |
| 5 ]] | |
| 6 | |
| 7 local ADDON_NAME = ... | |
| 8 local ADDON_VERSION = "0.1" | |
| 9 | |
| 10 -- create addon | |
| 11 SuicideKings = LibStub("AceAddon-3.0") : NewAddon("SuicideKings", "AceConsole-3.0") | |
| 12 | |
| 13 -- library objects | |
| 14 local libS = LibStub:GetLibrary("AceSerializer-3.0") | |
| 15 local libC = LibStub:GetLibrary("LibCompress") | |
| 16 local libCE = libC:GetAddonEncodeTable() | |
| 17 | |
| 18 -- creating a database object | |
| 19 local db; | |
| 20 | |
| 21 --[[ | |
| 22 Ace3 Addon Object | |
| 23 ]] | |
| 24 | |
| 25 function SuicideKings:OnInitialize() | |
| 26 | |
| 27 -- Greetings | |
| 28 local loadingMessage = "version " .. ADDON_VERSION .. " loaded" | |
| 29 local optionsMessage = "type /sk for options" | |
| 30 SuicideKings:Print( loadingMessage ) | |
| 31 SuicideKings:Print( optionsMessage ) | |
| 32 | |
| 33 -- Slash commands | |
| 34 SuicideKings:RegisterChatCommand( "sk", "SlashProcessor" ) | |
| 35 | |
| 36 -- Database defaults | |
| 37 self.db = LibStub("AceDB-3.0"):New("SuicideKingsDB", { profile = {} }, 'Default') | |
| 38 | |
| 39 -- Options | |
| 40 LibStub("AceConfig-3.0"): RegisterOptionsTable("SuicideKingsOptions", { | |
| 41 name = "Brohm's Suicide Kings Configuration", | |
| 42 type = "group", | |
| 43 args = { | |
| 44 roster = { | |
| 45 name = "View Roster", | |
| 46 desc = "Prints the SK Roster", | |
| 47 type = "execute", | |
| 48 func = function() SuicideKings:PrintRoster() end, | |
| 49 }, | |
| 50 list = { | |
| 51 name = "View Lists", | |
| 52 desc = "Prints the SK Lists", | |
| 53 type = "execute", | |
| 54 func = function() SuicideKings:PrintLists() end, | |
| 55 }, | |
| 56 | |
| 57 utilities = { | |
| 58 name = "utilities", | |
| 59 desc = "Utility functions", | |
| 60 type = "group", | |
| 61 args = { | |
| 62 import = { | |
| 63 name = "Import from KSK", | |
| 64 desc = "Import data from Konfer Suicide Kings", | |
| 65 type = "execute", | |
| 66 func = function() SuicideKings:ImportFromKSK() end, | |
| 67 }, | |
| 68 reset = { | |
| 69 name = "Reset Everything", | |
| 70 desc = "Resets the database", | |
| 71 type = "execute", | |
| 72 func = function() self.db:ResetProfile() end, | |
| 73 }, | |
| 74 } | |
| 75 } | |
| 76 } | |
| 77 }) | |
| 78 | |
| 79 end | |
| 80 | |
| 81 function SuicideKings:OnEnable() | |
| 82 -- Do more initialization here, that really enables the use of your addon. | |
| 83 -- Register Events, Hook functions, Create Frames, Get information from | |
| 84 -- the game that wasn't available in OnInitialize | |
| 85 end | |
| 86 | |
| 87 function SuicideKings:OnDisable() | |
| 88 -- Unhook, Unregister Events, Hide frames that you created. | |
| 89 -- You would probably only use an OnDisable if you want to | |
| 90 -- build a "standby" mode, or be able to toggle modules on/off. | |
| 91 end | |
| 92 | |
| 93 --[[ | |
| 94 Slash Handler | |
| 95 ]] | |
| 96 | |
| 97 function SuicideKings:SlashProcessor(input) | |
| 98 | |
| 99 if not input or input:trim() == "" then | |
| 100 LibStub("AceConfigDialog-3.0"):Open("SuicideKingsOptions") | |
| 101 else | |
| 102 LibStub("AceConfigCmd-3.0").HandleCommand(MyAddon, "sk", "SuicideKingsOptions", input) | |
| 103 end | |
| 104 | |
| 105 end | |
| 106 | |
| 107 --[[ | |
| 108 Roster Functions | |
| 109 ]] | |
| 110 | |
| 111 function SuicideKings:PrintHelp() | |
| 112 | |
| 113 SuicideKings:Print("usage: /sk") | |
| 114 | |
| 115 end | |
| 116 | |
| 117 function SuicideKings:PrintRoster() | |
| 118 | |
| 119 local one = libS:Serialize( self.db.profile.roster ) | |
| 120 local two = LibSyncC:CompressHuffman(one) | |
| 121 local final = LibSyncCE:Encode(two) | |
| 122 | |
| 123 end | |
| 124 | |
| 125 function SuicideKings:PrintLists() | |
| 126 | |
| 127 end | |
| 128 |
