OregonCore  revision fb2a440-git
Your Favourite TBC server
Corpse.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore 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 OREGONCORE_CORPSE_H
19 #define OREGONCORE_CORPSE_H
20 
21 #include "Object.h"
22 #include "Database/DatabaseEnv.h"
23 #include "GridDefines.h"
24 #include "LootMgr.h"
25 
27 {
31 };
32 #define MAX_CORPSE_TYPE 3
33 
34 // Value equal client resurrection dialog show radius.
35 #define CORPSE_RECLAIM_RADIUS 39
36 
38 {
46 };
47 
48 class Corpse : public WorldObject, public GridObject<Corpse>
49 {
50  public:
51  explicit Corpse(CorpseType type = CORPSE_BONES);
52  ~Corpse() override;
53 
54  void AddToWorld() override;
55  void RemoveFromWorld() override;
56 
57  bool Create(uint32 guidlow, Map* map);
58  bool Create(uint32 guidlow, Player* owner, uint32 mapid, float x, float y, float z, float ang);
59 
60  void SaveToDB();
61  bool LoadCorpseFromDB(uint32 guid, Field* fields);
62 
63  void DeleteBonesFromWorld();
64  void DeleteFromDB();
65 
66  uint64 const& GetOwnerGUID() const
67  {
69  }
70 
71  time_t const& GetGhostTime() const
72  {
73  return m_time;
74  }
76  {
77  m_time = time(NULL);
78  }
80  {
81  return m_type;
82  }
83 
84  GridCoord const& GetGridCoord() const
85  {
86  return _gridCoord;
87  }
88  void SetGridCoord(GridCoord const& grid)
89  {
90  _gridCoord = grid;
91  }
92 
93  Loot loot; // remove insignia ONLY at BG
96 
97  void Say(const char* text, uint32 language, uint64 TargetGuid)
98  {
99  MonsterSay(text, language, TargetGuid);
100  }
101  void Yell(const char* text, uint32 language, uint64 TargetGuid)
102  {
103  MonsterYell(text, language, TargetGuid);
104  }
105  void TextEmote(const char* text, uint64 TargetGuid)
106  {
107  MonsterTextEmote(text, TargetGuid);
108  }
109  void Whisper(const char* text, uint64 receiver)
110  {
111  MonsterWhisper(text, receiver);
112  }
113  void Say(int32 textId, uint32 language, uint64 TargetGuid)
114  {
115  MonsterSay(textId, language, TargetGuid);
116  }
117  void Yell(int32 textId, uint32 language, uint64 TargetGuid)
118  {
119  MonsterYell(textId, language, TargetGuid);
120  }
121  void TextEmote(int32 textId, uint64 TargetGuid)
122  {
123  MonsterTextEmote(textId, TargetGuid);
124  }
125  void Whisper(int32 textId, uint64 receiver)
126  {
127  MonsterWhisper(textId, receiver);
128  }
129 
130  bool IsExpired(time_t t) const;
131 
132  private:
134  time_t m_time;
135  GridCoord _gridCoord; // gride for corpse position for fast search
136 };
137 #endif
138 
Definition: Corpse.h:48
void DeleteFromDB()
Definition: Corpse.cpp:149
void Yell(int32 textId, uint32 language, uint64 TargetGuid)
Definition: Corpse.h:117
void ResetGhostTime()
Definition: Corpse.h:75
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1504
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1490
void RemoveFromWorld() override
Definition: Corpse.cpp:55
Definition: Field.h:24
CorpseFlags
Definition: Corpse.h:37
const uint64 & GetUInt64Value(uint16 index) const
Definition: Object.h:240
ACE_INT32 int32
Definition: Define.h:67
CorpseType
Definition: Corpse.h:26
bool lootForBody
Definition: Corpse.h:95
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1497
CorpseType m_type
Definition: Corpse.h:133
~Corpse() override
Definition: Corpse.cpp:42
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1511
CorpseType GetType() const
Definition: Corpse.h:79
void Whisper(int32 textId, uint64 receiver)
Definition: Corpse.h:125
void AddToWorld() override
Definition: Corpse.cpp:46
void TextEmote(const char *text, uint64 TargetGuid)
Definition: Corpse.h:105
time_t const & GetGhostTime() const
Definition: Corpse.h:71
void Whisper(const char *text, uint64 receiver)
Definition: Corpse.h:109
bool Create(uint32 guidlow, Map *map)
Definition: Corpse.cpp:64
void Say(const char *text, uint32 language, uint64 TargetGuid)
Definition: Corpse.h:97
Definition: LootMgr.h:290
void TextEmote(int32 textId, uint64 TargetGuid)
Definition: Corpse.h:121
bool IsExpired(time_t t) const
Definition: Corpse.cpp:205
Player * lootRecipient
Definition: Corpse.h:94
Definition: Map.h:266
void SaveToDB()
Definition: Corpse.cpp:102
ACE_UINT64 uint64
Definition: Define.h:70
GridCoord _gridCoord
Definition: Corpse.h:135
void DeleteBonesFromWorld()
Definition: Corpse.cpp:135
uint64 const & GetOwnerGUID() const
Definition: Corpse.h:66
time_t m_time
Definition: Corpse.h:134
GridCoord const & GetGridCoord() const
Definition: Corpse.h:84
Loot loot
Definition: Corpse.h:93
Corpse(CorpseType type=CORPSE_BONES)
Definition: Corpse.cpp:28
ACE_UINT32 uint32
Definition: Define.h:71
void Yell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Corpse.h:101
Definition: Player.h:922
bool LoadCorpseFromDB(uint32 guid, Field *fields)
Definition: Corpse.cpp:159
void Say(int32 textId, uint32 language, uint64 TargetGuid)
Definition: Corpse.h:113
void SetGridCoord(GridCoord const &grid)
Definition: Corpse.h:88