mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 12:52:25 +01:00
Core/Reputation: Fixed crash in reptutation code when PlayerStart.AllReputation is enabled in config
Closes #28915
This commit is contained in:
@@ -1506,13 +1506,6 @@ void WorldSession::HandleSetFactionNotAtWar(WorldPackets::Character::SetFactionN
|
||||
GetPlayer()->GetReputationMgr().SetAtWar(packet.FactionIndex, false);
|
||||
}
|
||||
|
||||
//I think this function is never used :/ I dunno, but i guess this opcode not exists
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket& /*recvData*/)
|
||||
{
|
||||
TC_LOG_ERROR("network", "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
|
||||
GetPlayer()->GetReputationMgr().SendState(nullptr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialFlag(WorldPackets::Misc::TutorialSetFlag& packet)
|
||||
{
|
||||
switch (packet.Action)
|
||||
|
||||
@@ -342,21 +342,21 @@ void ReputationMgr::SendState(FactionState const* faction)
|
||||
WorldPackets::Reputation::SetFactionStanding setFactionStanding;
|
||||
setFactionStanding.BonusFromAchievementSystem = 0.0f;
|
||||
|
||||
int32 standing = faction->VisualStandingIncrease ? faction->VisualStandingIncrease : faction->Standing;
|
||||
auto getStandingForPacket = [](FactionState const* state)
|
||||
{
|
||||
return state->VisualStandingIncrease ? state->VisualStandingIncrease : state->Standing;
|
||||
};
|
||||
|
||||
if (faction)
|
||||
setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), standing);
|
||||
setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), getStandingForPacket(faction));
|
||||
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
for (auto& [reputationIndex, state] : _factions)
|
||||
{
|
||||
if (itr->second.needSend)
|
||||
if (state.needSend)
|
||||
{
|
||||
itr->second.needSend = false;
|
||||
if (!faction || itr->second.ReputationListID != faction->ReputationListID)
|
||||
{
|
||||
standing = itr->second.VisualStandingIncrease ? itr->second.VisualStandingIncrease : itr->second.Standing;
|
||||
setFactionStanding.Faction.emplace_back(int32(itr->second.ReputationListID), standing);
|
||||
}
|
||||
state.needSend = false;
|
||||
if (!faction || state.ReputationListID != faction->ReputationListID)
|
||||
setFactionStanding.Faction.emplace_back(int32(state.ReputationListID), getStandingForPacket(&state));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1282,7 +1282,6 @@ class TC_GAME_API WorldSession
|
||||
|
||||
void HandleSetFactionAtWar(WorldPackets::Character::SetFactionAtWar& packet);
|
||||
void HandleSetFactionNotAtWar(WorldPackets::Character::SetFactionNotAtWar& packet);
|
||||
void HandleSetFactionCheat(WorldPacket& recvData);
|
||||
void HandleSetWatchedFactionOpcode(WorldPackets::Character::SetWatchedFaction& packet);
|
||||
void HandleSetFactionInactiveOpcode(WorldPackets::Character::SetFactionInactive& packet);
|
||||
void HandleRequestForcedReactionsOpcode(WorldPackets::Reputation::RequestForcedReactions& requestForcedReactions);
|
||||
|
||||
Reference in New Issue
Block a user