[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / src / game / Corpse.h
blob4bd71f12cd3e278f5cd407e41cfaac3fbaea8abf
1 /*
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
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, bool inVisibleList) const;
79 Loot loot; // remove insignia ONLY at BG
80 Player* lootRecipient;
81 bool lootForBody;
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); }
92 GridReference<Corpse> &GetGridRef() { return m_gridRef; }
93 private:
94 GridReference<Corpse> m_gridRef;
96 CorpseType m_type;
97 time_t m_time;
98 GridPair m_grid; // gride for corpse position for fast search
100 #endif