root/trunk/src/game/Creature.h @ 102

Revision 102, 22.9 kB (checked in by yumileroy, 17 years ago)

[svn] Fixed copyright notices to comply with GPL.

Original author: w12x
Date: 2008-10-23 03:29:52-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
4 * Copyright (C) 2008 Trinity <http://www.trinitycore.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_CREATURE_H
22#define TRINITYCORE_CREATURE_H
23
24#include "Common.h"
25#include "Unit.h"
26#include "UpdateMask.h"
27#include "ItemPrototype.h"
28#include "LootMgr.h"
29#include "Database/DatabaseEnv.h"
30#include "Cell.h"
31
32struct SpellEntry;
33
34class CreatureAI;
35class Quest;
36class Player;
37class WorldSession;
38
39enum Gossip_Option
40{
41    GOSSIP_OPTION_NONE              = 0,                    //UNIT_NPC_FLAG_NONE              = 0,
42    GOSSIP_OPTION_GOSSIP            = 1,                    //UNIT_NPC_FLAG_GOSSIP            = 1,
43    GOSSIP_OPTION_QUESTGIVER        = 2,                    //UNIT_NPC_FLAG_QUESTGIVER        = 2,
44    GOSSIP_OPTION_VENDOR            = 3,                    //UNIT_NPC_FLAG_VENDOR            = 4,
45    GOSSIP_OPTION_TAXIVENDOR        = 4,                    //UNIT_NPC_FLAG_TAXIVENDOR        = 8,
46    GOSSIP_OPTION_TRAINER           = 5,                    //UNIT_NPC_FLAG_TRAINER           = 16,
47    GOSSIP_OPTION_SPIRITHEALER      = 6,                    //UNIT_NPC_FLAG_SPIRITHEALER      = 32,
48    GOSSIP_OPTION_SPIRITGUIDE       = 7,                    //UNIT_NPC_FLAG_SPIRITGUIDE       = 64,
49    GOSSIP_OPTION_INNKEEPER         = 8,                    //UNIT_NPC_FLAG_INNKEEPER         = 128,
50    GOSSIP_OPTION_BANKER            = 9,                    //UNIT_NPC_FLAG_BANKER            = 256,
51    GOSSIP_OPTION_PETITIONER        = 10,                   //UNIT_NPC_FLAG_PETITIONER        = 512,
52    GOSSIP_OPTION_TABARDDESIGNER    = 11,                   //UNIT_NPC_FLAG_TABARDDESIGNER    = 1024,
53    GOSSIP_OPTION_BATTLEFIELD       = 12,                   //UNIT_NPC_FLAG_BATTLEFIELDPERSON = 2048,
54    GOSSIP_OPTION_AUCTIONEER        = 13,                   //UNIT_NPC_FLAG_AUCTIONEER        = 4096,
55    GOSSIP_OPTION_STABLEPET         = 14,                   //UNIT_NPC_FLAG_STABLE            = 8192,
56    GOSSIP_OPTION_ARMORER           = 15,                   //UNIT_NPC_FLAG_ARMORER           = 16384,
57    GOSSIP_OPTION_UNLEARNTALENTS    = 16,                   //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER)
58    GOSSIP_OPTION_UNLEARNPETSKILLS  = 17,                   //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER)
59    GOSSIP_OPTION_OUTDOORPVP        = 18                    //added by code (option for outdoor pvp creatures)
60};
61
62enum Gossip_Guard
63{
64    GOSSIP_GUARD_BANK               = 32,
65    GOSSIP_GUARD_RIDE               = 33,
66    GOSSIP_GUARD_GUILD              = 34,
67    GOSSIP_GUARD_INN                = 35,
68    GOSSIP_GUARD_MAIL               = 36,
69    GOSSIP_GUARD_AUCTION            = 37,
70    GOSSIP_GUARD_WEAPON             = 38,
71    GOSSIP_GUARD_STABLE             = 39,
72    GOSSIP_GUARD_BATTLE             = 40,
73    GOSSIP_GUARD_SPELLTRAINER       = 41,
74    GOSSIP_GUARD_SKILLTRAINER       = 42
75};
76
77enum Gossip_Guard_Spell
78{
79    GOSSIP_GUARD_SPELL_WARRIOR      = 64,
80    GOSSIP_GUARD_SPELL_PALADIN      = 65,
81    GOSSIP_GUARD_SPELL_HUNTER       = 66,
82    GOSSIP_GUARD_SPELL_ROGUE        = 67,
83    GOSSIP_GUARD_SPELL_PRIEST       = 68,
84    GOSSIP_GUARD_SPELL_UNKNOWN1     = 69,
85    GOSSIP_GUARD_SPELL_SHAMAN       = 70,
86    GOSSIP_GUARD_SPELL_MAGE         = 71,
87    GOSSIP_GUARD_SPELL_WARLOCK      = 72,
88    GOSSIP_GUARD_SPELL_UNKNOWN2     = 73,
89    GOSSIP_GUARD_SPELL_DRUID        = 74
90};
91
92enum Gossip_Guard_Skill
93{
94    GOSSIP_GUARD_SKILL_ALCHEMY      = 80,
95    GOSSIP_GUARD_SKILL_BLACKSMITH   = 81,
96    GOSSIP_GUARD_SKILL_COOKING      = 82,
97    GOSSIP_GUARD_SKILL_ENCHANT      = 83,
98    GOSSIP_GUARD_SKILL_FIRSTAID     = 84,
99    GOSSIP_GUARD_SKILL_FISHING      = 85,
100    GOSSIP_GUARD_SKILL_HERBALISM    = 86,
101    GOSSIP_GUARD_SKILL_LEATHER      = 87,
102    GOSSIP_GUARD_SKILL_MINING       = 88,
103    GOSSIP_GUARD_SKILL_SKINNING     = 89,
104    GOSSIP_GUARD_SKILL_TAILORING    = 90,
105    GOSSIP_GUARD_SKILL_ENGINERING   = 91
106};
107
108struct GossipOption
109{
110    uint32 Id;
111    uint32 GossipId;
112    uint32 NpcFlag;
113    uint32 Icon;
114    uint32 Action;
115    std::string Option;
116};
117
118enum CreatureFlagsExtra
119{
120    CREATURE_FLAG_EXTRA_INSTANCE_BIND   = 0x00000001,       // creature kill bind instance with killer and killer's group
121    CREATURE_FLAG_EXTRA_CIVILIAN        = 0x00000002,       // not aggro (ignore faction/reputation hostility)
122    CREATURE_FLAG_EXTRA_NO_PARRY        = 0x00000004,       // creature can't parry
123    CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008,       // creature can't counter-attack at parry
124    CREATURE_FLAG_EXTRA_NO_BLOCK        = 0x00000010,       // creature can't block
125    CREATURE_FLAG_EXTRA_NO_CRUSH        = 0x00000020,       // creature can't do crush attacks
126    CREATURE_FLAG_EXTRA_NO_XP_AT_KILL   = 0x00000040,       // creature kill not provide XP
127    CREATURE_FLAG_EXTRA_TRIGGER         = 0x00000080,       // trigger creature
128    CREATURE_FLAG_EXTRA_WORLDEVENT      = 0x00004000,       // custom flag for world event creatures (left room for merging)
129};
130
131// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
132#if defined( __GNUC__ )
133#pragma pack(1)
134#else
135#pragma pack(push,1)
136#endif
137
138// from `creature_template` table
139struct CreatureInfo
140{
141    uint32  Entry;
142    uint32  HeroicEntry;
143    uint32  DisplayID_A;
144    uint32  DisplayID_A2;
145    uint32  DisplayID_H;
146    uint32  DisplayID_H2;
147    char*   Name;
148    char*   SubName;
149    char*   IconName;
150    uint32  minlevel;
151    uint32  maxlevel;
152    uint32  minhealth;
153    uint32  maxhealth;
154    uint32  minmana;
155    uint32  maxmana;
156    uint32  armor;
157    uint32  faction_A;
158    uint32  faction_H;
159    uint32  npcflag;
160    float   speed;
161    float   scale;
162    uint32  rank;
163    float   mindmg;
164    float   maxdmg;
165    uint32  dmgschool;
166    uint32  attackpower;
167    uint32  baseattacktime;
168    uint32  rangeattacktime;
169    uint32  Flags;
170    uint32  dynamicflags;
171    uint32  family;
172    uint32  trainer_type;
173    uint32  trainer_spell;
174    uint32  classNum;
175    uint32  race;
176    float   minrangedmg;
177    float   maxrangedmg;
178    uint32  rangedattackpower;
179    uint32  type;
180    uint32  flag1;
181    uint32  lootid;
182    uint32  pickpocketLootId;
183    uint32  SkinLootId;
184    int32   resistance1;
185    int32   resistance2;
186    int32   resistance3;
187    int32   resistance4;
188    int32   resistance5;
189    int32   resistance6;
190    uint32  spell1;
191    uint32  spell2;
192    uint32  spell3;
193    uint32  spell4;
194    uint32  PetSpellDataId;
195    uint32  mingold;
196    uint32  maxgold;
197    char const* AIName;
198    uint32  MovementType;
199    uint32  InhabitType;
200    bool    RacialLeader;
201    bool    RegenHealth;
202    uint32  equipmentId;
203    uint32  MechanicImmuneMask;
204    uint32  flags_extra;
205    char const* ScriptName;
206};
207
208struct CreatureLocale
209{
210    std::vector<std::string> Name;
211    std::vector<std::string> SubName;
212};
213
214struct EquipmentInfo
215{
216    uint32  entry;
217    uint32  equipmodel[3];
218    uint32  equipinfo[3];
219    uint32  equipslot[3];
220};
221
222// from `creature` table
223struct CreatureData
224{
225    uint32 id;                                              // entry in creature_template
226    uint16 mapid;
227    uint32 displayid;
228    int32 equipmentId;
229    float posX;
230    float posY;
231    float posZ;
232    float orientation;
233    uint32 spawntimesecs;
234    float spawndist;
235    uint32 currentwaypoint;
236    uint32 curhealth;
237    uint32 curmana;
238    bool  is_dead;
239    uint8 movementType;
240    uint8 spawnMask;
241};
242
243struct CreatureDataAddonAura
244{
245    uint16 spell_id;
246    uint8 effect_idx;
247};
248
249// from `creature_addon` table
250struct CreatureDataAddon
251{
252    uint32 guidOrEntry;
253    uint32 mount;
254    uint32 bytes0;
255    uint32 bytes1;
256    uint32 bytes2;
257    uint32 emote;
258    uint32 move_flags;
259    CreatureDataAddonAura const* auras;                     // loaded as char* "spell1 eff1 spell2 eff2 ... "
260};
261
262struct CreatureModelInfo
263{
264    uint32 modelid;
265    float bounding_radius;
266    float combat_reach;
267    uint8 gender;
268    uint32 modelid_other_gender;
269};
270
271enum InhabitTypeValues
272{
273    INHABIT_GROUND = 1,
274    INHABIT_WATER  = 2,
275    INHABIT_AIR    = 4,
276    INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR
277};
278
279// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
280#if defined( __GNUC__ )
281#pragma pack()
282#else
283#pragma pack(pop)
284#endif
285
286// Vendors
287struct VendorItem
288{
289    VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost)
290        : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {}
291
292    uint32 item;
293    uint32 maxcount;                                        // 0 for infinity item amount
294    uint32 incrtime;                                        // time for restore items amount if maxcount != 0
295    uint32 ExtendedCost;
296};
297typedef std::vector<VendorItem*> VendorItemList;
298
299struct VendorItemData
300{
301    VendorItemList m_items;
302
303    VendorItem* GetItem(uint32 slot) const
304    {
305        if(slot>=m_items.size()) return NULL;
306        return m_items[slot];
307    }
308    bool Empty() const { return m_items.empty(); }
309    uint8 GetItemCount() const { return m_items.size(); }
310    void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost)
311    {
312        m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
313    }
314    bool RemoveItem( uint32 item_id );
315    VendorItem const* FindItem(uint32 item_id) const;
316    size_t FindItemSlot(uint32 item_id) const;
317
318    void Clear()
319    {
320        for (VendorItemList::iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
321            delete (*itr);
322    }
323};
324
325struct VendorItemCount
326{
327    explicit VendorItemCount(uint32 _item, uint32 _count)
328        : itemId(_item), count(_count), lastIncrementTime(time(NULL)) {}
329
330    uint32 itemId;
331    uint32 count;
332    time_t lastIncrementTime;
333};
334
335typedef std::list<VendorItemCount> VendorItemCounts;
336
337struct TrainerSpell
338{
339    uint32 spell;
340    uint32 spellcost;
341    uint32 reqskill;
342    uint32 reqskillvalue;
343    uint32 reqlevel;
344};
345
346typedef std::vector<TrainerSpell*> TrainerSpellList;
347
348struct TrainerSpellData
349{
350    TrainerSpellData() : trainerType(0) {}
351
352    TrainerSpellList spellList;
353    uint32 trainerType;                                     // trainer type based at trainer spells, can be different from creature_template value.
354                                                            // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
355
356    void Clear();
357    TrainerSpell const* Find(uint32 spell_id) const;
358};
359
360typedef std::list<GossipOption> GossipOptionList;
361
362typedef std::map<uint32,time_t> CreatureSpellCooldowns;
363
364// max different by z coordinate for creature aggro reaction
365#define CREATURE_Z_ATTACK_RANGE 3
366
367#define MAX_VENDOR_ITEMS 255                                // Limitation in item count field size in SMSG_LIST_INVENTORY
368
369class TRINITY_DLL_SPEC Creature : public Unit
370{
371    CreatureAI *i_AI;
372
373    public:
374
375        explicit Creature();
376        virtual ~Creature();
377
378        void AddToWorld();
379        void RemoveFromWorld();
380
381        bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 team, const CreatureData *data = NULL);
382        bool LoadCreaturesAddon(bool reload = false);
383        void SelectLevel(const CreatureInfo *cinfo);
384        void LoadEquipment(uint32 equip_entry, bool force=false);
385
386        uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
387        char const* GetSubName() const { return GetCreatureInfo()->SubName; }
388
389        void Update( uint32 time );                         // overwrited Unit::Update
390        void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
391        uint32 GetEquipmentId() const { return m_equipmentId; }
392
393        bool isPet() const { return m_isPet; }
394        void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
395        bool isTotem() const { return m_isTotem; }
396        bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
397        bool isCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
398        bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
399        bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
400        bool canFly()  const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
401        ///// TODO RENAME THIS!!!!!
402        bool isCanTrainingOf(Player* player, bool msg) const;
403        bool isCanIneractWithBattleMaster(Player* player, bool msg) const;
404        bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const;
405        bool IsOutOfThreatArea(Unit* pVictim) const;
406        bool IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges = false);
407                                                            // redefine Unit::IsImmunedToSpell
408        bool IsImmunedToSpellEffect(uint32 effect, uint32 mechanic) const;
409                                                            // redefine Unit::IsImmunedToSpellEffect
410        bool isElite() const
411        {
412            if(isPet())
413                return false;
414
415            uint32 rank = GetCreatureInfo()->rank;
416            return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
417        }
418
419        bool isWorldBoss() const
420        {
421            if(isPet())
422                return false;
423
424            return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
425        }
426
427        uint32 getLevelForTarget(Unit const* target) const; // overwrite Unit::getLevelForTarget for boss level support
428
429        bool IsInEvadeMode() const;
430
431        bool AIM_Initialize();
432
433        void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type);
434        CreatureAI* AI() { return i_AI; }
435
436        uint32 GetShieldBlockValue() const                  //dunno mob block value
437        {
438            return (getLevel()/2 + uint32(GetStat(STAT_STRENGTH)/20));
439        }
440
441        SpellSchoolMask GetMeleeDamageSchoolMask() const { return m_meleeDamageSchoolMask; }
442        void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
443
444        void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time);
445        void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time);
446        void AddCreatureSpellCooldown(uint32 spellid);
447        bool HasSpellCooldown(uint32 spell_id) const;
448        bool HasCategoryCooldown(uint32 spell_id) const;
449
450        bool HasSpell(uint32 spellID) const;
451
452        bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
453        bool UpdateStats(Stats stat);
454        bool UpdateAllStats();
455        void UpdateResistances(uint32 school);
456        void UpdateArmor();
457        void UpdateMaxHealth();
458        void UpdateMaxPower(Powers power);
459        void UpdateAttackPowerAndDamage(bool ranged = false);
460        void UpdateDamagePhysical(WeaponAttackType attType);
461        uint32 GetCurrentEquipmentId() { return m_equipmentId; }
462        float GetSpellDamageMod(int32 Rank);
463
464        VendorItemData const* GetVendorItems() const;
465        uint32 GetVendorItemCurrentCount(VendorItem const* vItem);
466        uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count);
467
468        TrainerSpellData const* GetTrainerSpells() const;
469
470        CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; }
471        CreatureDataAddon const* GetCreatureAddon() const;
472        char const* GetScriptName() const;
473
474        void prepareGossipMenu( Player *pPlayer,uint32 gossipid );
475        void sendPreparedGossip( Player* player);
476        void OnGossipSelect(Player* player, uint32 option);
477        void OnPoiSelect(Player* player, GossipOption const *gossip);
478
479        uint32 GetGossipTextId(uint32 action, uint32 zoneid);
480        uint32 GetNpcTextId();
481        void LoadGossipOptions();
482        void ResetGossipOptions();
483        GossipOption const* GetGossipOption( uint32 id ) const;
484        void addGossipOption(GossipOption const& gso) { m_goptions.push_back(gso); }
485
486        void setEmoteState(uint8 emote) { m_emoteState = emote; };
487        void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); }
488        void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); }
489        void TextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(text,TargetGuid,IsBossEmote); }
490        void Whisper(const char* text, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(text,receiver,IsBossWhisper); }
491        void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
492        void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
493        void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); }
494        void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); }
495
496        void setDeathState(DeathState s);                   // overwrite virtual Unit::setDeathState
497
498        bool LoadFromDB(uint32 guid, Map *map);
499        void SaveToDB();
500                                                            // overwrited in Pet
501        virtual void SaveToDB(uint32 mapid, uint8 spawnMask);
502        virtual void DeleteFromDB();                        // overwrited in Pet
503
504        Loot loot;
505        bool lootForPickPocketed;
506        bool lootForBody;
507        Player *GetLootRecipient() const;
508        bool hasLootRecipient() const { return m_lootRecipient!=0; }
509
510        void SetLootRecipient (Unit* unit);
511        void AllLootRemovedFromCorpse();
512
513        SpellEntry const *reachWithSpellAttack(Unit *pVictim);
514        SpellEntry const *reachWithSpellCure(Unit *pVictim);
515
516        uint32 m_spells[CREATURE_MAX_SPELLS];
517        CreatureSpellCooldowns m_CreatureSpellCooldowns;
518        CreatureSpellCooldowns m_CreatureCategoryCooldowns;
519        uint32 m_GlobalCooldown;
520
521        float GetAttackDistance(Unit const* pl) const;
522
523        void CallAssistence();
524        void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
525        void DoFleeToGetAssistance(float radius = 50);
526
527        MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
528        void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
529
530        // for use only in LoadHelper, Map::Add Map::CreatureCellRelocation
531        Cell const& GetCurrentCell() const { return m_currentCell; }
532        void SetCurrentCell(Cell const& cell) { m_currentCell = cell; }
533
534        bool IsVisibleInGridForPlayer(Player* pl) const;
535
536        void RemoveCorpse();
537
538        time_t const& GetRespawnTime() const { return m_respawnTime; }
539        time_t GetRespawnTimeEx() const;
540        void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
541        void Respawn();
542        void SaveRespawnTime();
543
544        uint32 GetRespawnDelay() const { return m_respawnDelay; }
545        void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
546
547        float GetRespawnRadius() const { return m_respawnradius; }
548        void SetRespawnRadius(float dist) { m_respawnradius = dist; }
549
550        uint32 m_groupLootTimer;                            // (msecs)timer used for group loot
551        uint64 lootingGroupLeaderGUID;                      // used to find group which is looting corpse
552
553        void SendZoneUnderAttackMessage(Player* attacker);
554
555        bool hasQuest(uint32 quest_id) const;
556        bool hasInvolvedQuest(uint32 quest_id)  const;
557
558        GridReference<Creature> &GetGridRef() { return m_gridRef; }
559        bool isRegeneratingHealth() { return m_regenHealth; }
560        virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
561        virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
562        {
563            if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->active != ACT_ENABLED)
564                return 0;
565            else
566                return m_charmInfo->GetCharmSpell(pos)->spellId;
567        }
568
569        void SetCombatStartPosition(float x, float y, float z) { CombatStartX = x; CombatStartY = y; CombatStartZ = z; }
570        void GetCombatStartPosition(float &x, float &y, float &z) { x = CombatStartX; y = CombatStartY; z = CombatStartZ; }
571
572    protected:
573        bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
574        bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
575
576        // vendor items
577        VendorItemCounts m_vendorItemCounts;
578
579        void _RealtimeSetCreatureInfo();
580
581        static float _GetHealthMod(int32 Rank);
582        static float _GetDamageMod(int32 Rank);
583
584        uint32 m_lootMoney;
585        uint64 m_lootRecipient;
586
587        /// Timers
588        uint32 m_deathTimer;                                // (msecs)timer for death or corpse disappearance
589        time_t m_respawnTime;                               // (secs) time of next respawn
590        uint32 m_respawnDelay;                              // (secs) delay between corpse disappearance and respawning
591        uint32 m_corpseDelay;                               // (secs) delay between death and corpse disappearance
592        float m_respawnradius;
593
594        bool m_gossipOptionLoaded;
595        GossipOptionList m_goptions;
596
597        uint8 m_emoteState;
598        bool m_isPet;                                       // set only in Pet::Pet
599        bool m_isTotem;                                     // set only in Totem::Totem
600        void RegenerateMana();
601        void RegenerateHealth();
602        uint32 m_regenTimer;
603        MovementGeneratorType m_defaultMovementType;
604        Cell m_currentCell;                                 // store current cell where creature listed
605        uint32 m_DBTableGuid;                               ///< For new or temporary creatures is 0 for saved it is lowguid
606        uint32 m_equipmentId;
607
608        bool m_AlreadyCallAssistence;
609        bool m_regenHealth;
610        bool m_AI_locked;
611        bool m_isDeadByDefault;
612
613        SpellSchoolMask m_meleeDamageSchoolMask;
614        uint32 m_originalEntry;
615
616        float CombatStartX;
617        float CombatStartY;
618        float CombatStartZ;
619    private:
620        GridReference<Creature> m_gridRef;
621        CreatureInfo const* m_creatureInfo;                 // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
622};
623#endif
Note: See TracBrowser for help on using the browser.