Core/Misc: Moved CharacterInfo out of world to separate class
This commit is contained in:
1 parent
5373e2bd3b
commit
5e1a7bcfbb
43 files changed
+520
-391
No files matched your search
@@ -31,6 +31,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "Channel.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "CharacterDatabaseCleaner.h"
|
||||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
@@ -4240,7 +4241,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
// Convert guid to low GUID for CharacterNameData, but also other methods on success
|
||||
ObjectGuid::LowType guid = playerguid.GetCounter();
|
||||
uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
|
||||
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(playerguid);
|
||||
CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(playerguid);
|
||||
std::string name;
|
||||
if (characterInfo)
|
||||
name = characterInfo->Name;
|
||||
@@ -4259,7 +4260,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
}
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
if (ObjectGuid::LowType guildId = Player::GetGuildIdFromCharacterInfo(playerguid))
|
||||
if (ObjectGuid::LowType guildId = sCharacterCache->GetCharacterGuildIdByGuid(playerguid))
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
||||
guild->DeleteMember(trans, playerguid, false, false, true);
|
||||
|
||||
@@ -4370,7 +4371,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
stmt->setUInt32(0, mail_id);
|
||||
trans->Append(stmt);
|
||||
|
||||
uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(playerguid);
|
||||
uint32 pl_account = sCharacterCache->GetCharacterAccountIdByGuid(playerguid);
|
||||
|
||||
draft.AddMoney(money).SendReturnToSender(pl_account, guid, sender, trans);
|
||||
}
|
||||
@@ -4600,7 +4601,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
if (updateRealmChars)
|
||||
sWorld->UpdateRealmCharCount(accountId);
|
||||
|
||||
sWorld->DeleteCharacterInfo(playerguid, name);
|
||||
sCharacterCache->DeleteCharacterCacheEntry(playerguid, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7270,16 +7271,7 @@ void Player::SetInGuild(uint32 guildId)
|
||||
|
||||
ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_GUILD_LEVEL_ENABLED, guildId != 0 && sWorld->getBoolConfig(CONFIG_GUILD_LEVELING_ENABLED));
|
||||
SetUInt16Value(OBJECT_FIELD_TYPE, 1, guildId != 0);
|
||||
sWorld->UpdateCharacterGuildId(GetGUID(), guildId);
|
||||
}
|
||||
|
||||
ObjectGuid::LowType Player::GetGuildIdFromCharacterInfo(ObjectGuid guid)
|
||||
{
|
||||
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
|
||||
if (!characterInfo)
|
||||
return 0;
|
||||
|
||||
return characterInfo->GuildId;
|
||||
sCharacterCache->UpdateCharacterGuildId(GetGUID(), guildId);
|
||||
}
|
||||
|
||||
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
@@ -7298,15 +7290,6 @@ void Player::SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamIdFromCharacterInfo(ObjectGuid guid, uint8 type)
|
||||
{
|
||||
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
|
||||
if (!characterInfo)
|
||||
return 0;
|
||||
|
||||
return characterInfo->ArenaTeamId[type];
|
||||
}
|
||||
|
||||
uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
||||
{
|
||||
ObjectGuid::LowType guidLow = guid.GetCounter();
|
||||
@@ -7353,15 +7336,6 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
||||
return zone;
|
||||
}
|
||||
|
||||
uint32 Player::GetLevelFromCharacterInfo(ObjectGuid guid)
|
||||
{
|
||||
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
|
||||
if (!characterInfo)
|
||||
return 0;
|
||||
|
||||
return characterInfo->Level;
|
||||
}
|
||||
|
||||
void Player::UpdateArea(uint32 newArea)
|
||||
{
|
||||
// FFA_PVP flags are area and not zone id dependent
|
||||
@@ -17109,7 +17083,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
|
||||
if (!result)
|
||||
{
|
||||
std::string name = "<unknown>";
|
||||
sObjectMgr->GetPlayerNameByGUID(guid, name);
|
||||
sCharacterCache->GetCharacterNameByGuid(guid, name);
|
||||
TC_LOG_ERROR("entities.player", "Player::LoadFromDB: Player '%s' (%s) not found in table `characters`, can't load. ", name.c_str(), guid.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -18267,7 +18241,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
|
||||
}
|
||||
|
||||
std::string name;
|
||||
if (creatorGuid && !sObjectMgr->GetPlayerNameByGUID(creatorGuid, name))
|
||||
if (creatorGuid && !sCharacterCache->GetCharacterNameByGuid(creatorGuid, name))
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::_LoadVoidStorage - Player (GUID: %u, name: %s) has an item with an invalid creator guid, set to 0 (item id: " UI64FMTD ", entry: %u, creator: %s).", GetGUID().GetCounter(), GetName().c_str(), itemId, itemEntry, creatorGuid.ToString().c_str());
|
||||
creatorGuid.Clear();
|
||||
@@ -21368,7 +21342,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
|
||||
|
||||
void Player::LeaveAllArenaTeams(ObjectGuid guid)
|
||||
{
|
||||
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
|
||||
CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(guid);
|
||||
if (!characterInfo)
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user