forked from ElunaLuaEngine/Eluna
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CorpseMethods.h
81 lines (75 loc) · 1.79 KB
/
CorpseMethods.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
* 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)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, corpse->GetOwnerGUID());
#else
Eluna::Push(L, corpse->GetOwnerGuid());
#endif
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)
{
Eluna::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)
{
Eluna::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