aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-02-06 17:53:37 +0100
committerShauren <shauren.trinity@gmail.com>2016-05-20 23:48:48 +0200
commit885d9b53c38662e00e3b4977b82e9cf36d197f94 (patch)
tree913178bb8bdc6d4b9d722202b3255733329556d0 /src/server/scripts/Commands
parent41ae38d94d627f1945dc1aed46837068b83ed654 (diff)
Core/DataStores: Updated dbc/db2 to 7.0.1.20994
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_character.cpp2
-rw-r--r--src/server/scripts/Commands/cs_go.cpp4
-rw-r--r--src/server/scripts/Commands/cs_group.cpp2
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp125
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp12
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp12
6 files changed, 108 insertions, 49 deletions
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 6f59e6e40da..f9aca4b607b 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -270,7 +270,7 @@ public:
if (titleInfo && target->HasTitle(titleInfo))
{
- std::string name = target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang;
+ std::string name = (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()];
if (name.empty())
continue;
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 081280532fb..dd048ce3c57 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -504,12 +504,12 @@ public:
if (map->Instanceable())
{
- handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->AreaName_lang, map->GetId(), map->GetMapName());
+ handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaId, areaEntry->AreaName->Str[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName());
handler->SetSentErrorMessage(true);
return false;
}
- Zone2MapCoordinates(x, y, zoneEntry->ID);
+ Zone2MapCoordinates(x, y, areaEntry->ParentAreaID ? uint32(areaEntry->ParentAreaID) : areaId);
if (!MapManager::IsValidMapCoord(zoneEntry->MapID, x, y))
{
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 33356409f17..47588000173 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -352,7 +352,7 @@ public:
{
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
if (zone)
- zoneName = zone->AreaName_lang;
+ zoneName = zone->AreaName->Str[handler->GetSessionDbcLocale()];
}
}
else
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index 4ff0d1a70a9..2b3752c00be 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -102,30 +102,48 @@ public:
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i);
if (areaEntry)
{
- std::string name = areaEntry->AreaName_lang;
+ int32 locale = handler->GetSessionDbcLocale();
+ std::string name = areaEntry->AreaName->Str[locale];
if (name.empty())
continue;
if (!Utf8FitTo(name, wNamePart))
- continue;
-
- if (maxResults && count++ == maxResults)
{
- handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = areaEntry->AreaName->Str[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
}
- // send area in "id - [name]" format
- std::ostringstream ss;
- if (handler->GetSession())
- ss << i << " - |cffffffff|Harea:" << i << "|h[" << name<< "]|h|r";
- else
- ss << i << " - " << name;
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
- handler->SendSysMessage(ss.str().c_str());
+ // send area in "id - [name]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << i << " - |cffffffff|Harea:" << i << "|h[" << name << "]|h|r";
+ else
+ ss << i << " - " << name;
- if (!found)
- found = true;
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
}
}
@@ -1091,36 +1109,54 @@ public:
if (target && target->getGender() != gender)
continue;
- std::string name = gender == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang;
+ int32 locale = handler->GetSessionDbcLocale();
+ std::string name = (gender == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[locale];
if (name.empty())
continue;
if (!Utf8FitTo(name, wNamePart))
- continue;
-
- if (maxResults && counter == maxResults)
{
- handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = (gender == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
}
- char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
+ if (locale < TOTAL_LOCALES)
+ {
+ 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);
- ++counter;
+ // 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;
+ }
}
}
}
@@ -1145,18 +1181,35 @@ public:
uint32 counter = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
// search in Map.dbc
for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
{
if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
{
- std::string name = mapInfo->MapName_lang;
+ int32 locale = handler->GetSessionDbcLocale();
+ std::string name = mapInfo->MapName->Str[locale];
if (name.empty())
continue;
- if (Utf8FitTo(name, wNamePart) && locale < TOTAL_LOCALES)
+ if (!Utf8FitTo(name, wNamePart) && handler->GetSession())
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = mapInfo->MapName->Str[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
{
if (maxResults && counter == maxResults)
{
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index e6fb42853e3..d66a6d24cc2 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -235,9 +235,9 @@ public:
char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
handler->PSendSysMessage(LANG_MAP_POSITION,
- mapId, (mapEntry ? mapEntry->MapName_lang : unknown),
- zoneId, (zoneEntry ? zoneEntry->AreaName_lang : unknown),
- areaId, (areaEntry ? areaEntry->AreaName_lang : unknown),
+ mapId, (mapEntry ? mapEntry->MapName->Str[handler->GetSessionDbcLocale()] : unknown),
+ zoneId, (zoneEntry ? zoneEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown),
+ areaId, (areaEntry ? areaEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown),
object->GetPhaseMask(),
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation());
if (Transport* transport = object->GetTransport())
@@ -1816,15 +1816,15 @@ public:
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
if (area)
{
- areaName = area->AreaName_lang;
+ areaName = area->AreaName->Str[handler->GetSessionDbcLocale()];
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
if (zone)
- zoneName = zone->AreaName_lang;
+ zoneName = zone->AreaName->Str[handler->GetSessionDbcLocale()];
}
if (target)
- handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->MapName_lang,
+ handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->MapName->Str[handler->GetSessionDbcLocale()],
(!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
(!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index 85f4a43b3e4..11c9921a90c 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -93,7 +93,9 @@ public:
target->SetTitle(titleInfo); // to be sure that title now known
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->MaskID);
- handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, tNameLink.c_str());
+ handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id,
+ (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()],
+ tNameLink.c_str());
return true;
}
@@ -135,7 +137,9 @@ public:
std::string tNameLink = handler->GetNameLink(target);
char titleNameStr[80];
- snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, target->GetName().c_str());
+ snprintf(titleNameStr, 80,
+ (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()],
+ target->GetName().c_str());
target->SetTitle(titleInfo);
handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
@@ -183,7 +187,9 @@ public:
std::string tNameLink = handler->GetNameLink(target);
char titleNameStr[80];
- snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, target->GetName().c_str());
+ snprintf(titleNameStr, 80,
+ (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()],
+ target->GetName().c_str());
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());