2 * Copyright (C) 2005-2009 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
23 #include "Database/DatabaseEnv.h"
24 #include "GridDefines.h"
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
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
52 explicit Corpse( CorpseType type
= CORPSE_BONES
);
56 void RemoveFromWorld();
58 bool Create( uint32 guidlow
);
59 bool Create( uint32 guidlow
, Player
*owner
);
62 bool LoadFromDB(uint32 guid
, QueryResult
*result
);
63 bool LoadFromDB(uint32 guid
, Field
*fields
);
65 void DeleteBonesFromWorld();
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
, bool inVisibleList
) const;
79 Loot loot
; // remove insignia ONLY at BG
80 Player
* lootRecipient
;
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; }
93 GridReference
<Corpse
> m_gridRef
;
97 GridPair m_grid
; // gride for corpse position for fast search