From d68c1a7a6cfd2c640a521fd2f03673418e992be6 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:27:43 -0500 Subject: [PATCH] [Quest API] Add IsInAGuild() to Perl/Lua (#4066) # Perl - Add `$client->IsInAGuild()`. # Lua - Add `client:IsInAGuild()`. # Notes - Allows operators to more accurately tell if a player is in a group. - `GuildID()` returns `uint32` max value if the player isn't in a guild so conditions using it must check for a value over a certain point, this is just a bool that simplifies that logic. --- zone/lua_client.cpp | 7 +++++++ zone/lua_client.h | 1 + zone/perl_client.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 3de1f548a..22612f1c7 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -3290,6 +3290,12 @@ int Lua_Client::GetEXPPercentage() return self->GetEXPPercentage(); } +bool Lua_Client::IsInAGuild() +{ + Lua_Safe_Call_Bool(); + return self->IsInAGuild(); +} + luabind::scope lua_register_client() { return luabind::class_("Client") .def(luabind::constructor<>()) @@ -3578,6 +3584,7 @@ luabind::scope lua_register_client() { .def("IsDueling", (bool(Lua_Client::*)(void))&Lua_Client::IsDueling) .def("IsEXPEnabled", (bool(Lua_Client::*)(void))&Lua_Client::IsEXPEnabled) .def("IsGrouped", (bool(Lua_Client::*)(void))&Lua_Client::IsGrouped) + .def("IsInAGuild", (bool(Lua_Client::*)(void))&Lua_Client::IsInAGuild) .def("IsLD", (bool(Lua_Client::*)(void))&Lua_Client::IsLD) .def("IsMedding", (bool(Lua_Client::*)(void))&Lua_Client::IsMedding) .def("IsRaidGrouped", (bool(Lua_Client::*)(void))&Lua_Client::IsRaidGrouped) diff --git a/zone/lua_client.h b/zone/lua_client.h index 5b7a477a2..70c6c70a6 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -495,6 +495,7 @@ public: void ClearXTargets(); int GetAAEXPPercentage(); int GetEXPPercentage(); + bool IsInAGuild(); void ApplySpell(int spell_id); void ApplySpell(int spell_id, int duration); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 6852fa598..2803314c6 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -3098,6 +3098,11 @@ int Perl_Client_GetEXPPercentage(Client* self) return self->GetEXPPercentage(); } +bool Perl_Client_IsInAGuild(Client* self) +{ + return self->IsInAGuild(); +} + void perl_register_client() { perl::interpreter perl(PERL_GET_THX); @@ -3386,6 +3391,7 @@ void perl_register_client() package.add("IsDueling", &Perl_Client_IsDueling); package.add("IsEXPEnabled", &Perl_Client_IsEXPEnabled); package.add("IsGrouped", &Perl_Client_IsGrouped); + package.add("IsInAGuild", &Perl_Client_IsInAGuild); package.add("IsLD", &Perl_Client_IsLD); package.add("IsMedding", &Perl_Client_IsMedding); package.add("IsRaidGrouped", &Perl_Client_IsRaidGrouped);