balatro-mods/Cartomancer-v.4.10-fix-fix/lovely/vanilla-ui.toml
2025-01-19 15:01:49 +08:00

90 lines
2.4 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = 69
# Localization
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "boot_timer('prep stage', 'splash prep',1)"
position = "before"
payload = "Cartomancer.load_mod_file('internal/localization.lua', 'localization')"
match_indent = true
# Add tab button to settings menu
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
match_indent = true
position = "before"
pattern = '''local t = create_UIBox_generic_options({back_func = 'options',contents = {create_tabs('''
payload = '''
local settings_icon = Cartomancer.add_settings_icon()
if settings_icon then
tabs[#tabs+1] = {
colour = G.C.MONEY,
custom_button = {settings_icon},
tab_definition_function = Cartomancer.config_tab,
tab_definition_function_args = ''
}
end
'''
# Use custom button
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
match_indent = true
position = "at"
pattern = '''but_UI_label'''
payload = '''
args.ref_table and args.ref_table.custom_button or but_UI_label -- Cartomancer'''
# Use custom color
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
match_indent = true
position = "at"
pattern = '''colour = args.colour,'''
payload = '''
colour = args.ref_table and args.ref_table.colour or args.colour, -- Cartomancer'''
# From steamodded for vertical tabs support.
# Fix UIElement.config.chosen being overriden if choice=true is set
# UIElement:click()
[[patches]]
[patches.pattern]
target = "engine/ui.lua"
match_indent = true
position = "after"
pattern = "if self.config.choice then"
payload = " local chosen_temp = self.config.chosen"
[[patches]]
[patches.pattern]
target = "engine/ui.lua"
match_indent = true
position = "at"
pattern = "self.config.chosen = true"
payload = "self.config.chosen = chosen_temp or true"
# Add dynamic label support to UIBox_button
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
match_indent = true
position = "before"
pattern = "for k, v in ipairs(args.label) do"
payload = '''
if args.dynamic_label then
but_UI_label = {}
table.insert(but_UI_label, {n=G.UIT.R, config={align = "cm", padding = 0, minw = args.minw, maxw = args.maxw}, nodes={
{n=G.UIT.T, config={ref_table = args.dynamic_label, ref_value = 'text', scale = args.scale, colour = args.text_colour, shadow = args.shadow, focus_args = button_pip and args.focus_args or nil, func = button_pip,}}
}})
end
'''