TrinityCore
Loading...
Searching...
No Matches
Corpse.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CORPSE_H
19#define TRINITYCORE_CORPSE_H
20
21#include "Object.h"
22#include "GridObject.h"
23#include "DatabaseEnvFwd.h"
24#include "GridDefines.h"
25#include "Loot.h"
26
33#define MAX_CORPSE_TYPE 3
34
35// Value equal client resurrection dialog show radius.
36#define CORPSE_RECLAIM_RADIUS 39
37
48
49class TC_GAME_API Corpse : public WorldObject, public GridObject<Corpse>
50{
51 public:
52 explicit Corpse(CorpseType type = CORPSE_BONES);
53 ~Corpse();
54
55 void AddToWorld() override;
56 void RemoveFromWorld() override;
57
58 bool Create(ObjectGuid::LowType guidlow);
59 bool Create(ObjectGuid::LowType guidlow, Player* owner);
60
61 void SaveToDB();
62 bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
63
64 void DeleteFromDB(CharacterDatabaseTransaction trans);
65 static void DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans);
66
68 uint32 GetFaction() const override;
69
70 time_t const& GetGhostTime() const { return m_time; }
71 void ResetGhostTime();
72 CorpseType GetType() const { return m_type; }
73
74 CellCoord const& GetCellCoord() const { return _cellCoord; }
75 void SetCellCoord(CellCoord const& cellCoord) { _cellCoord = cellCoord; }
76
77 Loot loot; // remove insignia ONLY at BG
79
80 bool IsExpired(time_t t) const;
81
82 private:
84 time_t m_time;
86};
87#endif
CorpseType
Definition Corpse.h:28
@ CORPSE_RESURRECTABLE_PVE
Definition Corpse.h:30
@ CORPSE_RESURRECTABLE_PVP
Definition Corpse.h:31
@ CORPSE_BONES
Definition Corpse.h:29
CorpseFlags
Definition Corpse.h:39
@ CORPSE_FLAG_UNK1
Definition Corpse.h:42
@ CORPSE_FLAG_HIDE_CLOAK
Definition Corpse.h:45
@ CORPSE_FLAG_NONE
Definition Corpse.h:40
@ CORPSE_FLAG_BONES
Definition Corpse.h:41
@ CORPSE_FLAG_UNK2
Definition Corpse.h:43
@ CORPSE_FLAG_HIDE_HELM
Definition Corpse.h:44
@ CORPSE_FLAG_LOOTABLE
Definition Corpse.h:46
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
#define TC_GAME_API
Definition Define.h:114
uint32_t uint32
Definition Define.h:133
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
@ CORPSE_FIELD_OWNER
CellCoord _cellCoord
Definition Corpse.h:85
Player * lootRecipient
Definition Corpse.h:78
CorpseType m_type
Definition Corpse.h:83
Loot loot
Definition Corpse.h:77
time_t const & GetGhostTime() const
Definition Corpse.h:70
CellCoord const & GetCellCoord() const
Definition Corpse.h:74
time_t m_time
Definition Corpse.h:84
ObjectGuid GetOwnerGUID() const override
Definition Corpse.h:67
void SetCellCoord(CellCoord const &cellCoord)
Definition Corpse.h:75
CorpseType GetType() const
Definition Corpse.h:72
Class used to access individual fields of database query result.
Definition Field.h:92
uint32 LowType
Definition ObjectGuid.h:142
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:281
void AddToWorld() override
Definition Object.cpp:1060
void RemoveFromWorld() override
Definition Object.cpp:1066
virtual uint32 GetFaction() const =0
Definition Loot.h:207