[Quest API] Add Zone Methods to Perl/Lua (#4268)

* [Quest API] Add Zone Methods to Perl/Lua

* Update zone_store.cpp
This commit is contained in:
Alex King
2024-04-20 22:18:00 -04:00
committed by GitHub
parent 4215a3b9d6
commit 703d2cd1d8
4 changed files with 51 additions and 1 deletions
+26
View File
@@ -162,6 +162,32 @@ std::string ZoneStore::GetZoneLongName(uint32 zone_id)
return {};
}
std::string ZoneStore::GetZoneShortNameByLongName(const std::string& zone_long_name)
{
for (const auto& z : m_zones) {
if (z.long_name == zone_long_name) {
return z.short_name;
}
}
LogInfo("Failed to get zone short name by zone_long_name [{}]", zone_long_name);
return {};
}
uint32 ZoneStore::GetZoneIDByLongName(const std::string& zone_long_name)
{
for (const auto& z : m_zones) {
if (z.long_name == zone_long_name) {
return z.zoneidnumber;
}
}
LogInfo("Failed to get zone ID by zone_long_name [{}]", zone_long_name);
return 0;
}
/**
* @param zone_id
* @param version
+2
View File
@@ -42,6 +42,8 @@ public:
uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id);
std::string GetZoneLongName(uint32 zone_id);
std::string GetZoneShortNameByLongName(const std::string& zone_long_name);
uint32 GetZoneIDByLongName(const std::string& zone_long_name);
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
const char *GetZoneLongName(uint32 zone_id, bool error_unknown = false);
ZoneRepository::Zone *GetZoneWithFallback(uint32 zone_id, int version = 0);