1 | /* |
---|
2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
3 | * |
---|
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. |
---|
8 | * |
---|
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. |
---|
13 | * |
---|
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 |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef MANGOSSERVER_CORPSE_H |
---|
20 | #define MANGOSSERVER_CORPSE_H |
---|
21 | |
---|
22 | #include "Object.h" |
---|
23 | #include "Database/DatabaseEnv.h" |
---|
24 | #include "GridDefines.h" |
---|
25 | #include "LootMgr.h" |
---|
26 | |
---|
27 | enum CorpseType |
---|
28 | { |
---|
29 | CORPSE_BONES = 0, |
---|
30 | CORPSE_RESURRECTABLE_PVE = 1, |
---|
31 | CORPSE_RESURRECTABLE_PVP = 2 |
---|
32 | }; |
---|
33 | #define MAX_CORPSE_TYPE 3 |
---|
34 | |
---|
35 | // Value equal client resurrection dialog show radius. |
---|
36 | #define CORPSE_RECLAIM_RADIUS 39 |
---|
37 | |
---|
38 | enum CorpseFlags |
---|
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 |
---|
47 | }; |
---|
48 | |
---|
49 | class Corpse : public WorldObject |
---|
50 | { |
---|
51 | public: |
---|
52 | explicit Corpse( CorpseType type = CORPSE_BONES ); |
---|
53 | ~Corpse( ); |
---|
54 | |
---|
55 | void AddToWorld(); |
---|
56 | void RemoveFromWorld(); |
---|
57 | |
---|
58 | bool Create( uint32 guidlow ); |
---|
59 | bool Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang ); |
---|
60 | |
---|
61 | void SaveToDB(); |
---|
62 | bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); |
---|
63 | bool LoadFromDB(uint32 guid, Field *fields); |
---|
64 | |
---|
65 | void DeleteBonesFromWorld(); |
---|
66 | void DeleteFromDB(); |
---|
67 | |
---|
68 | uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); } |
---|
69 | |
---|
70 | time_t const& GetGhostTime() const { return m_time; } |
---|
71 | void ResetGhostTime() { m_time = time(NULL); } |
---|
72 | CorpseType GetType() const { return m_type; } |
---|
73 | |
---|
74 | GridPair const& GetGrid() const { return m_grid; } |
---|
75 | void SetGrid(GridPair const& grid) { m_grid = grid; } |
---|
76 | |
---|
77 | bool isVisibleForInState(Player const* u, bool inVisibleList) const; |
---|
78 | |
---|
79 | Loot loot; // remove insignia ONLY at BG |
---|
80 | Player* lootRecipient; |
---|
81 | bool lootForBody; |
---|
82 | |
---|
83 | void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); } |
---|
84 | void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); } |
---|
85 | void TextEmote(const char* text, uint64 TargetGuid) { MonsterTextEmote(text,TargetGuid); } |
---|
86 | void Whisper(const char* text, uint64 receiver) { MonsterWhisper(text,receiver); } |
---|
87 | void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } |
---|
88 | void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } |
---|
89 | void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } |
---|
90 | void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } |
---|
91 | |
---|
92 | GridReference<Corpse> &GetGridRef() { return m_gridRef; } |
---|
93 | private: |
---|
94 | GridReference<Corpse> m_gridRef; |
---|
95 | |
---|
96 | CorpseType m_type; |
---|
97 | time_t m_time; |
---|
98 | GridPair m_grid; // gride for corpse position for fast search |
---|
99 | }; |
---|
100 | #endif |
---|