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

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

[svn] * Updated to 6743 and 685

Moved language id used by Arena to a higher place to solve conflicts
Added the empty script folders

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