-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAuctionLite.lua
More file actions
85 lines (71 loc) · 2.92 KB
/
AuctionLite.lua
File metadata and controls
85 lines (71 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
-------------------------------------------------------------------------------
-- AuctionLite 1.6.4
--
-- Lightweight addon to determine accurate market prices and to simplify
-- the process of posting auctions.
--
-- Send suggestions, comments, and bugs to merial.kilrogg@gmail.com.
-------------------------------------------------------------------------------
-- Create our addon.
AuctionLite = LibStub("AceAddon-3.0"):NewAddon("AuctionLite",
"AceConsole-3.0",
"AceEvent-3.0",
"AceHook-3.0");
local L = LibStub("AceLocale-3.0"):GetLocale("AuctionLite", false)
local AUCTIONLITE_VERSION = "1.6.4";
-------------------------------------------------------------------------------
-- Hooks and boostrap code
-------------------------------------------------------------------------------
-- Hook some AH/GB functions and UI widgets when the AH/GB gets loaded.
function AuctionLite:ADDON_LOADED(_, name)
if name == "Blizzard_AuctionUI" then
self:RawHook("ChatEdit_InsertLink", "ChatEdit_InsertLink_Hook", true);
self:SecureHook("ContainerFrameItemButton_OnModifiedClick",
"ContainerFrameItemButton_OnModifiedClick_Hook");
self:SecureHook("AuctionFrameTab_OnClick",
"AuctionFrameTab_OnClick_Hook");
self:SecureHook("ClickAuctionSellItemButton",
"ClickAuctionSellItemButton_Hook");
self:SecureHook("QueryAuctionItems",
"QueryAuctionItems_Hook");
self:HookAuctionFrameUpdate();
self:AddAuctionFrameTabs();
elseif name == "Blizzard_GuildBankUI" then
self:HookBankTooltips();
end
end
-- We're alive!
function AuctionLite:OnInitialize()
-- Load our database.
self:ConvertDB();
self:LoadDB();
-- Update any options that have changed.
self:ConvertOptions();
-- Set up our config options.
self:InitConfig();
-- Register for events.
self:RegisterEvent("ADDON_LOADED");
self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE");
self:RegisterEvent("AUCTION_HOUSE_SHOW");
self:RegisterEvent("AUCTION_HOUSE_CLOSED");
-- Another addon may have forced the Blizzard addons to load early.
-- If so, just run the init code now.
if IsAddOnLoaded("Blizzard_AuctionUI") then
self:ADDON_LOADED("Blizzard_AuctionUI");
elseif IsAddOnLoaded("Blizzard_GuildBankUI") then
self:ADDON_LOADED("Blizzard_GuildBankUI");
end
-- Add any hooks that don't depend upon Blizzard addons.
self:HookCoroutines();
self:HookTooltips();
-- Add our chat message filter.
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(...)
return self:MessageEventFilter(...);
end);
-- Set up our disenchant info.
self:BuildDisenchantTable();
-- And print a message if we're debugging.
if self.db.profile.showGreeting then
self:Print(L["AuctionLite v%s loaded!"]:format(AUCTIONLITE_VERSION));
end
end