aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/3.3.5/2018_08_30_03_world.sql12
-rw-r--r--src/server/game/Miscellaneous/Language.h11
-rw-r--r--src/server/scripts/Commands/cs_go.cpp81
3 files changed, 52 insertions, 52 deletions
diff --git a/sql/updates/world/3.3.5/2018_08_30_03_world.sql b/sql/updates/world/3.3.5/2018_08_30_03_world.sql
new file mode 100644
index 00000000000..694a99ee25c
--- /dev/null
+++ b/sql/updates/world/3.3.5/2018_08_30_03_world.sql
@@ -0,0 +1,12 @@
+--
+DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1189 AND 1197;
+INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
+(1189, "No instances were found matching your input"),
+(1190, "Multiple instances match your input - please be more specific:"),
+(1191, "│ %03u - %s"),
+(1192, "Specified map %u is not instanced"),
+(1193, "Could not find entrance portal for map %u (%s)"),
+(1194, "Could not find exit portal for map %u (%s)"),
+(1195, "Teleported you to the entrance of mapid %u (%s)"),
+(1196, "Teleported you to the starting location of mapid %u (%s)"),
+(1197, "Failed to teleport you to mapid %u (%s) - missing attunement/expansion for parent map %u?");
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 443f7fcff50..146437829a7 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -927,7 +927,16 @@ enum TrinityStrings
LANG_GROUP_ROLE_CHANGED = 1186,
LANG_LEADER_CANNOT_BE_ASSISTANT = 1187,
LANG_BAN_EXISTS = 1188,
- // Room for more level 3 1189-1199 not used
+ LANG_COMMAND_NO_INSTANCES_MATCH = 1189,
+ LANG_COMMAND_MULTIPLE_INSTANCES_MATCH = 1190,
+ LANG_COMMAND_MULTIPLE_INSTANCES_ENTRY = 1191,
+ LANG_COMMAND_MAP_NOT_INSTANCE = 1192,
+ LANG_COMMAND_INSTANCE_NO_ENTRANCE = 1193,
+ LANG_COMMAND_INSTANCE_NO_EXIT = 1194,
+ LANG_COMMAND_WENT_TO_INSTANCE_GATE = 1195,
+ LANG_COMMAND_WENT_TO_INSTANCE_START = 1196,
+ LANG_COMMAND_GO_INSTANCE_FAILED = 1197,
+ // Room for more level 3 1197-1199 not used
// Debug commands
LANG_CINEMATIC_NOT_EXIST = 1200,
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 87f48eff658..b4ff17308ff 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -563,33 +563,11 @@ public:
if (!*args)
return false;
- std::vector<std::string> labels;
-
- // tokenize and convert to lowercase
char* pos = const_cast<char*>(args);
- char* last = nullptr;
- do
- {
- if (*pos == ' ')
- {
- if (last)
- {
- *pos = '\0';
- labels.emplace_back(last);
- last = nullptr;
- }
- }
- else
- {
- if (!last)
- last = pos;
- *pos = tolower(*pos);
- }
- } while (*++pos);
- if (last)
- labels.emplace_back(last);
- // tokenizing done
+ do *pos = tolower(*pos);
+ while (*(++pos));
+ Tokenizer labels(args, ' ');
uint32 mapid = 0;
if (labels.size() == 1)
{
@@ -604,7 +582,7 @@ public:
{
uint32 count = 0;
std::string const& scriptName = sObjectMgr->GetScriptName(pair.second.ScriptId);
- for (std::string const& label : labels)
+ for (char const* label : labels)
if (scriptName.find(label) != std::string::npos)
++count;
@@ -613,7 +591,7 @@ public:
}
if (matches.empty())
{
- handler->SendSysMessage("No matches found for your input");
+ handler->SendSysMessage(LANG_COMMAND_NO_INSTANCES_MATCH);
return false;
}
auto it = matches.rbegin();
@@ -621,10 +599,10 @@ public:
mapid = it->second.first;
if (++it != matches.rend() && it->first == maxCount)
{
- handler->SendSysMessage("Multiple matches found for your input - please specify:");
+ handler->SendSysMessage(LANG_COMMAND_MULTIPLE_INSTANCES_MATCH);
--it;
do
- handler->PSendSysMessage("* Map %03u: '%s'", it->second.first, it->second.second);
+ handler->PSendSysMessage(LANG_COMMAND_MULTIPLE_INSTANCES_ENTRY, it->second.first, it->second.second);
while (++it != matches.rend() && it->first == maxCount);
handler->SetSentErrorMessage(true);
return false;
@@ -636,19 +614,11 @@ public:
InstanceTemplate const* temp = sObjectMgr->GetInstanceTemplate(mapid);
if (!temp)
{
- handler->PSendSysMessage("Map %u is not instanced", mapid);
+ handler->PSendSysMessage(LANG_COMMAND_MAP_NOT_INSTANCE, mapid);
handler->SetSentErrorMessage(true);
return false;
}
std::string const& scriptname = sObjectMgr->GetScriptName(temp->ScriptId);
-
- AreaTrigger const* entrance = sObjectMgr->GetMapEntranceTrigger(mapid);
- if (!entrance)
- {
- handler->PSendSysMessage("Could not find entrance for instance %u (%s)", mapid, scriptname);
- handler->SetSentErrorMessage(true);
- return false;
- }
Player* player = handler->GetSession()->GetPlayer();
if (player->IsInFlight())
@@ -656,22 +626,31 @@ public:
else
player->SaveRecallPosition();
- if (player->TeleportTo(entrance->target_mapId, entrance->target_X, entrance->target_Y, entrance->target_Z, entrance->target_Orientation))
- handler->PSendSysMessage("Teleported you to entrance of mapid %u (%s)", mapid, scriptname);
- else
+ // try going to entrance
+ AreaTrigger const* exit = sObjectMgr->GetGoBackTrigger(mapid);
+ if (!exit)
+ handler->PSendSysMessage(LANG_COMMAND_INSTANCE_NO_EXIT, mapid, scriptname);
+
+ if (exit && player->TeleportTo(exit->target_mapId, exit->target_X, exit->target_Y, exit->target_Z, exit->target_Orientation + M_PI))
{
- AreaTrigger const* exit = sObjectMgr->GetGoBackTrigger(mapid);
- if (player->TeleportTo(exit->target_mapId, exit->target_X, exit->target_Y, exit->target_Z, exit->target_Orientation + M_PI))
- handler->PSendSysMessage("Teleported you in front of entrance to mapid %u (%s)", mapid, scriptname);
- else
- {
- handler->PSendSysMessage("Failed to teleport you to entrance of mapid %u (%s) - missing attunement/expansion for parent map?", mapid, scriptname);
- handler->SetSentErrorMessage(true);
- return false;
- }
+ handler->PSendSysMessage(LANG_COMMAND_WENT_TO_INSTANCE_GATE, mapid, scriptname);
+ return true;
}
- return true;
+ // try going to start
+ AreaTrigger const* entrance = sObjectMgr->GetMapEntranceTrigger(mapid);
+ if (!entrance)
+ handler->PSendSysMessage(LANG_COMMAND_INSTANCE_NO_ENTRANCE, mapid, scriptname);
+
+ if (entrance && player->TeleportTo(entrance->target_mapId, entrance->target_X, entrance->target_Y, entrance->target_Z, entrance->target_Orientation))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_WENT_TO_INSTANCE_START, mapid, scriptname);
+ return true;
+ }
+
+ handler->PSendSysMessage(LANG_COMMAND_GO_INSTANCE_FAILED, mapid, scriptname, exit->target_mapId);
+ handler->SetSentErrorMessage(true);
+ return false;
}
};