mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7540] Move most reputation/force faction reaction code to new ReputationMgr.
This commit is contained in:
parent
ef014420a5
commit
c33eff13f4
19 changed files with 773 additions and 647 deletions
|
|
@ -893,7 +893,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args)
|
|||
FactionEntry const *factionEntry = sFactionStore.LookupEntry (id);
|
||||
if (factionEntry)
|
||||
{
|
||||
FactionState const* repState = target ? target->GetFactionState(factionEntry) : NULL;
|
||||
FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
|
||||
|
||||
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
|
||||
std::string name = factionEntry->name[loc];
|
||||
|
|
@ -929,10 +929,10 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args)
|
|||
|
||||
if (repState) // and then target!=NULL also
|
||||
{
|
||||
ReputationRank rank = target->GetReputationRank(factionEntry);
|
||||
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
||||
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
|
||||
|
||||
ss << " " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")";
|
||||
ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
|
||||
|
||||
if(repState->Flags & FACTION_FLAG_VISIBLE)
|
||||
ss << GetMangosString(LANG_FACTION_VISIBLE);
|
||||
|
|
@ -1019,9 +1019,9 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
|
|||
if (deltaTxt)
|
||||
{
|
||||
int32 delta = atoi(deltaTxt);
|
||||
if ((delta < 0) || (delta > Player::ReputationRank_Length[r] -1))
|
||||
if ((delta < 0) || (delta > ReputationMgr::PointsInRank[r] -1))
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_FACTION_DELTA, (Player::ReputationRank_Length[r]-1));
|
||||
PSendSysMessage(LANG_COMMAND_FACTION_DELTA, (ReputationMgr::PointsInRank[r]-1));
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1029,7 +1029,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
|
|||
}
|
||||
break;
|
||||
}
|
||||
amount += Player::ReputationRank_Length[r];
|
||||
amount += ReputationMgr::PointsInRank[r];
|
||||
}
|
||||
if (r >= MAX_REPUTATION_RANK)
|
||||
{
|
||||
|
|
@ -1055,8 +1055,9 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
|
|||
return false;
|
||||
}
|
||||
|
||||
target->SetFactionReputation(factionEntry,amount);
|
||||
PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[m_session->GetSessionDbcLocale()], factionId, GetNameLink(target).c_str(), target->GetReputation(factionEntry));
|
||||
target->GetReputationMgr().SetReputation(factionEntry,amount);
|
||||
PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[m_session->GetSessionDbcLocale()], factionId,
|
||||
GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2297,16 +2298,16 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
FactionStateList const& targetFSL = target->GetFactionStateList();
|
||||
FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
|
||||
for(FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
|
||||
{
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID);
|
||||
char const* factionName = factionEntry ? factionEntry->name[m_session->GetSessionDbcLocale()] : "#Not found#";
|
||||
ReputationRank rank = target->GetReputationRank(factionEntry);
|
||||
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
||||
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
|
||||
std::ostringstream ss;
|
||||
ss << itr->second.ID << ": |cffffffff|Hfaction:" << itr->second.ID << "|h[" << factionName << "]|h|r " << rankName << "|h|r ("
|
||||
<< target->GetReputation(factionEntry) << ")";
|
||||
<< target->GetReputationMgr().GetReputation(factionEntry) << ")";
|
||||
|
||||
if(itr->second.Flags & FACTION_FLAG_VISIBLE)
|
||||
ss << GetMangosString(LANG_FACTION_VISIBLE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue