mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 07:06:23 +00:00
fix(Script/Commands): tele add should only check exact match (#20785)
* fix(Script/Commands): tele add should only check exact match * closes https://github.com/azerothcore/azerothcore-wotlk/issues/20268 * better describe the variable
This commit is contained in:
@@ -8945,7 +8945,7 @@ void ObjectMgr::LoadGameTele()
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
GameTele const* ObjectMgr::GetGameTele(std::string_view name) const
|
||||
GameTele const* ObjectMgr::GetGameTele(std::string_view name, bool exactSearch) const
|
||||
{
|
||||
// explicit name case
|
||||
std::wstring wname;
|
||||
@@ -8961,7 +8961,7 @@ GameTele const* ObjectMgr::GetGameTele(std::string_view name) const
|
||||
{
|
||||
if (itr->second.wnameLow == wname)
|
||||
return &itr->second;
|
||||
else if (!alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
||||
else if (!exactSearch && !alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
||||
alt = &itr->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -1347,7 +1347,7 @@ public:
|
||||
if (itr == _gameTeleStore.end()) return nullptr;
|
||||
return &itr->second;
|
||||
}
|
||||
[[nodiscard]] GameTele const* GetGameTele(std::string_view name) const;
|
||||
[[nodiscard]] GameTele const* GetGameTele(std::string_view name, bool exactSearch = false) const;
|
||||
[[nodiscard]] GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
|
||||
bool AddGameTele(GameTele& data);
|
||||
bool DeleteGameTele(std::string_view name);
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
if (sObjectMgr->GetGameTele(name))
|
||||
if (sObjectMgr->GetGameTele(name, true))
|
||||
{
|
||||
handler->SendErrorMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user