aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2014-12-08 15:33:16 +0100
committerRat <gmstreetrat@gmail.com>2014-12-08 15:33:16 +0100
commit16ff14e758c2d3c5ee1cb9006c67382c251fb926 (patch)
treedbc60cbd8bfabd8a464509e346ae2cc50baeec28 /src/server/scripts/Commands
parent30e2e04c01b7376d23070f1c9b76d443ece42413 (diff)
parent4825832c85f5ae824c0e099ed5defa516333e00f (diff)
Merge branch 'Spells' of https://github.com/TrinityCore/TrinityCore into Spells
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index c806b99f2db..47f20c622bf 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -1069,39 +1069,44 @@ public:
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
- CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if (titleInfo)
+ if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id))
{
- std::string name = target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang;
+ for (uint8 gender = GENDER_MALE; gender <= GENDER_FEMALE; ++gender)
+ {
+ if (target && target->getGender() != gender)
+ continue;
- if (name.empty())
- continue;
+ std::string name = gender == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang;
- if (!Utf8FitTo(name, wNamePart))
- continue;
+ if (name.empty())
+ continue;
- if (maxResults && counter == maxResults)
- {
- handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
- char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
+ if (maxResults && counter == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
- char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID
- ? handler->GetTrinityString(LANG_ACTIVE)
- : "";
+ char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
- char titleNameStr[80];
- snprintf(titleNameStr, 80, name.c_str(), targetName);
+ char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID
+ ? handler->GetTrinityString(LANG_ACTIVE)
+ : "";
- // send title in "id (idx:idx) - [namedlink locale]" format
- if (handler->GetSession())
- handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr);
- else
- handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr);
+ char titleNameStr[80];
+ snprintf(titleNameStr, 80, name.c_str(), targetName);
+
+ // send title in "id (idx:idx) - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr);
+ else
+ handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr);
- ++counter;
+ ++counter;
+ }
}
}
if (counter == 0) // if counter == 0 then we found nth