Core/WorldStates: Move custom worldstates to separate table and move saving worldstate values to WorldStateMgr

This commit is contained in:
Shauren
2022-07-14 22:32:21 +02:00
parent f4951f9031
commit e487d78ba7
15 changed files with 270 additions and 277 deletions

View File

@@ -36,12 +36,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
uint32 oldMSTime = getMSTime();
// check flags which clean ups are necessary
QueryResult result = CharacterDatabase.PQuery("SELECT value FROM worldstates WHERE entry = %d", WS_CLEANING_FLAGS);
if (!result)
return;
uint32 flags = (*result)[0].GetUInt32();
uint32 flags = sWorld->GetPersistentWorldVariable(World::CharacterDatabaseCleaningFlagsVarId);
// clean up
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
@@ -62,7 +57,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
// NOTE: In order to have persistentFlags be set in worldstates for the next cleanup,
// you need to define them at least once in worldstates.
flags &= sWorld->getIntConfig(CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS);
CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = %d", flags, WS_CLEANING_FLAGS);
sWorld->SetPersistentWorldVariable(World::CharacterDatabaseCleaningFlagsVarId, flags);
sWorld->SetCleaningFlags(flags);