-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRutherMod.lua
More file actions
127 lines (104 loc) · 5.73 KB
/
Copy pathRutherMod.lua
File metadata and controls
127 lines (104 loc) · 5.73 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
--------- Main File -------------------------------------------------------------------------------------------------------------------
plus_suffix = "_rutherPlus"
plus_master_suffix = "_rutherPlusMaster"
---------------------------------------------------------------------------------------------------------------------------------------
--------- DEBUGGING -------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
-- table_debug_to_file = function(_table, _name, _fn)
-- _fn = _fn or "debugMisc"
-- _name = _name or "table"
-- local f = io.open("<folder>\\".._fn..".log", "w")
-- f:write(table_to_string((_table or {}), _name))
-- f:close()
-- end
-- table_debug_to_file_event = function(_table, _name, _fn)
-- G.E_MANAGER:add_event(Event({
-- trigger = "after",
-- delay = 1,
-- blocking = false,
-- blockable = false,
-- func = function()
-- table_debug_to_file(_table, _name, _fn)
-- return true
-- end
-- }))
-- end
---------------------------------------------------------------------------------------------------------------------------------------
--------- LOGGING ---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
global_log_level = { g = "INFO", all_files=true }
loggerName = "RutherMod"
LOGLEVEL = {
NONE = 0,
[0] = "NONE",
FATAL = 1,
[1] = "FATAL",
ERROR = 2,
[2] = "ERROR",
WARN = 3,
[3] = "WARN",
INFO = 4,
[4] = "INFO",
DEBUG = 5,
[5] = "DEBUG",
TRACE = 6,
[6] = "TRACE"
}
LOGGER = {
NONE = function() end,
FATAL = function(message) sendFatalMessage(message, loggerName.."["..(getCurFile(6) or "<filename not found (1)>").."]") end,
ERROR = function(message) sendErrorMessage(message, loggerName.."["..(getCurFile(6) or "<filename not found (2)>").."]") end,
WARN = function(message) sendWarnMessage (message, loggerName.."["..(getCurFile(6) or "<filename not found (3)>").."]") end,
INFO = function(message) sendInfoMessage (message, loggerName.."["..(getCurFile(6) or "<filename not found (4)>").."]") end,
DEBUG = function(message) sendDebugMessage(message, loggerName.."["..(getCurFile(6) or "<filename not found (5)>").."]") end,
TRACE = function(message) sendTraceMessage(message, loggerName.."["..(getCurFile(6) or "<filename not found (6)>").."]") end,
}
log = function(msg, log_level, file)
file = file or getCurFile(3)
log_level = log_level or "DEBUG"
msg = msg or ""
if type(log_level) == "string" then log_level = LOGLEVEL[log_level] end
if type(msg) == "table" then msg = table_to_string(msg) end
local gll = LOGLEVEL[global_log_level.g] -- global log level
local lls = LOGLEVEL[log_level] -- log_level_string
if log_level > 0 and log_level <= gll and (global_log_level[file] or global_log_level.all_files) then
local success, err = pcall(function() LOGGER[lls](msg) end)
if not success then
print("msg: "..msg)
LOGGER.ERROR("ERROR in file \""..file.."\" at line "..(debug.getinfo(2,'l').currentline)..": "..err)
end
end
end
getCurFile = function(stack_level)
stack_level = stack_level or 2
local o1 = debug.getinfo(stack_level,'S').short_src
local a1, fn = o1:match("^%[.- \"(.-/)(.-)%.lua\"%]$")
return fn
end
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
assert(SMODS.load_file("Misc/auxiliary.lua"))()
assert(SMODS.load_file("Misc/LoadConfig.lua"))()
assert(SMODS.load_file("Misc/LoadConfigUI.lua"))()
assert(SMODS.load_file("Misc/DrawSteps.lua"))()
assert(SMODS.load_file("Misc/Atlas.lua"))()
assert(SMODS.load_file("Misc/SetUpForVouchers.lua"))()
assert(SMODS.load_file("Misc/SetUpForLocalizations.lua"))()
if modConfig.reroll_shop_voucher then assert(SMODS.load_file("Misc/VoucherReroll.lua"))() end
if modConfig.common_vouchers then assert(SMODS.load_file("Misc/CommonVouchers.lua"))() end
if modConfig.voucher_deck and modConfig.common_vouchers then assert(SMODS.load_file("Backs/VoucherDeck.lua"))() end
if modConfig.voucher_processor then assert(SMODS.load_file("Backs/VoucherProcessor.lua"))() end
if modConfig.the_crucible then assert(SMODS.load_file("Backs/TheCrucible.lua"))() end
if modConfig.branching_vouchers then
assert(SMODS.load_file("BranchingVouchers/BranchingVouchersSetup.lua"))()
assert(SMODS.load_file("BranchingVouchers/BranchingVouchersCore.lua"))()
assert(SMODS.load_file("BranchingVouchers/BranchingVouchersCenterPools.lua"))()
end
if modConfig.custom_collection_view then assert(SMODS.load_file("BranchingVouchers/VoucherCollection.lua"))() end
if modConfig.custom_run_info_view then assert(SMODS.load_file("BranchingVouchers/VoucherPagination.lua"))() end
if modConfig.vouchers_plus_base or modConfig.vouchers_plus_modded then
assert(SMODS.load_file("VoucherPlus/VoucherPlusSetup.lua"))()
assert(SMODS.load_file("VoucherPlus/VoucherPlusCore.lua"))()
end
assert(SMODS.load_file("Misc/CallLocalizationFunctions.lua"))()