mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Use raw metadata for set effect command
This commit is contained in:
@@ -585,12 +585,6 @@ class WorldInfoTimedEffects {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentState = this.isEffectActive(type, entry);
|
|
||||||
|
|
||||||
if (currentState === newState) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const key = this.#getEntryKey(entry);
|
const key = this.#getEntryKey(entry);
|
||||||
delete chat_metadata.timedWorldInfo[type][key];
|
delete chat_metadata.timedWorldInfo[type][key];
|
||||||
|
|
||||||
@@ -1106,7 +1100,7 @@ function registerWorldInfoSlashCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getNewEffectState = () => {
|
const getNewEffectState = () => {
|
||||||
const currentState = timedEffects.isEffectActive(effect, entry);
|
const currentState = !!timedEffects.getEffectMetadata(effect, entry);
|
||||||
|
|
||||||
if (['toggle', 't', ''].includes(value.trim().toLowerCase())) {
|
if (['toggle', 't', ''].includes(value.trim().toLowerCase())) {
|
||||||
return !currentState;
|
return !currentState;
|
||||||
@@ -1123,12 +1117,10 @@ function registerWorldInfoSlashCommands() {
|
|||||||
return currentState;
|
return currentState;
|
||||||
};
|
};
|
||||||
|
|
||||||
timedEffects.checkTimedEffects();
|
|
||||||
const newEffectState = getNewEffectState();
|
const newEffectState = getNewEffectState();
|
||||||
timedEffects.setTimedEffect(effect, entry, newEffectState);
|
timedEffects.setTimedEffect(effect, entry, newEffectState);
|
||||||
|
|
||||||
await saveMetadata();
|
await saveMetadata();
|
||||||
timedEffects.cleanUp();
|
|
||||||
toastr.success(`Timed effect "${effect}" for entry ${entry.uid} is now ${newEffectState ? 'active' : 'inactive'}`);
|
toastr.success(`Timed effect "${effect}" for entry ${entry.uid} is now ${newEffectState ? 'active' : 'inactive'}`);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
Reference in New Issue
Block a user