Core/Commands: Implement config for setting the maximum number of results a .lookup command can return, closes issue 3875
--HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
DELETE FROM `trinity_string` WHERE (`entry`='5029');
|
||||||
|
INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES ('5029', 'Result limit reached (max results: %d)');
|
||||||
|
|
||||||
@@ -1851,6 +1851,8 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// converting string that we try to find to lower case
|
// converting string that we try to find to lower case
|
||||||
wstrToLower (wnamepart);
|
wstrToLower (wnamepart);
|
||||||
@@ -1885,6 +1887,12 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// send area in "id - [name]" format
|
// send area in "id - [name]" format
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
if (m_session)
|
if (m_session)
|
||||||
@@ -1930,6 +1938,9 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
std::ostringstream reply;
|
std::ostringstream reply;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
bool limitReached = false;
|
||||||
|
|
||||||
GameTeleMap const & teleMap = sObjectMgr.GetGameTeleMap();
|
GameTeleMap const & teleMap = sObjectMgr.GetGameTeleMap();
|
||||||
for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||||
@@ -1939,6 +1950,12 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||||||
if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
|
if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
limitReached = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
|
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
|
||||||
else
|
else
|
||||||
@@ -1950,6 +1967,9 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||||||
else
|
else
|
||||||
PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str());
|
PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str());
|
||||||
|
|
||||||
|
if (limitReached)
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3435,6 +3435,8 @@ bool ChatHandler::HandleLookupEventCommand(const char* args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList();
|
||||||
@@ -3449,6 +3451,12 @@ bool ChatHandler::HandleLookupEventCommand(const char* args)
|
|||||||
|
|
||||||
if (Utf8FitTo(descr, wnamepart))
|
if (Utf8FitTo(descr, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : "";
|
char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : "";
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
@@ -3836,8 +3844,16 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 li
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 acc_id = fields[0].GetUInt32();
|
uint32 acc_id = fields[0].GetUInt32();
|
||||||
std::string acc_name = fields[1].GetCppString();
|
std::string acc_name = fields[1].GetCppString();
|
||||||
@@ -4287,6 +4303,7 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in CharTitles.dbc
|
// Search in CharTitles.dbc
|
||||||
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
|
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
|
||||||
@@ -4318,6 +4335,12 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && counter == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : "";
|
char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : "";
|
||||||
|
|
||||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
||||||
|
|||||||
@@ -2985,6 +2985,8 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in `item_template`
|
// Search in `item_template`
|
||||||
for (uint32 id = 0; id < sItemStorage.MaxEntry; id++)
|
for (uint32 id = 0; id < sItemStorage.MaxEntry; id++)
|
||||||
@@ -3005,6 +3007,12 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
||||||
else
|
else
|
||||||
@@ -3025,6 +3033,12 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
||||||
else
|
else
|
||||||
@@ -3056,6 +3070,8 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in ItemSet.dbc
|
// Search in ItemSet.dbc
|
||||||
for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
|
for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
|
||||||
@@ -3087,6 +3103,12 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// send item set in "id - [namedlink locale]" format
|
// send item set in "id - [namedlink locale]" format
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]);
|
PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]);
|
||||||
@@ -3121,6 +3143,8 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in SkillLine.dbc
|
// Search in SkillLine.dbc
|
||||||
for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
|
for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
|
||||||
@@ -3152,6 +3176,12 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char valStr[50] = "";
|
char valStr[50] = "";
|
||||||
char const* knownStr = "";
|
char const* knownStr = "";
|
||||||
if (target && target->HasSkill(id))
|
if (target && target->HasSkill(id))
|
||||||
@@ -3200,6 +3230,8 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in Spell.dbc
|
// Search in Spell.dbc
|
||||||
for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
|
for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
|
||||||
@@ -3231,6 +3263,12 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool known = target && target->HasSpell(id);
|
bool known = target && target->HasSpell(id);
|
||||||
bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
|
bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
|
||||||
|
|
||||||
@@ -3301,6 +3339,8 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
ObjectMgr::QuestMap const& qTemplates = sObjectMgr.GetQuestTemplates();
|
ObjectMgr::QuestMap const& qTemplates = sObjectMgr.GetQuestTemplates();
|
||||||
for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
|
for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
|
||||||
@@ -3319,6 +3359,12 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(title, wnamepart))
|
if (Utf8FitTo(title, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char const* statusStr = "";
|
char const* statusStr = "";
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
@@ -3356,6 +3402,12 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(title, wnamepart))
|
if (Utf8FitTo(title, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char const* statusStr = "";
|
char const* statusStr = "";
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
@@ -3404,6 +3456,8 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
|
|||||||
wstrToLower (wnamepart);
|
wstrToLower (wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id)
|
for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id)
|
||||||
{
|
{
|
||||||
@@ -3423,6 +3477,12 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo (name, wnamepart))
|
if (Utf8FitTo (name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
|
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
|
||||||
else
|
else
|
||||||
@@ -3443,6 +3503,12 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
|
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
|
||||||
else
|
else
|
||||||
@@ -3474,6 +3540,8 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
for (uint32 id = 0; id< sGOStorage.MaxEntry; id++)
|
for (uint32 id = 0; id< sGOStorage.MaxEntry; id++)
|
||||||
{
|
{
|
||||||
@@ -3493,6 +3561,12 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
|
||||||
else
|
else
|
||||||
@@ -3513,6 +3587,12 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
|
|||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
|
||||||
else
|
else
|
||||||
@@ -3547,6 +3627,8 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
|
|||||||
wstrToLower (wnamepart);
|
wstrToLower (wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
|
for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
|
||||||
{
|
{
|
||||||
@@ -3579,6 +3661,12 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
|
// send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
|
||||||
// or "id - [faction] [no reputation]" format
|
// or "id - [faction] [no reputation]" format
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
@@ -3638,6 +3726,8 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
|
|||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
uint32 count = 0;
|
||||||
|
uint32 maxResults = sWorld.getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||||
|
|
||||||
// Search in TaxiNodes.dbc
|
// Search in TaxiNodes.dbc
|
||||||
for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
|
for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
|
||||||
@@ -3669,6 +3759,12 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
|
|||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
if (maxResults && count++ == maxResults)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
|
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
|
||||||
if (m_session)
|
if (m_session)
|
||||||
PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(),localeNames[loc],
|
PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(),localeNames[loc],
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ enum TrinityStrings
|
|||||||
LANG_SELECT_CHAR_OR_CREATURE = 1,
|
LANG_SELECT_CHAR_OR_CREATURE = 1,
|
||||||
LANG_SELECT_CREATURE = 2,
|
LANG_SELECT_CREATURE = 2,
|
||||||
|
|
||||||
|
|
||||||
// level 0 chat
|
// level 0 chat
|
||||||
LANG_SYSTEMMESSAGE = 3,
|
LANG_SYSTEMMESSAGE = 3,
|
||||||
LANG_EVENTMESSAGE = 4,
|
LANG_EVENTMESSAGE = 4,
|
||||||
@@ -902,7 +903,8 @@ enum TrinityStrings
|
|||||||
LANG_GOINFO_DISPLAYID = 5026,
|
LANG_GOINFO_DISPLAYID = 5026,
|
||||||
LANG_GOINFO_NAME = 5027,
|
LANG_GOINFO_NAME = 5027,
|
||||||
LANG_GOINFO_LOOTID = 5028,
|
LANG_GOINFO_LOOTID = 5028,
|
||||||
// Room for more Trinity strings 5029-9999
|
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
|
||||||
|
// Room for more Trinity strings 5030-9999
|
||||||
|
|
||||||
// Level requirement notifications
|
// Level requirement notifications
|
||||||
LANG_SAY_REQ = 6604,
|
LANG_SAY_REQ = 6604,
|
||||||
|
|||||||
@@ -1199,6 +1199,7 @@ void World::LoadConfigSettings(bool reload)
|
|||||||
m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||||
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfig.GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfig.GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
||||||
m_int_configs[CONFIG_NUMTHREADS] = sConfig.GetIntDefault("MapUpdate.Threads", 1);
|
m_int_configs[CONFIG_NUMTHREADS] = sConfig.GetIntDefault("MapUpdate.Threads", 1);
|
||||||
|
m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfig.GetIntDefault("Command.LookupMaxResults", 0);
|
||||||
|
|
||||||
// chat logging
|
// chat logging
|
||||||
m_bool_configs[CONFIG_CHATLOG_CHANNEL] = sConfig.GetBoolDefault("ChatLogs.Channel", false);
|
m_bool_configs[CONFIG_CHATLOG_CHANNEL] = sConfig.GetBoolDefault("ChatLogs.Channel", false);
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ enum WorldIntConfigs
|
|||||||
CONFIG_CHARDELETE_MIN_LEVEL,
|
CONFIG_CHARDELETE_MIN_LEVEL,
|
||||||
CONFIG_AUTOBROADCAST_CENTER,
|
CONFIG_AUTOBROADCAST_CENTER,
|
||||||
CONFIG_AUTOBROADCAST_INTERVAL,
|
CONFIG_AUTOBROADCAST_INTERVAL,
|
||||||
|
CONFIG_MAX_RESULTS_LOOKUP_COMMANDS,
|
||||||
INT_CONFIG_VALUE_COUNT
|
INT_CONFIG_VALUE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -961,6 +961,10 @@ ChatLogTimestamp = 0
|
|||||||
# Default: 0 - disable
|
# Default: 0 - disable
|
||||||
# 1 - enable
|
# 1 - enable
|
||||||
#
|
#
|
||||||
|
# Command.LookupMaxResults
|
||||||
|
# The maximum number of results a .lookup command can return
|
||||||
|
# Default: 0 - unlimited
|
||||||
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
GameType = 0
|
GameType = 0
|
||||||
@@ -1023,6 +1027,7 @@ Event.Announce = 0
|
|||||||
BeepAtStart = 1
|
BeepAtStart = 1
|
||||||
Motd = "Welcome to a Trinity Core server."
|
Motd = "Welcome to a Trinity Core server."
|
||||||
Server.LoginInfo = 0
|
Server.LoginInfo = 0
|
||||||
|
Command.LookupMaxResults = 0
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# PLAYER INTERACTION
|
# PLAYER INTERACTION
|
||||||
|
|||||||
Reference in New Issue
Block a user