Core/Players: Fixed CharacterCache by-name storage holding data for deleted characters
Port From (https://github.com/TrinityCore/TrinityCore/commit/d03e0d69353852636e12911a7f7149cb0bca40ef)
This commit is contained in:
@@ -51,7 +51,8 @@ namespace Game.Cache
|
|||||||
data.IsDeleted = isDeleted;
|
data.IsDeleted = isDeleted;
|
||||||
|
|
||||||
// Fill Name to Guid Store
|
// Fill Name to Guid Store
|
||||||
_characterCacheByNameStore[name] = data;
|
if (!isDeleted)
|
||||||
|
_characterCacheByNameStore[name] = data;
|
||||||
_characterCacheStore[guid] = data;
|
_characterCacheStore[guid] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,14 +126,18 @@ namespace Game.Cache
|
|||||||
_characterCacheStore[guid].ArenaTeamId[slot] = arenaTeamId;
|
_characterCacheStore[guid].ArenaTeamId[slot] = arenaTeamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateCharacterInfoDeleted(ObjectGuid guid, bool deleted, string name = null)
|
public void UpdateCharacterInfoDeleted(ObjectGuid guid, bool deleted, string name)
|
||||||
{
|
{
|
||||||
if (!_characterCacheStore.ContainsKey(guid))
|
if (!_characterCacheStore.TryGetValue(guid, out var cacheEntry))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (deleted)
|
||||||
|
_characterCacheByNameStore.Remove(cacheEntry.Name);
|
||||||
|
else
|
||||||
|
_characterCacheByNameStore[name] = cacheEntry;
|
||||||
|
|
||||||
|
_characterCacheStore[guid].Name = name;
|
||||||
_characterCacheStore[guid].IsDeleted = deleted;
|
_characterCacheStore[guid].IsDeleted = deleted;
|
||||||
if (!name.IsEmpty())
|
|
||||||
_characterCacheStore[guid].Name = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasCharacterCacheEntry(ObjectGuid guid)
|
public bool HasCharacterCacheEntry(ObjectGuid guid)
|
||||||
|
|||||||
@@ -4521,7 +4521,7 @@ namespace Game.Entities
|
|||||||
stmt.AddValue(0, guid);
|
stmt.AddValue(0, guid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
Global.CharacterCacheStorage.UpdateCharacterInfoDeleted(playerGuid, true);
|
Global.CharacterCacheStorage.UpdateCharacterInfoDeleted(playerGuid, true, "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user