*Move most reputation/force faction reaction code to new ReputationMgr. Author: VladimirMangos

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-26 13:53:32 -06:00
parent bdafaf4113
commit 68c3039715
17 changed files with 96 additions and 648 deletions

View File

@@ -895,7 +895,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];
@@ -931,10 +931,10 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args)
if (repState) // and then target!=NULL also
{
ReputationRank rank = target->GetReputationRank(factionEntry);
std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]);
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 << GetTrinityString(LANG_FACTION_VISIBLE);
@@ -1021,9 +1021,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;
}
@@ -1031,7 +1031,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
}
break;
}
amount += Player::ReputationRank_Length[r];
amount += ReputationMgr::PointsInRank[r];
}
if (r >= MAX_REPUTATION_RANK)
{
@@ -1057,8 +1057,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;
}
@@ -2338,16 +2339,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);
std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]);
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 << GetTrinityString(LANG_FACTION_VISIBLE);