Mercurial > wow > itemauditor
view Modules/Options.lua @ 7:bbba2fae0f69
Removed some of the extra debugging that isn't neccessary any more and abtracted out the item ids so they can be cached.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Tue, 08 Jun 2010 11:19:16 -0700 |
parents | bbcf81868171 |
children | 6a6296dd249f |
line wrap: on
line source
local addonName, addonTable = ...; local addon = _G[addonName] local utils = addonTable.utils local options = { name = "ItemAuditor", handler = addon, type = 'group', args = { debug = { type = "toggle", name = "Debug", desc = "Toggles debug messages in chat", handler = utils, get = "GetDebug", set = "SetDebug" }, dump = { type = "execute", name = "dump", desc = "dumps IA database", func = "DumpInfo", }, options = { type = "execute", name = "options", desc = "Show Blizzard's options GUI", func = "ShowOptionsGUI", guiHidden = true, }, }, } function addon:RegisterOptions() self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor") LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", options, {"ia"}) end local function pairsByKeys (t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end function addon:DumpInfo() for itemName, value in pairsByKeys(self.db.factionrealm.item_account) do self:Print(itemName .. ": " .. utils:FormatMoney(value)) end end function addon:ShowOptionsGUI() InterfaceOptionsFrame_OpenToCategory(self.optionsFrame) end function addon:GetDebug(info) return self.db.char.debug end function addon:SetDebug(info, input) self.db.char.debug = input local value = "off" if input then value = "on" end self:Print("Debugging is now: " .. value) end