*Move command lookup faction's code to the correct file.
--HG-- branch : trunk
This commit is contained in:
@@ -44,12 +44,6 @@
|
|||||||
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||||
#include "CreatureGroups.h"
|
#include "CreatureGroups.h"
|
||||||
|
|
||||||
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
|
||||||
{
|
|
||||||
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
|
||||||
LANG_REP_FRIENDLY, LANG_REP_HONORED, LANG_REP_REVERED, LANG_REP_EXALTED
|
|
||||||
};
|
|
||||||
|
|
||||||
//mute player for some times
|
//mute player for some times
|
||||||
bool ChatHandler::HandleMuteCommand(const char* args)
|
bool ChatHandler::HandleMuteCommand(const char* args)
|
||||||
{
|
{
|
||||||
@@ -897,100 +891,6 @@ bool ChatHandler::HandleGUIDCommand(const char* /*args*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleLookupFactionCommand(const char* args)
|
|
||||||
{
|
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Can be NULL at console call
|
|
||||||
Player *target = getSelectedPlayer ();
|
|
||||||
|
|
||||||
std::string namepart = args;
|
|
||||||
std::wstring wnamepart;
|
|
||||||
|
|
||||||
if (!Utf8toWStr (namepart,wnamepart))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// converting string that we try to find to lower case
|
|
||||||
wstrToLower (wnamepart);
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
|
|
||||||
{
|
|
||||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry (id);
|
|
||||||
if (factionEntry)
|
|
||||||
{
|
|
||||||
FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
|
|
||||||
|
|
||||||
int loc = GetSessionDbcLocale();
|
|
||||||
std::string name = factionEntry->name[loc];
|
|
||||||
if(name.empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!Utf8FitTo(name, wnamepart))
|
|
||||||
{
|
|
||||||
loc = 0;
|
|
||||||
for(; loc < MAX_LOCALE; ++loc)
|
|
||||||
{
|
|
||||||
if(loc==GetSessionDbcLocale())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
name = factionEntry->name[loc];
|
|
||||||
if(name.empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(loc < MAX_LOCALE)
|
|
||||||
{
|
|
||||||
// send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
|
|
||||||
// or "id - [faction] [no reputation]" format
|
|
||||||
std::ostringstream ss;
|
|
||||||
if (m_session)
|
|
||||||
ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
|
||||||
else
|
|
||||||
ss << id << " - " << name << " " << localeNames[loc];
|
|
||||||
|
|
||||||
if (repState) // and then target!=NULL also
|
|
||||||
{
|
|
||||||
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
|
||||||
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
|
|
||||||
|
|
||||||
ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
|
|
||||||
|
|
||||||
if(repState->Flags & FACTION_FLAG_VISIBLE)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_VISIBLE);
|
|
||||||
if(repState->Flags & FACTION_FLAG_AT_WAR)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_ATWAR);
|
|
||||||
if(repState->Flags & FACTION_FLAG_PEACE_FORCED)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
|
|
||||||
if(repState->Flags & FACTION_FLAG_HIDDEN)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_HIDDEN);
|
|
||||||
if(repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
|
|
||||||
if(repState->Flags & FACTION_FLAG_INACTIVE)
|
|
||||||
ss << GetTrinityString(LANG_FACTION_INACTIVE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ss << GetTrinityString(LANG_FACTION_NOREPUTATION);
|
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
|
||||||
|
|
||||||
if(!found)
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleModifyRepCommand(const char * args)
|
bool ChatHandler::HandleModifyRepCommand(const char * args)
|
||||||
{
|
{
|
||||||
if (!*args) return false;
|
if (!*args) return false;
|
||||||
|
|||||||
@@ -3756,6 +3756,100 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::HandleLookupFactionCommand(const char* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Can be NULL at console call
|
||||||
|
Player *target = getSelectedPlayer ();
|
||||||
|
|
||||||
|
std::string namepart = args;
|
||||||
|
std::wstring wnamepart;
|
||||||
|
|
||||||
|
if (!Utf8toWStr (namepart,wnamepart))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// converting string that we try to find to lower case
|
||||||
|
wstrToLower (wnamepart);
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
|
||||||
|
{
|
||||||
|
FactionEntry const *factionEntry = sFactionStore.LookupEntry (id);
|
||||||
|
if (factionEntry)
|
||||||
|
{
|
||||||
|
FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
|
||||||
|
|
||||||
|
int loc = GetSessionDbcLocale();
|
||||||
|
std::string name = factionEntry->name[loc];
|
||||||
|
if(name.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Utf8FitTo(name, wnamepart))
|
||||||
|
{
|
||||||
|
loc = 0;
|
||||||
|
for(; loc < MAX_LOCALE; ++loc)
|
||||||
|
{
|
||||||
|
if(loc==GetSessionDbcLocale())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
name = factionEntry->name[loc];
|
||||||
|
if(name.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (Utf8FitTo(name, wnamepart))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(loc < MAX_LOCALE)
|
||||||
|
{
|
||||||
|
// send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
|
||||||
|
// or "id - [faction] [no reputation]" format
|
||||||
|
std::ostringstream ss;
|
||||||
|
if (m_session)
|
||||||
|
ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
||||||
|
else
|
||||||
|
ss << id << " - " << name << " " << localeNames[loc];
|
||||||
|
|
||||||
|
if (repState) // and then target!=NULL also
|
||||||
|
{
|
||||||
|
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
||||||
|
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
|
||||||
|
|
||||||
|
ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
|
||||||
|
|
||||||
|
if(repState->Flags & FACTION_FLAG_VISIBLE)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_VISIBLE);
|
||||||
|
if(repState->Flags & FACTION_FLAG_AT_WAR)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_ATWAR);
|
||||||
|
if(repState->Flags & FACTION_FLAG_PEACE_FORCED)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
|
||||||
|
if(repState->Flags & FACTION_FLAG_HIDDEN)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_HIDDEN);
|
||||||
|
if(repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
|
||||||
|
if(repState->Flags & FACTION_FLAG_INACTIVE)
|
||||||
|
ss << GetTrinityString(LANG_FACTION_INACTIVE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ss << GetTrinityString(LANG_FACTION_NOREPUTATION);
|
||||||
|
|
||||||
|
SendSysMessage(ss.str().c_str());
|
||||||
|
|
||||||
|
if(!found)
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
|
bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
if(!*args)
|
||||||
|
|||||||
@@ -21,9 +21,16 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
|
#include "Language.h"
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||||
|
{
|
||||||
|
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
||||||
|
LANG_REP_FRIENDLY, LANG_REP_HONORED, LANG_REP_REVERED, LANG_REP_EXALTED
|
||||||
|
};
|
||||||
|
|
||||||
enum FactionFlags
|
enum FactionFlags
|
||||||
{
|
{
|
||||||
FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction)
|
FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction)
|
||||||
|
|||||||
Reference in New Issue
Block a user