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", " ");
|
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
|
// explicit name case
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
@@ -8961,7 +8961,7 @@ GameTele const* ObjectMgr::GetGameTele(std::string_view name) const
|
|||||||
{
|
{
|
||||||
if (itr->second.wnameLow == wname)
|
if (itr->second.wnameLow == wname)
|
||||||
return &itr->second;
|
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;
|
alt = &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1347,7 +1347,7 @@ public:
|
|||||||
if (itr == _gameTeleStore.end()) return nullptr;
|
if (itr == _gameTeleStore.end()) return nullptr;
|
||||||
return &itr->second;
|
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; }
|
[[nodiscard]] GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
|
||||||
bool AddGameTele(GameTele& data);
|
bool AddGameTele(GameTele& data);
|
||||||
bool DeleteGameTele(std::string_view name);
|
bool DeleteGameTele(std::string_view name);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
if (!player)
|
if (!player)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sObjectMgr->GetGameTele(name))
|
if (sObjectMgr->GetGameTele(name, true))
|
||||||
{
|
{
|
||||||
handler->SendErrorMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
handler->SendErrorMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user