From 29cdd91ca0447b853f0ce1a27e05fcfdebd22a50 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Wed, 11 May 2022 06:35:27 -0400 Subject: [PATCH] [Quest API] Add GetHealAmount() and GetSpellDamage() to Perl/Lua. (#2165) - Add $client->GetHealAmount() to Perl. - Add $client->GetSpellDamage() to Perl. - Add client:GetHealAmount() to Lua - Add client:GetSpellDamage() to Lua. --- zone/lua_client.cpp | 12 ++++++++++++ zone/lua_client.h | 2 ++ zone/perl_client.cpp | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 59b22a91f..52b7edf53 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -2476,6 +2476,16 @@ void Lua_Client::SetPEQZoneFlag(uint32 zone_id) { self->SetPEQZoneFlag(zone_id); } +int Lua_Client::GetHealAmount() { + Lua_Safe_Call_Int(); + return self->GetHealAmt(); +} + +int Lua_Client::GetSpellDamage() { + Lua_Safe_Call_Int(); + return self->GetSpellDmg(); +} + luabind::scope lua_register_client() { return luabind::class_("Client") .def(luabind::constructor<>()) @@ -2619,6 +2629,7 @@ luabind::scope lua_register_client() { .def("GetGroup", (Lua_Group(Lua_Client::*)(void))&Lua_Client::GetGroup) .def("GetGroupPoints", (uint32(Lua_Client::*)(void))&Lua_Client::GetGroupPoints) .def("GetHorseId", (int(Lua_Client::*)(void))&Lua_Client::GetHorseId) + .def("GetHealAmount", (int(Lua_Client::*)(void))&Lua_Client::GetHealAmount) .def("GetHunger", (int(Lua_Client::*)(void))&Lua_Client::GetHunger) .def("GetIP", (uint32(Lua_Client::*)(void))&Lua_Client::GetIP) .def("GetIPExemption", (int(Lua_Client::*)(void))&Lua_Client::GetIPExemption) @@ -2659,6 +2670,7 @@ luabind::scope lua_register_client() { .def("GetScribeableSpells", (luabind::object(Lua_Client::*)(lua_State* L,uint8,uint8))&Lua_Client::GetScribeableSpells) .def("GetScribedSpells", (luabind::object(Lua_Client::*)(lua_State* L))&Lua_Client::GetScribedSpells) .def("GetSkillPoints", (int(Lua_Client::*)(void))&Lua_Client::GetSkillPoints) + .def("GetSpellDamage", (int(Lua_Client::*)(void))&Lua_Client::GetSpellDamage) .def("GetSpellIDByBookSlot", (uint32(Lua_Client::*)(int))&Lua_Client::GetSpellIDByBookSlot) .def("GetSpentAA", (int(Lua_Client::*)(void))&Lua_Client::GetSpentAA) .def("GetStartZone", (int(Lua_Client::*)(void))&Lua_Client::GetStartZone) diff --git a/zone/lua_client.h b/zone/lua_client.h index f38516cdf..3a3635e62 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -409,6 +409,8 @@ public: int CountItemEquippedByID(uint32 item_id); bool HasAugmentEquippedByID(uint32 item_id); bool HasItemEquippedByID(uint32 item_id); + int GetHealAmount(); + int GetSpellDamage(); int GetEnvironmentDamageModifier(); void SetEnvironmentDamageModifier(int value); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 0cbbe7e45..f439867f9 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -6332,6 +6332,40 @@ XS(XS_Client_SetPEQZoneFlag) { XSRETURN_EMPTY; } +XS(XS_Client_GetHealAmount); +XS(XS_Client_GetHealAmount) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: Client::GetHealAmount(THIS)"); // @categories Stats and Attributes, Scriot Utility + { + Client *THIS; + int RETVAL; + dXSTARG; + VALIDATE_THIS_IS_CLIENT; + RETVAL = THIS->GetHealAmt(); + XSprePUSH; + PUSHi((IV) RETVAL); + } + XSRETURN(1); +} + +XS(XS_Client_GetSpellDamage); +XS(XS_Client_GetSpellDamage) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: Client::GetSpellDamage(THIS)"); // @categories Stats and Attributes, Scriot Utility + { + Client *THIS; + int RETVAL; + dXSTARG; + VALIDATE_THIS_IS_CLIENT; + RETVAL = THIS->GetSpellDmg(); + XSprePUSH; + PUSHi((IV) RETVAL); + } + XSRETURN(1); +} + #ifdef __cplusplus extern "C" #endif @@ -6462,6 +6496,7 @@ XS(boot_Client) { newXSproto(strcpy(buf, "GetGM"), XS_Client_GetGM, file, "$"); newXSproto(strcpy(buf, "GetGroup"), XS_Client_GetGroup, file, "$"); newXSproto(strcpy(buf, "GetGroupPoints"), XS_Client_GetGroupPoints, file, "$"); + newXSproto(strcpy(buf, "GetHealAmount"), XS_Client_GetHealAmount, file, "$"); newXSproto(strcpy(buf, "GetHorseId"), XS_Client_GetHorseId, file, "$"); newXSproto(strcpy(buf, "GetHunger"), XS_Client_GetHunger, file, "$$"); newXSproto(strcpy(buf, "GetIP"), XS_Client_GetIP, file, "$"); @@ -6499,6 +6534,7 @@ XS(boot_Client) { newXSproto(strcpy(buf, "GetScribedSpells"), XS_Client_GetScribedSpells, file, "$"); newXSproto(strcpy(buf, "GetSkillPoints"), XS_Client_GetSkillPoints, file, "$"); newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$"); + newXSproto(strcpy(buf, "GetSpellDamage"), XS_Client_GetSpellDamage, file, "$"); newXSproto(strcpy(buf, "GetSpellIDByBookSlot"), XS_Client_GetSpellIDByBookSlot, file, "$$"); newXSproto(strcpy(buf, "GetSpentAA"), XS_Client_GetSpentAA, file, "$$"); newXSproto(strcpy(buf, "GetStartZone"), XS_Client_GetStartZone, file, "$");