mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Entities/Creature/Creature.h src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Globals/ObjectMgr.cpp src/server/game/Handlers/CharacterHandler.cpp
This commit is contained in:
@@ -1990,44 +1990,6 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
// Delete all current quests
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
trans->Append(stmt);
|
||||
|
||||
// Delete record of the faction old completed quests
|
||||
{
|
||||
std::ostringstream quests;
|
||||
ObjectMgr::QuestMap const& questTemplate = sObjectMgr->GetQuestTemplates();
|
||||
for (ObjectMgr::QuestMap::const_iterator iter = questTemplate.begin(); iter != questTemplate.end(); ++iter)
|
||||
{
|
||||
Quest* questInfo = iter->second;
|
||||
uint32 requiredRaces = questInfo->GetRequiredRaces();
|
||||
if (team == TEAM_ALLIANCE)
|
||||
{
|
||||
if (requiredRaces & RACEMASK_ALLIANCE)
|
||||
{
|
||||
quests << uint32(questInfo->GetQuestId());
|
||||
quests << ',';
|
||||
}
|
||||
}
|
||||
else // if (team == TEAM_HORDE)
|
||||
{
|
||||
if (requiredRaces & RACEMASK_HORDE)
|
||||
{
|
||||
quests << uint32(questInfo->GetQuestId());
|
||||
quests << ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string questsStr = quests.str();
|
||||
questsStr = questsStr.substr(0, questsStr.length() - 1);
|
||||
|
||||
if (!questsStr.empty())
|
||||
trans->PAppend("DELETE FROM `character_queststatus_rewarded` WHERE guid='%u' AND quest IN (%s)", lowGuid, questsStr.c_str());
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
{
|
||||
// Reset guild
|
||||
@@ -2085,7 +2047,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
trans->Append(stmt);
|
||||
|
||||
// Achievement conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Achievements.begin(); it != sObjectMgr->FactionChange_Achievements.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeAchievements.begin(); it != sObjectMgr->FactionChangeAchievements.end(); ++it)
|
||||
{
|
||||
uint32 achiev_alliance = it->first;
|
||||
uint32 achiev_horde = it->second;
|
||||
@@ -2103,7 +2065,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// Item conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Items.begin(); it != sObjectMgr->FactionChange_Items.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeItems.begin(); it != sObjectMgr->FactionChangeItems.end(); ++it)
|
||||
{
|
||||
uint32 item_alliance = it->first;
|
||||
uint32 item_horde = it->second;
|
||||
@@ -2115,8 +2077,53 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
// Delete all current quests
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
trans->Append(stmt);
|
||||
|
||||
// Quest conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeQuests.begin(); it != sObjectMgr->FactionChangeQuests.end(); ++it)
|
||||
{
|
||||
uint32 quest_alliance = it->first;
|
||||
uint32 quest_horde = it->second;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? quest_alliance : quest_horde));
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE);
|
||||
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? quest_alliance : quest_horde));
|
||||
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? quest_horde : quest_alliance));
|
||||
stmt->setUInt32(2, lowGuid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
// Mark all rewarded quests as "active" (will count for completed quests achievements)
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
// Disable all old-faction specific quests
|
||||
{
|
||||
ObjectMgr::QuestMap const& questTemplates = sObjectMgr->GetQuestTemplates();
|
||||
for (ObjectMgr::QuestMap::const_iterator iter = questTemplates.begin(); iter != questTemplates.end(); ++iter)
|
||||
{
|
||||
Quest const* quest = iter->second;
|
||||
uint32 newRaceMask = (team == TEAM_ALLIANCE) ? RACEMASK_ALLIANCE : RACEMASK_HORDE;
|
||||
if (!(quest->GetRequiredRaces() & newRaceMask))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
stmt->setUInt32(1, quest->GetQuestId());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spell conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Spells.begin(); it != sObjectMgr->FactionChange_Spells.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeSpells.begin(); it != sObjectMgr->FactionChangeSpells.end(); ++it)
|
||||
{
|
||||
uint32 spell_alliance = it->first;
|
||||
uint32 spell_horde = it->second;
|
||||
@@ -2134,7 +2141,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// Reputation conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Reputation.begin(); it != sObjectMgr->FactionChange_Reputation.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeReputation.begin(); it != sObjectMgr->FactionChangeReputation.end(); ++it)
|
||||
{
|
||||
uint32 reputation_alliance = it->first;
|
||||
uint32 reputation_horde = it->second;
|
||||
@@ -2160,10 +2167,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation);
|
||||
|
||||
// old base reputation
|
||||
int32 oldBaseRep = sObjectMgr->GetBaseReputationOff(factionEntry, oldRace, playerClass);
|
||||
int32 oldBaseRep = sObjectMgr->GetBaseReputationOf(factionEntry, oldRace, playerClass);
|
||||
|
||||
// new base reputation
|
||||
int32 newBaseRep = sObjectMgr->GetBaseReputationOff(sFactionStore.LookupEntry(newReputation), race, playerClass);
|
||||
int32 newBaseRep = sObjectMgr->GetBaseReputationOf(sFactionStore.LookupEntry(newReputation), race, playerClass);
|
||||
|
||||
// final reputation shouldnt change
|
||||
int32 FinalRep = oldDBRep + oldBaseRep;
|
||||
@@ -2195,7 +2202,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
for (uint32 index = 0; index < ktcount; ++index)
|
||||
knownTitles[index] = atol(tokens[index]);
|
||||
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Titles.begin(); it != sObjectMgr->FactionChange_Titles.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeTitles.begin(); it != sObjectMgr->FactionChangeTitles.end(); ++it)
|
||||
{
|
||||
uint32 title_alliance = it->first;
|
||||
uint32 title_horde = it->second;
|
||||
|
||||
Reference in New Issue
Block a user