fix crash

This commit is contained in:
luis
2026-03-10 20:45:23 -03:00
parent 3679885aed
commit 418ebd03cf
2 changed files with 19 additions and 25 deletions
+13 -25
View File
@@ -2530,8 +2530,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
trans->Append(stmt);
// Race specific languages
std::array<uint8, 4> const racesWithoutSpecificLanguages = { RACE_ORC, RACE_HUMAN, RACE_MAGHAR_ORC, RACE_KUL_TIRAN };
if (std::find(racesWithoutSpecificLanguages.begin(), racesWithoutSpecificLanguages.end(), factionChangeInfo->RaceID) == racesWithoutSpecificLanguages.end())
constexpr std::array<uint8, 4> racesWithoutSpecificLanguages = { RACE_ORC, RACE_HUMAN, RACE_MAGHAR_ORC, RACE_KUL_TIRAN };
if (!advstd::ranges::contains(racesWithoutSpecificLanguages, factionChangeInfo->RaceID))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
stmt->setUInt64(0, lowGuid);
@@ -2593,6 +2593,10 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
case RACE_EARTHEN_DWARF_ALLIANCE:
stmt->setUInt16(1, 140);
break;
case RACE_HARANIR_ALLIANCE:
case RACE_HARANIR_HORDE:
stmt->setUInt16(1, 2987);
break;
default:
TC_LOG_ERROR("entities.player", "Could not find language data for race ({}).", factionChangeInfo->RaceID);
SendCharFactionChange(CHAR_CREATE_ERROR, factionChangeInfo.get());
@@ -2688,11 +2692,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
Player::SavePositionInDB(loc, zoneId, factionChangeInfo->Guid, trans);
// Achievement conversion
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeAchievements.begin(); it != sObjectMgr->FactionChangeAchievements.end(); ++it)
for (auto [achiev_alliance, achiev_horde] : sObjectMgr->FactionChangeAchievements)
{
uint32 achiev_alliance = it->first;
uint32 achiev_horde = it->second;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
stmt->setUInt16(0, uint16(newTeamId == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
stmt->setUInt64(1, lowGuid);
@@ -2709,11 +2710,9 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
ObjectMgr::CharacterConversionMap const& itemConversionMap = newTeamId == TEAM_ALLIANCE
? sObjectMgr->FactionChangeItemsHordeToAlliance
: sObjectMgr->FactionChangeItemsAllianceToHorde;
for (std::map<uint32, uint32>::const_iterator it = itemConversionMap.begin(); it != itemConversionMap.end(); ++it)
{
uint32 oldItemId = it->first;
uint32 newItemId = it->second;
for (auto [oldItemId, newItemId] : itemConversionMap)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
stmt->setUInt32(0, newItemId);
stmt->setUInt32(1, oldItemId);
@@ -2727,11 +2726,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
trans->Append(stmt);
// Quest conversion
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeQuests.begin(); it != sObjectMgr->FactionChangeQuests.end(); ++it)
for (auto [quest_alliance, quest_horde] : sObjectMgr->FactionChangeQuests)
{
uint32 quest_alliance = it->first;
uint32 quest_horde = it->second;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST);
stmt->setUInt64(0, lowGuid);
stmt->setUInt32(1, (newTeamId == TEAM_ALLIANCE ? quest_alliance : quest_horde));
@@ -2766,11 +2762,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
}
// Spell conversion
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeSpells.begin(); it != sObjectMgr->FactionChangeSpells.end(); ++it)
for (auto [spell_alliance, spell_horde] : sObjectMgr->FactionChangeSpells)
{
uint32 spell_alliance = it->first;
uint32 spell_horde = it->second;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
stmt->setUInt32(0, (newTeamId == TEAM_ALLIANCE ? spell_alliance : spell_horde));
stmt->setUInt64(1, lowGuid);
@@ -2784,10 +2777,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
}
// Reputation conversion
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeReputation.begin(); it != sObjectMgr->FactionChangeReputation.end(); ++it)
for (auto [reputation_alliance, reputation_horde] : sObjectMgr->FactionChangeReputation)
{
uint32 reputation_alliance = it->first;
uint32 reputation_horde = it->second;
uint32 newReputation = (newTeamId == TEAM_ALLIANCE) ? reputation_alliance : reputation_horde;
uint32 oldReputation = (newTeamId == TEAM_ALLIANCE) ? reputation_horde : reputation_alliance;
@@ -2844,11 +2835,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(std::shared_ptr<WorldPa
}
}
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeTitles.begin(); it != sObjectMgr->FactionChangeTitles.end(); ++it)
for (auto [title_alliance, title_horde] : sObjectMgr->FactionChangeTitles)
{
uint32 title_alliance = it->first;
uint32 title_horde = it->second;
CharTitlesEntry const* atitleInfo = sCharTitlesStore.AssertEntry(title_alliance);
CharTitlesEntry const* htitleInfo = sCharTitlesStore.AssertEntry(title_horde);
// new team
@@ -440,6 +440,12 @@ class spell_gen_battleground_mercenary_shapeshift : public AuraScript
{ RACE_VULPERA, { 94999, 95001 } },
{ RACE_MAGHAR_ORC, { 88420, 88410 } },
{ RACE_MECHAGNOME, { 94998, 95000 } },
{ RACE_DRACTHYR_ALLIANCE, { 112794, 112793 } },
{ RACE_DRACTHYR_HORDE, { 112796, 112795 } },
{ RACE_EARTHEN_DWARF_HORDE, { 118113, 118114 } },
{ RACE_EARTHEN_DWARF_ALLIANCE, { 118111, 118112 } },
{ RACE_HARANIR_ALLIANCE, { 140501, 140500 } },
{ RACE_HARANIR_HORDE, { 140503, 140502 } },
};
inline static std::vector<uint32> RacialSkills;