[9290] Some cleanups in realmd, no functional changes
[getmangos.git] / src / game / Corpse.h
blobc0fee30332f5e373ebdfc3cb83ee5e6ae923154a
1 /*
2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOSSERVER_CORPSE_H
20 #define MANGOSSERVER_CORPSE_H
22 #include "Object.h"
23 #include "Database/DatabaseEnv.h"
24 #include "GridDefines.h"
25 #include "LootMgr.h"
27 enum CorpseType
29 CORPSE_BONES = 0,
30 CORPSE_RESURRECTABLE_PVE = 1,
31 CORPSE_RESURRECTABLE_PVP = 2
33 #define MAX_CORPSE_TYPE 3
35 // Value equal client resurrection dialog show radius.
36 #define CORPSE_RECLAIM_RADIUS 39
38 enum CorpseFlags
40 CORPSE_FLAG_NONE = 0x00,
41 CORPSE_FLAG_BONES = 0x01,
42 CORPSE_FLAG_UNK1 = 0x02,
43 CORPSE_FLAG_UNK2 = 0x04,
44 CORPSE_FLAG_HIDE_HELM = 0x08,
45 CORPSE_FLAG_HIDE_CLOAK = 0x10,
46 CORPSE_FLAG_LOOTABLE = 0x20
49 class Corpse : public WorldObject
51 public:
52 explicit Corpse( CorpseType type = CORPSE_BONES );
53 ~Corpse( );
55 void AddToWorld();
56 void RemoveFromWorld();
58 bool Create( uint32 guidlow );
59 bool Create( uint32 guidlow, Player *owner );
61 void SaveToDB();
62 bool LoadFromDB(uint32 guid, QueryResult *result);
63 bool LoadFromDB(uint32 guid, Field *fields);
65 void DeleteBonesFromWorld();
66 void DeleteFromDB();
68 uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
70 time_t const& GetGhostTime() const { return m_time; }
71 void ResetGhostTime() { m_time = time(NULL); }
72 CorpseType GetType() const { return m_type; }
74 GridPair const& GetGrid() const { return m_grid; }
75 void SetGrid(GridPair const& grid) { m_grid = grid; }
77 bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
79 Loot loot; // remove insignia ONLY at BG
80 Player* lootRecipient;
81 bool lootForBody;
83 void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
84 void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
85 void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
86 void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); }
87 void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
89 GridReference<Corpse> &GetGridRef() { return m_gridRef; }
91 bool isActiveObject() const { return false; }
92 private:
93 GridReference<Corpse> m_gridRef;
95 CorpseType m_type;
96 time_t m_time;
97 GridPair m_grid; // gride for corpse position for fast search
99 #endif