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

Revision 2, 23.1 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

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