aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/4159_world.sql14
-rw-r--r--sql/world.sql9
-rw-r--r--src/game/Chat.cpp1
-rw-r--r--src/game/Chat.h1
-rw-r--r--src/game/Language.h13
-rw-r--r--src/game/Level3.cpp97
6 files changed, 133 insertions, 2 deletions
diff --git a/sql/updates/4159_world.sql b/sql/updates/4159_world.sql
new file mode 100644
index 00000000000..00778695c76
--- /dev/null
+++ b/sql/updates/4159_world.sql
@@ -0,0 +1,14 @@
+DELETE FROM `trinity_string` WHERE `entry` BETWEEN 5012 AND 5019;
+INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
+(5012, 'No maps found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5013, '[Continent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5014, '[Instance]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5015, '[Battleground]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5016, '[Arena]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5017, '[Raid reset time: %u]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5018, '[Heroic reset time: %u]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5019, '[Mountable]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+DELETE FROM `command` WHERE `name` = 'lookup map';
+INSERT INTO `command` (`name`, `security`, `help`) VALUES
+('lookup map', 3, 'Syntax: .lookup map $namepart\r\n\r\nLooks up a map by $namepart, and returns all matches with their map ID''s.');
diff --git a/sql/world.sql b/sql/world.sql
index 5af5d424e8d..5063a6c20f0 100644
--- a/sql/world.sql
+++ b/sql/world.sql
@@ -430,6 +430,7 @@ INSERT INTO `command` VALUES
('lookup faction',3,'Syntax: .lookup faction $name\r\nAttempts to find the ID of the faction with the provided $name.'),
('lookup item',3,'Syntax: .lookup item $itemname\r\n\r\nLooks up an item by $itemname, and returns all matches with their Item ID\'s.'),
('lookup itemset',3,'Syntax: .lookup itemset $itemname\r\n\r\nLooks up an item set by $itemname, and returns all matches with their Item set ID\'s.'),
+('lookup map',3,'Syntax: .lookup map $namepart\r\n\r\nLooks up a map by $namepart, and returns all matches with their map ID''s.'),
('lookup object',3,'Syntax: .lookup object $objname\r\n\r\nLooks up an gameobject by $objname, and returns all matches with their Gameobject ID\'s.'),
('lookup player account',2,'Syntax: .lookup player account $account ($limit) \r\n\r\n Searchs players, which account username is $account with optional parametr $limit of results.'),
('lookup player email',2,'Syntax: .lookup player email $email ($limit) \r\n\r\n Searchs players, which account email is $email with optional parametr $limit of results.'),
@@ -15404,6 +15405,14 @@ INSERT INTO `trinity_string` VALUES
(5009,'Sound %u Played to server',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(5010,'linkGUID: %u, Entry: %u (%s)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(5011,'You can\'t teleport self to self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5012,'No maps found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5013,'[Continent]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5014,'[Instance]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5015,'[Battleground]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5016,'[Arena]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5017,'[Raid reset time: %u]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5018,'[Heroic reset time: %u]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5019,'[Mountable]',NULL NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(6613,'|cfff00000[GM Announcement]: %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(6614,'Notification to GM\'s - ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(6615,'|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 416696b4369..d1e85f6baa0 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -306,6 +306,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL },
{ "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL },
{ "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
diff --git a/src/game/Chat.h b/src/game/Chat.h
index f5d889479c2..b970628f94f 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -256,6 +256,7 @@ class ChatHandler
bool HandleLookupSpellCommand(const char* args);
bool HandleLookupTaxiNodeCommand(const char * args);
bool HandleLookupTeleCommand(const char * args);
+ bool HandleLookupMapCommand(const char* args);
bool HandleModifyKnownTitlesCommand(const char* args);
bool HandleModifyHPCommand(const char* args);
diff --git a/src/game/Language.h b/src/game/Language.h
index 2b063999951..c16393eba1c 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -854,7 +854,16 @@ enum TrinityStrings
LANG_COMMAND_PLAYED_TO_ALL = 5009,
LANG_NPCINFO_LINKGUID = 5010,
LANG_TELEPORTED_TO_BY_CONSOLE = 5011,
- // Room for more Trinity strings 5012-9999
+ // for command lookup map
+ LANG_COMMAND_NOMAPFOUND = 5012,
+ LANG_CONTINENT = 5013,
+ LANG_INSTANCE = 5014,
+ LANG_BATTLEGROUND = 5015,
+ LANG_ARENA = 5016,
+ LANG_RAID = 5017,
+ LANG_HEROIC = 5018,
+ LANG_MOUNTABLE = 5019,
+ // Room for more Trinity strings 5020-9999
// Used for GM Announcements
LANG_GM_BROADCAST = 6613,
LANG_GM_NOTIFY = 6614,
@@ -929,7 +938,7 @@ enum TrinityStrings
LANG_OPVP_EP_FLIGHT_CGT = 10053,
LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054,
LANG_OPVP_ZM_GOSSIP_HORDE = 10055,
-
+
// Use for custom patches 11000-11999
// NOT RESERVED IDS 12000-1999999999
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 30a646ee4b4..849565cc030 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -3799,6 +3799,103 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
return true;
}
+bool ChatHandler::HandleLookupMapCommand(const char* args)
+{
+ if(!*args)
+ return false;
+
+ std::string namepart = args;
+ std::wstring wnamepart;
+
+ // converting string that we try to find to lower case
+ if(!Utf8toWStr(namepart, wnamepart))
+ return false;
+
+ wstrToLower(wnamepart);
+
+ uint32 counter = 0;
+
+ // search in Map.dbc
+ for(uint32 id = 0; id < sMapStore.GetNumRows(); id++)
+ {
+ MapEntry const* MapInfo = sMapStore.LookupEntry(id);
+ if(MapInfo)
+ {
+ uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
+
+ std::string name = MapInfo->name[loc];
+ if(name.empty())
+ continue;
+
+ if(!Utf8FitTo(name, wnamepart))
+ {
+ loc = LOCALE_enUS;
+ for(; loc < MAX_LOCALE; loc++)
+ {
+ if(m_session && loc == m_session->GetSessionDbcLocale())
+ continue;
+
+ name = MapInfo->name[loc];
+ if(name.empty())
+ continue;
+
+ if(Utf8FitTo(name, wnamepart))
+ break;
+ }
+ }
+
+ if(loc < MAX_LOCALE)
+ {
+ // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
+ std::ostringstream ss;
+
+ if(m_session)
+ ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << "]";
+ else // console
+ ss << id << " - [" << name << "]";
+
+ if(MapInfo->IsContinent())
+ ss << GetTrinityString(LANG_CONTINENT);
+
+ switch(MapInfo->map_type)
+ {
+ case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break;
+ case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break;
+ case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break;
+ }
+
+ if(MapInfo->IsRaid())
+ ss << GetTrinityString(LANG_RAID);
+
+ if(MapInfo->SupportsHeroicMode())
+ ss << GetTrinityString(LANG_HEROIC);
+
+ uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
+ uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
+
+ if(MapInfo->IsMountAllowed())
+ ss << GetTrinityString(LANG_MOUNTABLE);
+
+ if(ResetTimeRaid && !ResetTimeHeroic)
+ PSendSysMessage(ss.str().c_str(), ResetTimeRaid);
+ else if(!ResetTimeRaid && ResetTimeHeroic)
+ PSendSysMessage(ss.str().c_str(), ResetTimeHeroic);
+ else if(ResetTimeRaid && ResetTimeHeroic)
+ PSendSysMessage(ss.str().c_str(), ResetTimeRaid, ResetTimeHeroic);
+ else
+ SendSysMessage(ss.str().c_str());
+
+ counter++;
+ }
+ }
+ }
+
+ if(!counter)
+ SendSysMessage(LANG_COMMAND_NOMAPFOUND);
+
+ return true;
+}
+
/** \brief GM command level 3 - Create a guild.
*
* This command allows a GM (level 3) to create a guild.