Skip to content

Instantly share code, notes, and snippets.

@Waester
Created July 17, 2022 23:31
Show Gist options
  • Save Waester/7d6e080d1f4695feb683d997132f872b to your computer and use it in GitHub Desktop.
Save Waester/7d6e080d1f4695feb683d997132f872b to your computer and use it in GitHub Desktop.
log.info("[Rise Voucher Manager] started loading")
local config = {
enable = false,
desiredVoucherUseCount = 0
}
local DlcManager = nil
local config_file = "RiseVoucherManager.json"
local _config = json.load_file(config_file)
if _config ~= nil then
config = _config
end
local function on_pre_title_hook(args)
end
local function on_post_title_hook(args)
if config.enable then
DlcManager = sdk.get_managed_singleton("snow.DlcManager")
if DlcManager then
DlcManager:get_field("_SystemSave"):set_field("_UseCharaMakeTicketCount", config.desiredVoucherUseCount)
log.info("[Rise Voucher Manager] Voucher use count has been set")
end
end
end
sdk.hook(sdk.find_type_definition("snow.gui.fsm.title.GuiTitleMenuFsmManager"):get_method("openTitle"),
on_pre_title_hook, on_post_title_hook)
re.on_draw_ui(function()
local changed = false
if imgui.tree_node("RiseVoucherManager") then
changed, config.enable = imgui.checkbox("Enable", config.enable)
if config.enable then
changed, config.desiredVoucherUseCount = imgui.slider_int("Voucher Use Count",
config.desiredVoucherUseCount, 0, 12)
end
imgui.tree_pop()
if imgui.button("Save Settings") then
json.dump_file(config_file, config)
end
imgui.tree_pop()
end
end)
log.info("[Rise Voucher Manager] finished loading")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment