fix(core/dbc): improve ChrRace DBC handling (#14843)

Cherry pick of https://github.com/TrinityCore/TrinityCore/pull/24508

Co-authored-by: HelloKitty <5829095+HelloKitty@users.noreply.github.com>
This commit is contained in:
M'Dic 2023-04-27 19:29:33 -04:00 committed by GitHub
parent e19d3be755
commit 3eae4c5713
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 167 additions and 126 deletions

View file

@ -2310,12 +2310,12 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
return EQUIP_ERR_ITEM_NOT_FOUND;
}
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId(true) != TEAM_HORDE)
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId() != TEAM_HORDE)
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId(true) != TEAM_ALLIANCE)
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId() != TEAM_ALLIANCE)
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
@ -5076,7 +5076,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
//Need to call it to initialize m_team (m_team can be calculated from race)
//Other way is to saves m_team into characters table.
SetFactionForRace(getRace(true));
SetFactionForRace(getRace());
// pussywizard: create empty instance bind containers if necessary
sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid);
@ -5249,7 +5249,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
else if (!taxi_nodes.empty())
{
instanceId = 0;
if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId(true)))
if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId()))
{
// xinef: could no load valid data for taxi, relocate to homebind and clear
m_taxi.ClearTaxiDestinations();
@ -5311,7 +5311,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
@ -6780,7 +6780,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
missingItems = &missingLeaderItems;
}
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId(true))
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId())
{
if (!checkPlayer->HasItemCount(itemRequirement->id, 1))
{
@ -6802,7 +6802,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
missingAchievements = &missingLeaderAchievements;
}
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId(true))
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId())
{
if (!checkPlayer || !checkPlayer->HasAchieved(achievementRequirement->id))
{
@ -6824,7 +6824,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
missingQuests = &missingLeaderQuests;
}
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId(true))
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId())
{
if (!checkPlayer->GetQuestRewardStatus(questRequirement->id))
{
@ -7005,7 +7005,7 @@ bool Player::CheckInstanceCount(uint32 instanceId) const
bool Player::_LoadHomeBind(PreparedQueryResult result)
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
LOG_ERROR("entities.player", "Player (Name {}) has incorrect race/class pair. Can't be loaded.", GetName());