From 893f4f3ed6b69accac4471020a032db4266d71fd Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 24 Jun 2024 01:28:37 +0300 Subject: [PATCH] Use raw metadata for set effect command --- public/scripts/world-info.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 648e0b5d8..8f42e61fe 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -585,12 +585,6 @@ class WorldInfoTimedEffects { return; } - const currentState = this.isEffectActive(type, entry); - - if (currentState === newState) { - return; - } - const key = this.#getEntryKey(entry); delete chat_metadata.timedWorldInfo[type][key]; @@ -1106,7 +1100,7 @@ function registerWorldInfoSlashCommands() { } const getNewEffectState = () => { - const currentState = timedEffects.isEffectActive(effect, entry); + const currentState = !!timedEffects.getEffectMetadata(effect, entry); if (['toggle', 't', ''].includes(value.trim().toLowerCase())) { return !currentState; @@ -1123,12 +1117,10 @@ function registerWorldInfoSlashCommands() { return currentState; }; - timedEffects.checkTimedEffects(); const newEffectState = getNewEffectState(); timedEffects.setTimedEffect(effect, entry, newEffectState); await saveMetadata(); - timedEffects.cleanUp(); toastr.success(`Timed effect "${effect}" for entry ${entry.uid} is now ${newEffectState ? 'active' : 'inactive'}`); return '';