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

Revision 14, 23.2 kB (checked in by yumileroy, 17 years ago)

[svn] * Added fleeing and call assistance in script until we move all AI functions to core

Original author: Neo2003
Date: 2008-10-05 12:10:02-05:00

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