diff --git a/CHANGELOG.md b/CHANGELOG.md index b60d2e4..5490269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed various issues with keepsakes + ## [0.4.0] - 2024-06-06 ### Changed diff --git a/src/Data/TraitData_Keepsake.lua b/src/Data/TraitData_Keepsake.lua index e9c4f8f..7308fc5 100644 --- a/src/Data/TraitData_Keepsake.lua +++ b/src/Data/TraitData_Keepsake.lua @@ -1,3 +1,38 @@ +local textfile = rom.path.combine(rom.paths.Content, 'Game/Text/en/TraitText.en.sjson') + +local ids_to_descriptions = { + ForceZeusBoonKeepsake = "While you have {$Keywords.ReserveMana} Magick{!Icons.Mana}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", + ForceZeusBoonKeepsake_Inactive = "While you have {$Keywords.ReserveMana} Magick{!Icons.Mana}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", + + ForcePoseidonBoonKeepsake = "Slain enemies drop {#MoneyFormatBold}+{$TooltipData.ExtractData.TooltipHeal:F} {!Icons.Currency}{#Prev}.", + ForcePoseidonBoonKeepsake_Inactive = "Slain enemies drop {#MoneyFormatBold}+{$TooltipData.ExtractData.TooltipHeal:F} {!Icons.Currency}{#Prev}.", + + ForceApolloBoonKeepsake = "Extends the invulnerability period of your {$Keywords.Dash} by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipMultiplier:F}{#Prev}.", + ForceApolloBoonKeepsake_Inactive = "Extends the invulnerability period of your {$Keywords.Dash} by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipMultiplier:F}{#Prev}.", + + ForceHestiaBoonKeepsake = "All your damage is increased by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipDamage:F} {#Prev}, but you have {#PenaltyFormat}{$TooltipData.ExtractData.HealthPenalty:P}{#Prev}{!Icons.HealthDown}.", + ForceHestiaBoonKeepsake_Inactive = "All your damage is increased by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipDamage:F} {#Prev}, but you have {#PenaltyFormat}{$TooltipData.ExtractData.HealthPenalty:P}{#Prev}{!Icons.HealthDown}.", + + ForceHephaestusBoonKeepsake = "You gain {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipArmor:F} {#Prev} of all {!Icons.HealthUp} rewards as {!Icons.ArmorTotal}.", + ForceHephaestusBoonKeepsake_Inactive = "You gain {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipArmor:F} {#Prev} of all {!Icons.HealthUp} rewards as {!Icons.ArmorTotal}.", + + ForceAphroditeBoonKeepsake = "Increases your chances to receive a {$Keywords.GodBoon} of higher {$Keywords.Rarity}. {#RareFormat}Rare {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.RareBonus:P} {#Prev}, {#EpicFormat}Epic {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.EpicBonus:P} {#Prev}and {#DuoFormat}Duo {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.DuoBonus:P} {#Prev}.", + ForceAphroditeBoonKeepsake_Inactive = "Increases your chances to receive a {$Keywords.GodBoon} of higher {$Keywords.Rarity}. {#RareFormat}Rare {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.RareBonus:P} {#Prev}, {#EpicFormat}Epic {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.EpicBonus:P} {#Prev}and {#DuoFormat}Duo {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.DuoBonus:P} {#Prev}.", + + ForceDemeterBoonKeepsake = "While under {#BoldFormatGraft}{$TooltipData.ExtractData.Health:F}{#Prev}{!Icons.Health}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", + ForceDemeterBoonKeepsake_Inactive = "While under {#BoldFormatGraft}{$TooltipData.ExtractData.Health:F}{#Prev}{!Icons.Health}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", + + ForceHeraBoonKeepsake = "Your {$Keywords.Attack} and {$Keywords.Special} each deal {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipBonus:P} {#Prev}damage while not empowered by a {$Keywords.GodBoon}.", + ForceHeraBoonKeepsake_Inactive = "Your {$Keywords.Attack} and {$Keywords.Special} each deal {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipBonus:P} {#Prev}damage while not empowered by a {$Keywords.GodBoon}.", +} + +sjson.hook(textfile, function(sjsonData) + for _, v in ipairs(sjsonData.Texts) do + local description = ids_to_descriptions[v.Id] + if description then v.Description = description end + end +end) + Keepsakes = { BaseBoonUpgradeKeepsake = { @@ -619,9 +654,5 @@ Keepsakes = { } for key, keepsake in pairs(Keepsakes) do - if TraitData[key] then - OverwriteTableKeys(TraitData[key], keepsake) - else - TraitData[key] = keepsake - end + TraitData[key] = keepsake end diff --git a/src/main.lua b/src/main.lua index ade85e8..aef8bbb 100644 --- a/src/main.lua +++ b/src/main.lua @@ -41,22 +41,27 @@ public.config = config -- so other mods can access our config local function on_ready() -- what to do when we are ready, but not re-do on reload. if config.enabled == false then return end - import 'ready.lua' - import 'Data/TraitData_Keepsake.lua' end local function on_reload() -- what to do when we are ready, but also again on every reload. -- only do things that are safe to run over and over. - + if config.enabled == false then return end import 'reload.lua' end -- this allows us to limit certain functions to not be reloaded. -local loader = reload.auto_single() +local loader = reload.auto_multiple() -- this runs only when modutil and the game's lua is ready modutil.once_loaded.game(function() - loader.load(on_ready, on_reload) + loader.load('PonyAltar A', on_ready, on_reload) end) + +local function on_TraitData_Keepsake() + if config.enabled == false then return end + import 'Data/TraitData_Keepsake.lua' +end + +loader.queue.post_import_file('PonyAltar B', 'TraitData_Keepsake.lua', on_TraitData_Keepsake) diff --git a/src/ready.lua b/src/ready.lua index 27221d2..da6dfe3 100644 --- a/src/ready.lua +++ b/src/ready.lua @@ -9,41 +9,6 @@ mod = modutil.mod.Mod.Register(_PLUGIN.guid) -local textfile = rom.path.combine(rom.paths.Content, 'Game/Text/en/TraitText.en.sjson') - -local ids_to_descriptions = { - ForceZeusBoonKeepsake = "While you have {$Keywords.ReserveMana} Magick{!Icons.Mana}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", - ForceZeusBoonKeepsake_Inactive = "While you have {$Keywords.ReserveMana} Magick{!Icons.Mana}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", - - ForcePoseidonBoonKeepsake = "Slain enemies drop {#MoneyFormatBold}+{$TooltipData.ExtractData.TooltipHeal:F} {!Icons.Currency}{#Prev}.", - ForcePoseidonBoonKeepsake_Inactive = "Slain enemies drop {#MoneyFormatBold}+{$TooltipData.ExtractData.TooltipHeal:F} {!Icons.Currency}{#Prev}.", - - ForceApolloBoonKeepsake = "Extends the invulnerability period of your {$Keywords.Dash} by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipMultiplier:F}{#Prev}.", - ForceApolloBoonKeepsake_Inactive = "Extends the invulnerability period of your {$Keywords.Dash} by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipMultiplier:F}{#Prev}.", - - ForceHestiaBoonKeepsake = "All your damage is increased by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipDamage:F} {#Prev}, but you have {#PenaltyFormat}{$TooltipData.ExtractData.HealthPenalty:P}{#Prev}{!Icons.HealthDown}.", - ForceHestiaBoonKeepsake_Inactive = "All your damage is increased by {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipDamage:F} {#Prev}, but you have {#PenaltyFormat}{$TooltipData.ExtractData.HealthPenalty:P}{#Prev}{!Icons.HealthDown}.", - - ForceHephaestusBoonKeepsake = "You gain {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipArmor:F} {#Prev} of all {!Icons.HealthUp} rewards as {!Icons.ArmorTotal}.", - ForceHephaestusBoonKeepsake_Inactive = "You gain {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipArmor:F} {#Prev} of all {!Icons.HealthUp} rewards as {!Icons.ArmorTotal}.", - - ForceAphroditeBoonKeepsake = "Increases your chances to receive a {$Keywords.GodBoon} of higher {$Keywords.Rarity}. {#RareFormat}Rare {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.RareBonus:P} {#Prev}, {#EpicFormat}Epic {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.EpicBonus:P} {#Prev}and {#DuoFormat}Duo {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.DuoBonus:P} {#Prev}.", - ForceAphroditeBoonKeepsake_Inactive = "Increases your chances to receive a {$Keywords.GodBoon} of higher {$Keywords.Rarity}. {#RareFormat}Rare {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.RareBonus:P} {#Prev}, {#EpicFormat}Epic {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.EpicBonus:P} {#Prev}and {#DuoFormat}Duo {#Prev}{#AltUpgradeFormat}{$TooltipData.ExtractData.DuoBonus:P} {#Prev}.", - - ForceDemeterBoonKeepsake = "While under {#BoldFormatGraft}{$TooltipData.ExtractData.Health:F}{#Prev}{!Icons.Health}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", - ForceDemeterBoonKeepsake_Inactive = "While under {#BoldFormatGraft}{$TooltipData.ExtractData.Health:F}{#Prev}{!Icons.Health}, your {$Keywords.Omega} use {#ManaFormat}{$TooltipData.ExtractData.ManaDelta:F} {#Prev}less Magick{!Icons.Mana}.", - - ForceHeraBoonKeepsake = "Your {$Keywords.Attack} and {$Keywords.Special} each deal {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipBonus:P} {#Prev}damage while not empowered by a {$Keywords.GodBoon}.", - ForceHeraBoonKeepsake_Inactive = "Your {$Keywords.Attack} and {$Keywords.Special} each deal {#AltUpgradeFormat}{$TooltipData.ExtractData.TooltipBonus:P} {#Prev}damage while not empowered by a {$Keywords.GodBoon}.", -} - -sjson.hook(textfile, function(sjsonData) - for _, v in ipairs(sjsonData.Texts) do - local description = ids_to_descriptions[v.Id] - if description then v.Description = description end - end -end) - table.insert(HubRoomData.Hub_PreRun.StartUnthreadedEvents, { FunctionName = _PLUGIN.guid .. '.' .. 'SpawnAltar'