Files
mod-ale/src/LuaEngine/methods/CorpseMethods.h
Foe 81d3f02679 chore: rename Eluna to ALE (#318)
Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
2025-10-23 12:53:30 +02:00

78 lines
1.7 KiB
C++

/*
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef CORPSEMETHODS_H
#define CORPSEMETHODS_H
/***
* The remains of a [Player] that has died.
*
* Inherits all methods from: [Object], [WorldObject]
*/
namespace LuaCorpse
{
/**
* Returns the GUID of the [Player] that left the [Corpse] behind.
*
* @return ObjectGuid ownerGUID
*/
int GetOwnerGUID(lua_State* L, Corpse* corpse)
{
ALE::Push(L, corpse->GetOwnerGUID());
return 1;
}
/**
* Returns the time when the [Player] became a ghost and spawned this [Corpse].
*
* @return uint32 ghostTime
*/
int GetGhostTime(lua_State* L, Corpse* corpse)
{
ALE::Push(L, corpse->GetGhostTime());
return 1;
}
/**
* Returns the [CorpseType] of a [Corpse].
*
* enum CorpseType
* {
* CORPSE_BONES = 0,
* CORPSE_RESURRECTABLE_PVE = 1,
* CORPSE_RESURRECTABLE_PVP = 2
* };
*
* @return [CorpseType] corpseType
*/
int GetType(lua_State* L, Corpse* corpse)
{
ALE::Push(L, corpse->GetType());
return 1;
}
/**
* Sets the "ghost time" to the current time.
*
* See [Corpse:GetGhostTime].
*/
int ResetGhostTime(lua_State* /*L*/, Corpse* corpse)
{
corpse->ResetGhostTime();
return 0;
}
/**
* Saves the [Corpse] to the database.
*/
int SaveToDB(lua_State* /*L*/, Corpse* corpse)
{
corpse->SaveToDB();
return 0;
}
};
#endif