From 1237a7cbd287d67263eb06c93a0330f9aa8430f9 Mon Sep 17 00:00:00 2001 From: tralezab <40974010+tralezab@users.noreply.github.com> Date: Mon, 28 Feb 2022 14:03:09 -0800 Subject: [PATCH] Fixes unwise else case in Spellbook UI, causing runtimes (#64997) --- code/modules/antagonists/wizard/equipment/spellbook.dm | 8 ++++---- tgui/packages/tgui/interfaces/Spellbook.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm index 8d62d02ca3f..6eee7a70790 100644 --- a/code/modules/antagonists/wizard/equipment/spellbook.dm +++ b/code/modules/antagonists/wizard/equipment/spellbook.dm @@ -775,7 +775,7 @@ if(entry.limit) entry.limit-- uses -= entry.cost - update_static_data(wizard) //update statics! + return TRUE if("refund") var/datum/spellbook_entry/entry = locate(params["spellref"]) in entries if(entry?.refundable) @@ -784,7 +784,7 @@ if(!isnull(entry.limit)) entry.limit += result uses += result - update_static_data(wizard) //update statics! + return TRUE //actions that are only available if you have full spell points if(uses < initial(uses)) to_chat(wizard, span_warning("You need to have all your spell points to do this!")) @@ -796,8 +796,8 @@ if("randomize") randomize(wizard, full_random_bonus) update_static_data(wizard) //update statics! - else //some loadout - wizard_loadout(wizard, action) + if("purchase_loadout") + wizard_loadout(wizard, locate(params["id"])) /obj/item/spellbook/proc/wizard_loadout(mob/living/carbon/human/wizard, loadout) var/list/wanted_spell_names diff --git a/tgui/packages/tgui/interfaces/Spellbook.js b/tgui/packages/tgui/interfaces/Spellbook.js index 72ef5acbbd8..5614abaeb87 100644 --- a/tgui/packages/tgui/interfaces/Spellbook.js +++ b/tgui/packages/tgui/interfaces/Spellbook.js @@ -225,7 +225,9 @@ const SingleLoadout = (props, context) => { fluid icon={icon} content="Purchase Loadout" - onClick={() => act(loadoutId)} /> + onClick={() => act('purchase_loadout', { + id: loadoutId, + })} /> Added by {author}.