TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Corpse.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITYCORE_CORPSE_H
20 #define TRINITYCORE_CORPSE_H
21 
22 #include "Object.h"
23 #include "DatabaseEnv.h"
24 #include "GridDefines.h"
25 #include "LootMgr.h"
26 
28 {
32 };
33 #define MAX_CORPSE_TYPE 3
34 
35 // Value equal client resurrection dialog show radius.
36 #define CORPSE_RECLAIM_RADIUS 39
37 
39 {
47 };
48 
49 class 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, Map* map);
59  bool Create(ObjectGuid::LowType guidlow, Player* owner);
60 
61  void SaveToDB();
62  bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
63 
64  void DeleteFromDB(SQLTransaction& trans);
65  static void DeleteFromDB(ObjectGuid const& ownerGuid, SQLTransaction& trans);
66 
68 
69  time_t const& GetGhostTime() const { return m_time; }
70  void ResetGhostTime() { m_time = time(NULL); }
71  CorpseType GetType() const { return m_type; }
72 
73  CellCoord const& GetCellCoord() const { return _cellCoord; }
74  void SetCellCoord(CellCoord const& cellCoord) { _cellCoord = cellCoord; }
75 
76  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
Definition: Corpse.h:31
Definition: Corpse.h:49
Definition: Corpse.h:46
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
void SetCellCoord(CellCoord const &cellCoord)
Definition: Corpse.h:74
void ResetGhostTime()
Definition: Corpse.h:70
CellCoord const & GetCellCoord() const
Definition: Corpse.h:73
Class used to access individual fields of database query result.
Definition: Field.h:56
CorpseFlags
Definition: Corpse.h:38
Definition: Object.h:355
Definition: Corpse.h:40
arena_t NULL
Definition: jemalloc_internal.h:624
CorpseType
Definition: Corpse.h:27
Definition: Object.h:423
bool lootForBody
Definition: Corpse.h:78
CellCoord _cellCoord
Definition: Corpse.h:85
CorpseType m_type
Definition: Corpse.h:83
uint64 LowType
Definition: ObjectGuid.h:199
CorpseType GetType() const
Definition: Corpse.h:71
Definition: Corpse.h:30
time_t const & GetGhostTime() const
Definition: Corpse.h:69
Definition: LootMgr.h:314
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
Player * lootRecipient
Definition: Corpse.h:77
Definition: Map.h:259
virtual void AddToWorld()
Definition: Object.cpp:142
time_t m_time
Definition: Corpse.h:84
Definition: Corpse.h:43
#define TC_GAME_API
Definition: Define.h:134
Loot loot
Definition: Corpse.h:76
Definition: Corpse.h:42
Definition: UpdateFields.h:355
Definition: Corpse.h:45
Definition: ObjectGuid.h:189
Definition: Corpse.h:44
Definition: Corpse.h:41
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
Definition: Corpse.h:29