| 1 | /* |
|---|
| 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
|---|
| 3 | * |
|---|
| 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef TRINITYCORE_CORPSE_H |
|---|
| 22 | #define TRINITYCORE_CORPSE_H |
|---|
| 23 | |
|---|
| 24 | #include "Object.h" |
|---|
| 25 | #include "Database/DatabaseEnv.h" |
|---|
| 26 | #include "GridDefines.h" |
|---|
| 27 | #include "LootMgr.h" |
|---|
| 28 | |
|---|
| 29 | enum CorpseType |
|---|
| 30 | { |
|---|
| 31 | CORPSE_BONES = 0, |
|---|
| 32 | CORPSE_RESURRECTABLE_PVE = 1, |
|---|
| 33 | CORPSE_RESURRECTABLE_PVP = 2 |
|---|
| 34 | }; |
|---|
| 35 | #define MAX_CORPSE_TYPE 3 |
|---|
| 36 | |
|---|
| 37 | // Value equal client resurrection dialog show radius. |
|---|
| 38 | #define CORPSE_RECLAIM_RADIUS 39 |
|---|
| 39 | |
|---|
| 40 | enum CorpseFlags |
|---|
| 41 | { |
|---|
| 42 | CORPSE_FLAG_NONE = 0x00, |
|---|
| 43 | CORPSE_FLAG_BONES = 0x01, |
|---|
| 44 | CORPSE_FLAG_UNK1 = 0x02, |
|---|
| 45 | CORPSE_FLAG_UNK2 = 0x04, |
|---|
| 46 | CORPSE_FLAG_HIDE_HELM = 0x08, |
|---|
| 47 | CORPSE_FLAG_HIDE_CLOAK = 0x10, |
|---|
| 48 | CORPSE_FLAG_LOOTABLE = 0x20 |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | class Corpse : public WorldObject |
|---|
| 52 | { |
|---|
| 53 | public: |
|---|
| 54 | explicit Corpse( CorpseType type = CORPSE_BONES ); |
|---|
| 55 | ~Corpse( ); |
|---|
| 56 | |
|---|
| 57 | void AddToWorld(); |
|---|
| 58 | void RemoveFromWorld(); |
|---|
| 59 | |
|---|
| 60 | bool Create( uint32 guidlow ); |
|---|
| 61 | bool Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang ); |
|---|
| 62 | |
|---|
| 63 | void SaveToDB(); |
|---|
| 64 | bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); |
|---|
| 65 | bool LoadFromDB(uint32 guid, Field *fields); |
|---|
| 66 | |
|---|
| 67 | void DeleteBonesFromWorld(); |
|---|
| 68 | void DeleteFromDB(); |
|---|
| 69 | |
|---|
| 70 | uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); } |
|---|
| 71 | |
|---|
| 72 | time_t const& GetGhostTime() const { return m_time; } |
|---|
| 73 | void ResetGhostTime() { m_time = time(NULL); } |
|---|
| 74 | CorpseType GetType() const { return m_type; } |
|---|
| 75 | |
|---|
| 76 | GridPair const& GetGrid() const { return m_grid; } |
|---|
| 77 | void SetGrid(GridPair const& grid) { m_grid = grid; } |
|---|
| 78 | |
|---|
| 79 | bool isVisibleForInState(Player const* u, bool inVisibleList) const; |
|---|
| 80 | |
|---|
| 81 | Loot loot; // remove insignia ONLY at BG |
|---|
| 82 | Player* lootRecipient; |
|---|
| 83 | bool lootForBody; |
|---|
| 84 | |
|---|
| 85 | void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); } |
|---|
| 86 | void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); } |
|---|
| 87 | void TextEmote(const char* text, uint64 TargetGuid) { MonsterTextEmote(text,TargetGuid); } |
|---|
| 88 | void Whisper(const char* text, uint64 receiver) { MonsterWhisper(text,receiver); } |
|---|
| 89 | void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } |
|---|
| 90 | void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } |
|---|
| 91 | void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } |
|---|
| 92 | void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } |
|---|
| 93 | |
|---|
| 94 | GridReference<Corpse> &GetGridRef() { return m_gridRef; } |
|---|
| 95 | private: |
|---|
| 96 | GridReference<Corpse> m_gridRef; |
|---|
| 97 | |
|---|
| 98 | CorpseType m_type; |
|---|
| 99 | time_t m_time; |
|---|
| 100 | GridPair m_grid; // gride for corpse position for fast search |
|---|
| 101 | }; |
|---|
| 102 | #endif |
|---|