This commit is contained in:
Kinglykrab 2025-07-10 21:34:43 -04:00
parent 94f75935ae
commit 872eb36528
3 changed files with 34 additions and 4 deletions

View File

@ -838,6 +838,36 @@ void Lua_Zone::Signal(int signal_id)
self->Signal(signal_id);
}
luabind::object Lua_Zone::GetPausedTimers(lua_State* L) {
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetPausedTimers();
int i = 1;
for (const auto& v : l) {
t[i] = v;
i++;
}
}
return t;
}
luabind::object Lua_Zone::GetTimers(lua_State* L) {
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetTimers();
int i = 1;
for (const auto& v : l) {
t[i] = v;
i++;
}
}
return t;
}
luabind::scope lua_register_zone() {
return luabind::class_<Lua_Zone>("Zones")
.def(luabind::constructor<>())
@ -906,6 +936,7 @@ luabind::scope lua_register_zone() {
.def("GetMinimumStatus", &Lua_Zone::GetMinimumStatus)
.def("GetNote", &Lua_Zone::GetNote)
.def("GetNPCMaximumAggroDistance", &Lua_Zone::GetNPCMaximumAggroDistance)
.def("GetPausedTimers", &Lua_Zone::GetPausedTimers)
.def("GetPEQZone", &Lua_Zone::GetPEQZone)
.def("GetRainChance", (int(Lua_Zone::*)(void))&Lua_Zone::GetRainChance)
.def("GetRainChance", (int(Lua_Zone::*)(uint8))&Lua_Zone::GetRainChance)
@ -929,6 +960,7 @@ luabind::scope lua_register_zone() {
.def("GetTimeZone", &Lua_Zone::GetTimeZone)
.def("GetTimerDuration", &Lua_Zone::GetTimerDuration)
.def("GetTimerRemainingTime", &Lua_Zone::GetTimerRemainingTime)
.def("GetTimers", &Lua_Zone::GetTimers)
.def("GetZoneDescription", &Lua_Zone::GetZoneDescription)
.def("GetZoneID", &Lua_Zone::GetZoneID)
.def("GetZoneType", &Lua_Zone::GetZoneType)

View File

@ -158,6 +158,8 @@ public:
void StopAllTimers();
void Signal(int signal_id);
void SendPayload(int payload_id, std::string payload_value);
luabind::object GetPausedTimers(lua_State* L);
luabind::object GetTimers(lua_State* L);
// data buckets
void SetBucket(const std::string& bucket_name, const std::string& bucket_value);

View File

@ -4673,10 +4673,8 @@ std::vector<std::string> QuestManager::GetPausedTimers(Mob* m)
std::vector<std::string> v;
if (m && !PTimerList.empty()) {
LogError("m valid | !PTimerList.empty()");
for (auto e = PTimerList.begin(); e != PTimerList.end(); e++) {
if (e->owner == m) {
LogError("e->owner == m | e->name [{}]", e->name);
v.emplace_back(e->name);
}
}
@ -4690,10 +4688,8 @@ std::vector<std::string> QuestManager::GetTimers(Mob* m)
std::vector<std::string> v;
if (m && !QTimerList.empty()) {
LogError("m valid | !QTimerList.empty()");
for (auto e = QTimerList.begin(); e != QTimerList.end(); e++) {
if (e->mob == m) {
LogError("e->mob == m | e->name [{}]", e->name);
v.emplace_back(e->name);
}
}