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

Revision 44, 22.8 kB (checked in by yumileroy, 17 years ago)

[svn] * Merge Temp dev SVN with Assembla.
* Changes include:

  • Implementation of w12x's Outdoor PvP and Game Event Systems.
  • Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
  • All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
  • Improved Config cleanup.
  • And many more changes.

Original author: Seline
Date: 2008-10-14 11:57:03-05:00

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