mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7850] Fixed '.pinfo name' work, move reputation code from it to new command '.character reputation [$name]'.
This commit is contained in:
parent
fdbc22ac93
commit
0838475415
7 changed files with 57 additions and 45 deletions
|
|
@ -2107,14 +2107,10 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
|
|||
//show info of player
|
||||
bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
{
|
||||
char* nameStr;
|
||||
char* subcommandStr;
|
||||
extractOptFirstArg((char*)args,&nameStr,&subcommandStr);
|
||||
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
|
||||
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
|
||||
uint32 accId = 0;
|
||||
|
|
@ -2197,43 +2193,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
uint32 copp = (money % GOLD) % SILVER;
|
||||
PSendSysMessage(LANG_PINFO_LEVEL, timeStr.c_str(), level, gold,silv,copp );
|
||||
|
||||
if( subcommandStr && strncmp(subcommandStr, "rep", 3) == 0 )
|
||||
{
|
||||
if(!target)
|
||||
{
|
||||
// rep option not implemented for offline case
|
||||
SendSysMessage(LANG_PINFO_NO_REP);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
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[GetSessionDbcLocale()] : "#Not found#";
|
||||
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->GetReputationMgr().GetReputation(factionEntry) << ")";
|
||||
|
||||
if(itr->second.Flags & FACTION_FLAG_VISIBLE)
|
||||
ss << GetMangosString(LANG_FACTION_VISIBLE);
|
||||
if(itr->second.Flags & FACTION_FLAG_AT_WAR)
|
||||
ss << GetMangosString(LANG_FACTION_ATWAR);
|
||||
if(itr->second.Flags & FACTION_FLAG_PEACE_FORCED)
|
||||
ss << GetMangosString(LANG_FACTION_PEACE_FORCED);
|
||||
if(itr->second.Flags & FACTION_FLAG_HIDDEN)
|
||||
ss << GetMangosString(LANG_FACTION_HIDDEN);
|
||||
if(itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED)
|
||||
ss << GetMangosString(LANG_FACTION_INVISIBLE_FORCED);
|
||||
if(itr->second.Flags & FACTION_FLAG_INACTIVE)
|
||||
ss << GetMangosString(LANG_FACTION_INACTIVE);
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3608,6 +3567,47 @@ bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleCharacterReputationCommand(const char* args)
|
||||
{
|
||||
Player* target;
|
||||
if(!extractPlayerTarget((char*)args,&target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = GetSessionDbcLocale();
|
||||
|
||||
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[loc] : "#Not found#";
|
||||
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
||||
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
|
||||
std::ostringstream ss;
|
||||
if (m_session)
|
||||
ss << itr->second.ID << " - |cffffffff|Hfaction:" << itr->second.ID << "|h[" << factionName << " " << localeNames[loc] << "]|h|r";
|
||||
else
|
||||
ss << itr->second.ID << " - " << factionName << " " << localeNames[loc];
|
||||
|
||||
ss << " " << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
|
||||
|
||||
if(itr->second.Flags & FACTION_FLAG_VISIBLE)
|
||||
ss << GetMangosString(LANG_FACTION_VISIBLE);
|
||||
if(itr->second.Flags & FACTION_FLAG_AT_WAR)
|
||||
ss << GetMangosString(LANG_FACTION_ATWAR);
|
||||
if(itr->second.Flags & FACTION_FLAG_PEACE_FORCED)
|
||||
ss << GetMangosString(LANG_FACTION_PEACE_FORCED);
|
||||
if(itr->second.Flags & FACTION_FLAG_HIDDEN)
|
||||
ss << GetMangosString(LANG_FACTION_HIDDEN);
|
||||
if(itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED)
|
||||
ss << GetMangosString(LANG_FACTION_INVISIBLE_FORCED);
|
||||
if(itr->second.Flags & FACTION_FLAG_INACTIVE)
|
||||
ss << GetMangosString(LANG_FACTION_INACTIVE);
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//change standstate
|
||||
bool ChatHandler::HandleModifyStandStateCommand(const char* args)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue