Core/WorldStates: Move custom worldstates to separate table and move saving worldstate values to WorldStateMgr
Port From (https://github.com/TrinityCore/TrinityCore/commit/e487d78ba7b37c35ede36c554169d26afeac88b0)
This commit is contained in:
@@ -37,12 +37,7 @@ namespace Game
|
||||
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
|
||||
// check flags which clean ups are necessary
|
||||
SQLResult result = DB.Characters.Query("SELECT value FROM worldstates WHERE entry = {0}", (uint)WorldStates.CleaningFlags);
|
||||
if (result.IsEmpty())
|
||||
return;
|
||||
|
||||
CleaningFlags flags = (CleaningFlags)result.Read<uint>(0);
|
||||
CleaningFlags flags = (CleaningFlags)Global.WorldMgr.GetPersistentWorldVariable(WorldManager.CharacterDatabaseCleaningFlagsVarId);
|
||||
|
||||
// clean up
|
||||
if (flags.HasAnyFlag(CleaningFlags.AchievementProgress))
|
||||
@@ -63,7 +58,7 @@ namespace Game
|
||||
// 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 &= (CleaningFlags)WorldConfig.GetIntValue(WorldCfg.PersistentCharacterCleanFlags);
|
||||
DB.Characters.DirectExecute("UPDATE worldstates SET value = {0} WHERE entry = {1}", flags, (uint)WorldStates.CleaningFlags);
|
||||
Global.WorldMgr.SetPersistentWorldVariable(WorldManager.CharacterDatabaseCleaningFlagsVarId, (int)flags);
|
||||
|
||||
Global.WorldMgr.SetCleaningFlags(flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user