forked from rockingdice/AutoCategory
-
Notifications
You must be signed in to change notification settings - Fork 6
/
AutoCategory_Global.lua
executable file
·68 lines (57 loc) · 2.08 KB
/
AutoCategory_Global.lua
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
AC_BAG_TYPE_BACKPACK = 1
AC_BAG_TYPE_BANK = 2
AC_BAG_TYPE_GUILDBANK = 3
AC_BAG_TYPE_CRAFTBAG = 4
AC_BAG_TYPE_CRAFTSTATION = 5
AC_BAG_TYPE_HOUSEBANK = 6
local SF = LibSFUtils
AutoCategory = {
name = "AutoCategory",
version = "4.1.8",
settingName = "AutoCategory",
settingDisplayName = "AutoCategory - Revised",
author = "Shadowfen, crafty35, RockingDice, Friday_the13_rus",
}
AutoCategory.settingDisplayName = SF.colors.gold:Colorize(AutoCategory.settingDisplayName)
AutoCategory.version = SF.colors.gold:Colorize(AutoCategory.version)
AutoCategory.author = SF.colors.purple:Colorize(AutoCategory.author)
AutoCategory.RuleFunc = {}
AutoCategory.Plugins = {}
AutoCategory.Inited = false
AutoCategory.Enabled = true
-- load in localization strings
SF.LoadLanguage(AutoCategory_localization_strings, "en")
--[[
An implementation of a logger which uses the lua print function
to output the messages.
Generally used for out-of-game testing.
--]]
local printLibDebug = {
Error = function(self,...) print("ERROR: "..string.format(...)) end,
Warn = function(self,...) print("WARN: "..string.format(...)) end,
Info = function(self,...) print("INFO: "..string.format(...)) end,
Debug = function(self,...) print("DEBUG: "..string.format(...)) end,
}
setmetatable(printLibDebug, { __call = function(self, name)
self.addonName = name
return self
end
})
-- initialize the logger for AutoCategory
AutoCategory.logger = printLibDebug
-- checks the versions of libraries (where possible) and warn in
-- debug logger if we detect out of date libraries.
function AutoCategory.checkLibraryVersions()
if not LibDebugLogger then return end
local addonName = AutoCategory.name
local vc = SF.VersionChecker(addonName)
local logger = LibDebugLogger.Create(addonName)
vc:Enable(logger)
vc:CheckVersion("LibAddonMenu-2.0", 36)
vc:CheckVersion("LibMediaProvider-1.0", 30)
vc:CheckVersion("LibDebugLogger",263)
vc:CheckVersion("LibSFUtils",52)
if UnknownTracker then
vc:CheckVersion("UnknownTracker",75)
end
end