[Quest API] Add Zone Uptime Exports to Perl/Lua (#4339)

This commit is contained in:
Alex King 2024-05-26 10:06:38 -04:00 committed by GitHub
parent 316fa54bd8
commit cd03152550
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -1547,16 +1547,17 @@ void PerlembParser::ExportMobVariables(
void PerlembParser::ExportZoneVariables(std::string& package_name)
{
if (zone) {
ExportVar(package_name.c_str(), "zoneid", zone->GetZoneID());
ExportVar(package_name.c_str(), "zoneln", zone->GetLongName());
ExportVar(package_name.c_str(), "zonesn", zone->GetShortName());
ExportVar(package_name.c_str(), "instanceid", zone->GetInstanceID());
ExportVar(package_name.c_str(), "instanceversion", zone->GetInstanceVersion());
TimeOfDay_Struct eqTime{ };
zone->zone_time.GetCurrentEQTimeOfDay(time(0), &eqTime);
ExportVar(package_name.c_str(), "zonehour", eqTime.hour - 1);
ExportVar(package_name.c_str(), "zoneid", zone->GetZoneID());
ExportVar(package_name.c_str(), "zoneln", zone->GetLongName());
ExportVar(package_name.c_str(), "zonemin", eqTime.minute);
ExportVar(package_name.c_str(), "zonesn", zone->GetShortName());
ExportVar(package_name.c_str(), "zonetime", (eqTime.hour - 1) * 100 + eqTime.minute);
ExportVar(package_name.c_str(), "zoneuptime", Timer::GetCurrentTime() / 1000);
ExportVar(package_name.c_str(), "zoneweather", zone->zone_weather);
}
}

View File

@ -5576,6 +5576,11 @@ bool lua_send_parcel(luabind::object lua_table)
return CharacterParcelsRepository::InsertOne(database, e).id;
}
uint32 lua_get_zone_uptime()
{
return Timer::GetCurrentTime() / 1000;
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@ -6380,6 +6385,7 @@ luabind::scope lua_register_general() {
luabind::def("get_zone_id_by_long_name", &lua_get_zone_id_by_long_name),
luabind::def("get_zone_short_name_by_long_name", &lua_get_zone_short_name_by_long_name),
luabind::def("send_parcel", &lua_send_parcel),
luabind::def("get_zone_uptime", &lua_get_zone_uptime),
/*
Cross Zone
*/