From 42e5be76fc787bd6055192b9348a36cf3c8979e8 Mon Sep 17 00:00:00 2001 From: Aldori Date: Fri, 22 Aug 2025 15:24:33 -0400 Subject: [PATCH] feat(CreatureMethods): Add GetCreatureSpawnId and SetCorpseDelay methods (#300) --- src/LuaEngine/LuaFunctions.cpp | 2 ++ src/LuaEngine/methods/CreatureMethods.h | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index ce757d6..78253ef 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -776,6 +776,7 @@ ElunaRegister CreatureMethods[] = { "GetRespawnDelay", &LuaCreature::GetRespawnDelay }, { "GetWanderRadius", &LuaCreature::GetWanderRadius }, { "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId }, + { "GetSpawnId", &LuaCreature::GetSpawnId }, { "GetWaypointPath", &LuaCreature::GetWaypointPath }, { "GetLootMode", &LuaCreature::GetLootMode }, { "GetLootRecipient", &LuaCreature::GetLootRecipient }, @@ -795,6 +796,7 @@ ElunaRegister CreatureMethods[] = { "SetHover", &LuaCreature::SetHover }, { "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, + { "SetCorpseDelay", &LuaCreature::SetCorpseDelay }, { "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance }, { "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance }, { "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType }, diff --git a/src/LuaEngine/methods/CreatureMethods.h b/src/LuaEngine/methods/CreatureMethods.h index 10cd444..52f5f1f 100644 --- a/src/LuaEngine/methods/CreatureMethods.h +++ b/src/LuaEngine/methods/CreatureMethods.h @@ -434,6 +434,17 @@ namespace LuaCreature return 1; } + /** + * Returns the spawn ID for this [Creature]. + * + * @return uint32 spawnId + */ + int GetSpawnId(lua_State* L, Creature* creature) + { + Eluna::Push(L, creature->GetSpawnId()); + return 1; + } + /** * Returns the default movement type for this [Creature]. * @@ -1134,6 +1145,18 @@ namespace LuaCreature return 0; } + /** + * Sets the time it takes for the [Creature]'s corpse to despawn when killed. + * + * @param uint32 delay : the delay, in seconds + */ + int SetCorpseDelay(lua_State* L, Creature* creature) + { + uint32 delay = Eluna::CHECKVAL(L, 2); + creature->SetCorpseDelay(delay); + return 0; + } + /** * Make the [Creature] start following its waypoint path. */