comparison Core.lua @ 11:10a2244f7ff0

Renamed addon from Inventory to Inventorium.
author Zerotorescue
date Tue, 12 Oct 2010 02:11:23 +0200
parents c4d0e5d47e10
children 5006cb0e97c6
comparison
equal deleted inserted replaced
10:c4d0e5d47e10 11:10a2244f7ff0
1 -- You can access this addon's object through: LibStub("AceAddon-3.0"):GetAddon("Inventory") 1 -- You can access this addon's object through: LibStub("AceAddon-3.0"):GetAddon("Inventorium")
2 local addon = LibStub("AceAddon-3.0"):NewAddon("Inventory", "AceEvent-3.0"); 2 local addon = LibStub("AceAddon-3.0"):NewAddon("Inventorium", "AceEvent-3.0");
3 3
4 local AceGUI = LibStub("AceGUI-3.0"); 4 local AceGUI = LibStub("AceGUI-3.0");
5 5
6 local Media = LibStub("LibSharedMedia-3.0"); 6 local Media = LibStub("LibSharedMedia-3.0");
7 Media:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]]); 7 Media:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]]);
54 characters = {}, 54 characters = {},
55 }, 55 },
56 }; 56 };
57 57
58 -- Register our saved variables database 58 -- Register our saved variables database
59 self.db = LibStub("AceDB-3.0"):New("InventoryDB", defaults, true); 59 self.db = LibStub("AceDB-3.0"):New("InventoriumDB", defaults, true);
60 60
61 -- SLASH COMMANDS 61 -- SLASH COMMANDS
62 62
63 -- Disable the AddonLoader slash commands 63 -- Disable the AddonLoader slash commands
64 SLASH_INVENTORY1 = nil; 64 SLASH_INVENTORIUM1 = nil;
65 SLASH_IY1 = nil; 65 SLASH_IY1 = nil;
66 66
67 -- Register our own slash commands 67 -- Register our own slash commands
68 SLASH_INVENTORY1 = "/inventory"; 68 SLASH_INVENTORIUM1 = "/inventorium";
69 SLASH_INVENTORY2 = "/iy"; 69 SLASH_INVENTORIUM2 = "/im";
70 SlashCmdList["INVENTORY"] = function(msg) 70 SlashCmdList["INVENTORIUM"] = function(msg)
71 self:CommandHandler(msg); 71 self:CommandHandler(msg);
72 end 72 end
73 73
74 -- INTERFACE OPTIONS 74 -- INTERFACE OPTIONS
75 75
76 -- Attempt to remove the interface options added by AddonLoader (if enabled) 76 -- Attempt to remove the interface options added by AddonLoader (if enabled)
77 if AddonLoader and AddonLoader.RemoveInterfaceOptions then 77 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
78 AddonLoader:RemoveInterfaceOptions("Inventory"); 78 AddonLoader:RemoveInterfaceOptions("Inventorium");
79 end 79 end
80 80
81 -- Now create our own options frame 81 -- Now create our own options frame
82 local frame = CreateFrame("Frame", nil, UIParent); 82 local frame = CreateFrame("Frame", nil, UIParent);
83 frame:Hide(); 83 frame:Hide();
84 frame.name = "Inventory"; 84 frame.name = "Inventorium";
85 frame:HookScript("OnShow", function(self) 85 frame:HookScript("OnShow", function(self)
86 -- Refresh the frame to instantly show the right options 86 -- Refresh the frame to instantly show the right options
87 InterfaceOptionsFrame_OpenToCategory(self.name) 87 InterfaceOptionsFrame_OpenToCategory(self.name)
88 end); 88 end);
89 -- And add it to the interface options 89 -- And add it to the interface options
296 print("New debug channel created."); 296 print("New debug channel created.");
297 end 297 end
298 elseif slashArgs[cmd] then 298 elseif slashArgs[cmd] then
299 slashArgs[cmd](); 299 slashArgs[cmd]();
300 else 300 else
301 print("Wrong command, available: /inventory config (or /iy c) and /inventory summary (or /iy s)"); 301 print("Wrong command, available: /inventorium config (or /im c) and /inventorium summary (or /im s)");
302 end 302 end
303 end 303 end
304 304
305 function addon:Load() 305 function addon:Load()
306 if not AceConfigDialog and not AceConfigRegistry then 306 if not AceConfigDialog and not AceConfigRegistry then
308 308
309 -- Build options dialog 309 -- Build options dialog
310 AceConfigDialog = LibStub("AceConfigDialog-3.0"); 310 AceConfigDialog = LibStub("AceConfigDialog-3.0");
311 AceConfigRegistry = LibStub("AceConfigRegistry-3.0"); 311 AceConfigRegistry = LibStub("AceConfigRegistry-3.0");
312 -- Register options table 312 -- Register options table
313 LibStub("AceConfig-3.0"):RegisterOptionsTable("InventoryOptions", options); 313 LibStub("AceConfig-3.0"):RegisterOptionsTable("InventoriumOptions", options);
314 -- Set a nice default size (so that 4 normal sized elements fit next to eachother) 314 -- Set a nice default size (so that 4 normal sized elements fit next to eachother)
315 AceConfigDialog:SetDefaultSize("InventoryOptions", 975, 600); 315 AceConfigDialog:SetDefaultSize("InventoriumOptions", 975, 600);
316 316
317 -- In case the addon is loaded from another condition, always call the remove interface options 317 -- In case the addon is loaded from another condition, always call the remove interface options
318 if AddonLoader and AddonLoader.RemoveInterfaceOptions then 318 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
319 AddonLoader:RemoveInterfaceOptions("Inventory"); 319 AddonLoader:RemoveInterfaceOptions("Inventorium");
320 end 320 end
321 321
322 -- Add to the blizzard addons options thing 322 -- Add to the blizzard addons options thing
323 --AceConfigDialog:AddToBlizOptions("InventoryOptions"); 323 --AceConfigDialog:AddToBlizOptions("InventoriumOptions");
324 end 324 end
325 end 325 end
326 326
327 function addon:Show() 327 function addon:Show()
328 self:Load(); 328 self:Load();
329 329
330 AceConfigDialog:Open("InventoryOptions"); 330 AceConfigDialog:Open("InventoriumOptions");
331 end 331 end
332 332
333 function addon:FillOptions() 333 function addon:FillOptions()
334 options = { 334 options = {
335 type = "group", 335 type = "group",
336 name = "Inventory", 336 name = "Inventorium",
337 childGroups = "tree", 337 childGroups = "tree",
338 args = { 338 args = {
339 }, 339 },
340 }; 340 };
341 341
408 function addon:FillGeneralOptions() 408 function addon:FillGeneralOptions()
409 options.args.general = { 409 options.args.general = {
410 order = 100, 410 order = 100,
411 type = "group", 411 type = "group",
412 name = "General", 412 name = "General",
413 desc = "Change general Inventory settings.", 413 desc = "Change general Inventorium settings.",
414 args = { 414 args = {
415 general = { 415 general = {
416 order = 0, 416 order = 0,
417 type = "group", 417 type = "group",
418 inline = true, 418 inline = true,
781 781
782 -- Set this item 782 -- Set this item
783 addon.db.global.groups[groupName].items[itemId] = true; 783 addon.db.global.groups[groupName].items[itemId] = true;
784 784
785 -- Now rebuild the list 785 -- Now rebuild the list
786 AceConfigRegistry:NotifyChange("InventoryOptions"); 786 AceConfigRegistry:NotifyChange("InventoriumOptions");
787 787
788 return true; 788 return true;
789 end 789 end
790 790
791 local tblAddItemTemplate = { 791 local tblAddItemTemplate = {
831 831
832 -- Unset this item 832 -- Unset this item
833 addon.db.global.groups[groupName].items[itemId] = nil; 833 addon.db.global.groups[groupName].items[itemId] = nil;
834 834
835 -- Now rebuild the list 835 -- Now rebuild the list
836 AceConfigRegistry:NotifyChange("InventoryOptions"); 836 AceConfigRegistry:NotifyChange("InventoriumOptions");
837 end 837 end
838 end, 838 end,
839 width = "double", 839 width = "double",
840 dialogControl = "ConfigItemLinkButton", 840 dialogControl = "ConfigItemLinkButton",
841 }; 841 };