aboutsummaryrefslogtreecommitdiff
path: root/src/game/Level3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Level3.cpp')
-rw-r--r--src/game/Level3.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 474a79c5680..1130bcec070 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -3694,6 +3694,68 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args)
return true;
}
+bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
+{
+ if(!*args)
+ return false;
+
+ std::string namepart = args;
+ std::wstring wnamepart;
+
+ if(!Utf8toWStr(namepart,wnamepart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower( wnamepart );
+
+ uint32 counter = 0; // Counter for figure out that we found smth.
+
+ // Search in TaxiNodes.dbc
+ for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
+ {
+ TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id);
+ if(nodeEntry)
+ {
+ int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
+ std::string name = nodeEntry->name[loc];
+ if(name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wnamepart))
+ {
+ loc = 0;
+ for(; loc < MAX_LOCALE; ++loc)
+ {
+ if(m_session && loc==m_session->GetSessionDbcLocale())
+ continue;
+
+ name = nodeEntry->name[loc];
+ if(name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wnamepart))
+ break;
+ }
+ }
+
+ if(loc < MAX_LOCALE)
+ {
+ // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
+ if (m_session)
+ PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(),localeNames[loc],
+ nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z);
+ else
+ PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
+ nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z);
+ ++counter;
+ }
+ }
+ }
+ if (counter == 0) // if counter == 0 then we found nth
+ SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ return true;
+}
+
/** \brief GM command level 3 - Create a guild.
*
* This command allows a GM (level 3) to create a guild.