TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Creature.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITYCORE_CREATURE_H
20 #define TRINITYCORE_CREATURE_H
21 
22 #include "Common.h"
23 #include "Unit.h"
24 #include "UpdateMask.h"
25 #include "ItemTemplate.h"
26 #include "LootMgr.h"
27 #include "DatabaseEnv.h"
28 #include "Cell.h"
29 
30 #include <list>
31 
32 class CreatureAI;
33 class CreatureGroup;
34 class Group;
35 class Quest;
36 class Player;
37 class SpellInfo;
38 class WorldSession;
39 
41 {
42  CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
43  CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility)
44  CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry
45  CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
46  CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block
47  CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks
48  CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
49  CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature
50  CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me
51  CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
52  CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard
53  CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes
54  CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
55  CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
56  CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as player are
57  CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ = 0x00200000, // creature does not need to take player damage for kill credit
58  CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
59  CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding
60  CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000 // creature is immune to knockback effects
61 };
62 
63 #define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
64  CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \
65  CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \
66  CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \
67  CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \
68  CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING | CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ | CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK)
69 
70 #define CREATURE_REGEN_INTERVAL 2 * IN_MILLISECONDS
71 
72 #define MAX_KILL_CREDIT 2
73 #define MAX_CREATURE_MODELS 4
74 #define MAX_CREATURE_NAMES 4
75 #define CREATURE_MAX_SPELLS 8
76 #define MAX_CREATURE_DIFFICULTIES 3
77 
78 // from `creature_template` table
80 {
83  uint32 KillCredit[MAX_KILL_CREDIT];
88  std::string Name;
89  std::string FemaleName;
90  std::string SubName;
91  std::string IconName;
96  uint32 expansionUnknown; // either 0 or 3, sent to the client / wdb
99  float speed_walk;
100  float speed_run;
101  float scale;
108  uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
109  uint32 unit_flags; // enum UnitFlags mask values
110  uint32 unit_flags2; // enum UnitFlags2 mask values
112  uint32 family; // enum CreatureFamily values (optional)
116  uint32 type; // enum CreatureType values
117  uint32 type_flags; // enum CreatureTypeFlags mask values
118  uint32 type_flags2; // unknown enum, only set for 4 creatures (with value 1)
122  int32 resistance[MAX_SPELL_SCHOOL];
127  std::string AIName;
130  float HoverHeight;
131  float ModHealth;
133  float ModMana;
134  float ModManaExtra; // Added in 4.x, this value is usually 2 for a small group of creatures with double mana
135  float ModArmor;
136  float ModDamage;
144  uint32 GetRandomValidModelId() const;
145  uint32 GetFirstValidModelId() const;
146  uint32 GetFirstInvisibleModel() const;
147  uint32 GetFirstVisibleModel() const;
148 
149  // helpers
151  {
152  if (type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
153  return SKILL_HERBALISM;
154  else if (type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
155  return SKILL_MINING;
156  else if (type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
157  return SKILL_ENGINEERING;
158  else
159  return SKILL_SKINNING; // normal case
160  }
161 
162  bool IsExotic() const
163  {
164  return (type_flags & CREATURE_TYPEFLAGS_EXOTIC) != 0;
165  }
166 
167  bool IsTameable(bool canTameExotic) const
168  {
169  if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
170  return false;
171 
172  // if can tame exotic then can tame any tameable
173  return canTameExotic || !IsExotic();
174  }
175 
177  {
178  switch (difficulty)
179  {
180  case DIFFICULTY_NONE:
181  case DIFFICULTY_NORMAL:
182  case DIFFICULTY_10_N:
183  case DIFFICULTY_40:
186  return -1;
187  case DIFFICULTY_HEROIC:
188  case DIFFICULTY_25_N:
191  return 0;
192  case DIFFICULTY_10_HC:
195  return 1;
196  case DIFFICULTY_25_HC:
197  return 2;
198  case DIFFICULTY_LFR:
199  case DIFFICULTY_LFR_NEW:
203  default:
204  return -1;
205  }
206  }
207 };
208 
209 typedef std::vector<uint32> CreatureQuestItemList;
210 typedef std::unordered_map<uint32, CreatureQuestItemList> CreatureQuestItemMap;
211 
212 // Benchmarked: Faster than std::map (insert/find)
213 typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer;
214 
215 #pragma pack(push, 1)
216 
217 // Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage).
219 {
220  uint32 BaseHealth[MAX_EXPANSIONS];
225  float BaseDamage[MAX_EXPANSIONS];
226 
227  // Helpers
228 
230  {
231  return uint32(ceil(BaseHealth[info->expansion] * info->ModHealth * info->ModHealthExtra));
232  }
233 
235  {
236  // Mana can be 0.
237  if (!BaseMana)
238  return 0;
239 
240  return uint32(ceil(BaseMana * info->ModMana * info->ModManaExtra));
241  }
242 
244  {
245  return uint32(ceil(BaseArmor * info->ModArmor));
246  }
247 
248  float GenerateBaseDamage(CreatureTemplate const* info) const
249  {
250  return BaseDamage[info->expansion];
251  }
252 
253  static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass);
254 };
255 
256 typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer;
257 
259 {
264 };
265 
267 {
270 };
271 
273 {
275 };
276 
278 {
280 };
281 
282 // Benchmarked: Faster than std::map (insert/find)
283 typedef std::unordered_map<uint8, EquipmentInfo> EquipmentInfoContainerInternal;
284 typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfoContainer;
285 
286 // from `creature` table
288 {
290  posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
293  uint32 id; // entry in creature_template
298  float posX;
299  float posY;
300  float posZ;
301  float orientation;
303  float spawndist;
310  uint32 unit_flags; // enum UnitFlags mask values
314  bool dbData;
315 };
316 
318 {
324 };
325 
326 // Benchmarked: Faster than std::map (insert/find)
327 typedef std::unordered_map<uint16, CreatureModelInfo> CreatureModelContainer;
328 
330 {
335 };
336 
337 // Enums used by StringTextData::Type (CreatureEventAI)
339 {
348 };
349 
350 #pragma pack(pop)
351 
352 // `creature_addon` table
354 {
360  std::vector<uint32> auras;
361 };
362 
363 typedef std::unordered_map<ObjectGuid::LowType, CreatureAddon> CreatureAddonContainer;
364 typedef std::unordered_map<uint32, CreatureAddon> CreatureTemplateAddonContainer;
365 
366 // Vendors
368 {
369  VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type)
370  : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), Type(_Type) { }
371 
373  uint32 maxcount; // 0 for infinity item amount
374  uint32 incrtime; // time for restore items amount if maxcount != 0
377 
378  //helpers
379  bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->GetFlags2() & ITEM_FLAG2_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
380 };
381 typedef std::vector<VendorItem*> VendorItemList;
382 
384 {
386 
387  VendorItem* GetItem(uint32 slot) const
388  {
389  if (slot >= m_items.size())
390  return NULL;
391 
392  return m_items[slot];
393  }
394  bool Empty() const { return m_items.empty(); }
395  uint32 GetItemCount() const { return uint32(m_items.size()); }
396  void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
397  {
398  m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost, type));
399  }
400  bool RemoveItem(uint32 item_id, uint8 type);
401  VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const;
402  void Clear()
403  {
404  for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
405  delete (*itr);
406  m_items.clear();
407  }
408 };
409 
411 {
412  explicit VendorItemCount(uint32 _item, uint32 _count)
413  : itemId(_item), count(_count), lastIncrementTime(time(NULL)) { }
414 
418 };
419 
420 typedef std::list<VendorItemCount> VendorItemCounts;
421 
422 #define MAX_TRAINERSPELL_ABILITY_REQS 3
423 
425 {
427  {
428  for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
429  ReqAbility[i] = 0;
430  }
431 
438 
439  // helpers
440  bool IsCastable() const { return ReqAbility[0] != SpellID; }
441 };
442 
443 typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
444 
446 {
447  TrainerSpellData() : trainerType(0) { }
448  ~TrainerSpellData() { spellList.clear(); }
449 
451  uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
452  // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
453  TrainerSpell const* Find(uint32 spell_id) const;
454 };
455 
456 typedef std::map<uint32, time_t> CreatureSpellCooldowns;
457 
458 // max different by z coordinate for creature aggro reaction
459 #define CREATURE_Z_ATTACK_RANGE 3
460 
461 #define MAX_VENDOR_ITEMS 150 // Limitation in 4.x.x item count in SMSG_LIST_INVENTORY
462 
463 //used for handling non-repeatable random texts
464 typedef std::vector<uint8> CreatureTextRepeatIds;
465 typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup;
466 
467 class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public MapObject
468 {
469  public:
470 
471  explicit Creature(bool isWorldObject = false);
472  virtual ~Creature();
473 
474  void AddToWorld() override;
475  void RemoveFromWorld() override;
476 
477  void SetObjectScale(float scale) override;
478  void SetDisplayId(uint32 modelId) override;
479 
480  void DisappearAndDie();
481 
482  bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0);
483  bool LoadCreaturesAddon();
484  void SelectLevel();
485  void LoadEquipment(int8 id = 1, bool force = false);
486 
487  ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
488 
489  void Update(uint32 time) override; // overwrited Unit::Update
490  void GetRespawnPosition(float &x, float &y, float &z, float* ori = nullptr, float* dist =nullptr) const;
491 
492  void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
493  uint32 GetCorpseDelay() const { return m_corpseDelay; }
494  bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
495  bool IsCivilian() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) != 0; }
496  bool IsTrigger() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) != 0; }
497  bool IsGuard() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD) != 0; }
498  bool CanWalk() const { return (GetCreatureTemplate()->InhabitType & INHABIT_GROUND) != 0; }
499  bool CanSwim() const { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) != 0 || IsPet(); }
500  bool CanFly() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; }
501 
502  void SetReactState(ReactStates st) { m_reactState = st; }
503  ReactStates GetReactState() const { return m_reactState; }
504  bool HasReactState(ReactStates state) const { return (m_reactState == state); }
505  void InitializeReactState();
506 
508  bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
509  bool isCanTrainingAndResetTalentsOf(Player* player) const;
510  bool CanCreatureAttack(Unit const* victim, bool force = true) const;
511  bool IsImmunedToSpell(SpellInfo const* spellInfo) const override; // override Unit::IsImmunedToSpell
512  bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; // override Unit::IsImmunedToSpellEffect
513  bool isElite() const;
514  bool isWorldBoss() const;
515 
516  bool IsDungeonBoss() const;
517 
518  uint8 getLevelForTarget(WorldObject const* target) const override; // overwrite Unit::getLevelForTarget for boss level support
519 
520  bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); }
521 
522  bool AIM_Initialize(CreatureAI* ai = NULL);
523  void Motion_Initialize();
524 
525  CreatureAI* AI() const { return (CreatureAI*)i_AI; }
526 
527  SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
528  void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
529 
530  bool HasSpell(uint32 spellID) const override;
531 
532  bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr);
533 
534  void UpdateMovementFlags();
535 
536  bool UpdateStats(Stats stat) override;
537  bool UpdateAllStats() override;
538  void UpdateResistances(uint32 school) override;
539  void UpdateArmor() override;
540  void UpdateMaxHealth() override;
541  void UpdateMaxPower(Powers power) override;
542  void UpdateAttackPowerAndDamage(bool ranged = false) override;
543  void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
544 
545  void SetCanDualWield(bool value) override;
546  int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
547  uint8 GetCurrentEquipmentId() const { return m_equipmentId; }
548  void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
549 
550  float GetSpellDamageMod(int32 Rank) const;
551 
552  VendorItemData const* GetVendorItems() const;
553  uint32 GetVendorItemCurrentCount(VendorItem const* vItem);
554  uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count);
555 
556  TrainerSpellData const* GetTrainerSpells() const;
557 
558  CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
559  CreatureData const* GetCreatureData() const { return m_creatureData; }
560  CreatureAddon const* GetCreatureAddon() const;
561 
562  std::string GetAIName() const;
563  std::string GetScriptName() const;
564  uint32 GetScriptId() const;
565 
566  // override WorldObject function for proper name localization
567  std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
568 
569  void setDeathState(DeathState s) override; // override virtual Unit::setDeathState
570 
571  bool LoadFromDB(ObjectGuid::LowType spawnId, Map* map) { return LoadCreatureFromDB(spawnId, map, false); }
572  bool LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap = true, bool allowDuplicate = false);
573  void SaveToDB();
574  // overriden in Pet
575  virtual void SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask);
576  virtual void DeleteFromDB(); // overriden in Pet
577 
579  void StartPickPocketRefillTimer();
580  void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
581  bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(NULL); }
582  void SetSkinner(ObjectGuid guid) { _skinner = guid; }
583  ObjectGuid GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
584  Player* GetLootRecipient() const;
585  Group* GetLootRecipientGroup() const;
586  bool hasLootRecipient() const { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); }
587  bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
588 
589  void SetLootRecipient (Unit* unit);
590  void AllLootRemovedFromCorpse();
591 
592  uint16 GetLootMode() const { return m_LootMode; }
593  bool HasLootMode(uint16 lootMode) { return (m_LootMode & lootMode) != 0; }
594  void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
595  void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
596  void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
597  void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
598 
599  SpellInfo const* reachWithSpellAttack(Unit* victim);
600  SpellInfo const* reachWithSpellCure(Unit* victim);
601 
603 
604  bool CanStartAttack(Unit const* u, bool force) const;
605  float GetAttackDistance(Unit const* player) const;
606  float GetAggroRange(Unit const* target) const;
607 
608  void SendAIReaction(AiReaction reactionType);
609 
610  Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
611  Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
612  Player* SelectNearestPlayer(float distance = 0) const;
613  Unit* SelectNearestHostileUnitInAggroRange(bool useLOS = false) const;
614 
615  void DoFleeToGetAssistance();
616  void CallForHelp(float fRadius);
617  void CallAssistance();
618  void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
619  void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
620  bool HasSearchedAssistance() const { return m_AlreadySearchedAssistance; }
621  bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const;
622  bool _IsTargetAcceptable(const Unit* target) const;
623 
624  MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
625  void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
626 
627  void RemoveCorpse(bool setSpawnTime = true);
628 
629  void DespawnOrUnsummon(uint32 msTimeToDespawn = 0);
630 
631  time_t const& GetRespawnTime() const { return m_respawnTime; }
632  time_t GetRespawnTimeEx() const;
633  void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
634  void Respawn(bool force = false);
635  void SaveRespawnTime() override;
636 
637  uint32 GetRespawnDelay() const { return m_respawnDelay; }
638  void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
639 
640  float GetRespawnRadius() const { return m_respawnradius; }
641  void SetRespawnRadius(float dist) { m_respawnradius = dist; }
642 
643  void DoImmediateBoundaryCheck() { m_boundaryCheckTime = 0; }
644  uint32 GetCombatPulseDelay() const { return m_combatPulseDelay; }
645  void SetCombatPulseDelay(uint32 delay) // (secs) interval at which the creature pulses the entire zone into combat (only works in dungeons)
646  {
647  m_combatPulseDelay = delay;
648  if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
649  m_combatPulseTime = delay;
650  }
651 
652  uint32 m_groupLootTimer; // (msecs)timer used for group loot
653  ObjectGuid lootingGroupLowGUID; // used to find group which is looting corpse
654 
655  void SendZoneUnderAttackMessage(Player* attacker);
656 
657  void SetInCombatWithZone();
658 
659  bool hasQuest(uint32 quest_id) const override;
660  bool hasInvolvedQuest(uint32 quest_id) const override;
661 
662  bool isRegeneratingHealth() { return m_regenHealth; }
663  void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
664  virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
665  virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const;
666 
667  void SetPosition(float x, float y, float z, float o);
668  void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
669 
670  void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
671  void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); }
672  void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }
673  Position const& GetHomePosition() const { return m_homePosition; }
674 
675  void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
676  void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); }
677  void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); }
678  Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
679 
680  uint32 GetWaypointPath() const { return m_path_id; }
681  void LoadPath(uint32 pathid) { m_path_id = pathid; }
682 
683  uint32 GetCurrentWaypointID() const { return m_waypointID; }
684  void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
685 
686  void SearchFormation();
687  CreatureGroup* GetFormation() { return m_formation; }
688  void SetFormation(CreatureGroup* formation) { m_formation = formation; }
689 
690  Unit* SelectVictim();
691 
692  void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
693  bool IsReputationGainDisabled() const { return DisableReputationGain; }
694  bool IsDamageEnoughForLootingAndReward() const { return (m_creatureInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ) || (m_PlayerDamageReq == 0); }
695  void LowerPlayerDamageReq(uint32 unDamage);
696  void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
698 
699  uint32 GetOriginalEntry() const { return m_originalEntry; }
700  void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
701 
702  static float _GetDamageMod(int32 Rank);
703 
704  float m_SightDistance, m_CombatDistance;
705 
706  bool m_isTempWorldObject; //true when possessed
707 
708  // Handling caster facing during spellcast
709  void SetTarget(ObjectGuid const& guid) override;
710  bool FocusTarget(Spell const* focusSpell, WorldObject const* target);
711  bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false);
712  void ReleaseFocus(Spell const* focusSpell = nullptr, bool withDelay = true);
713 
714  CreatureTextRepeatIds GetTextRepeatGroup(uint8 textGroup);
715  void SetTextRepeatId(uint8 textGroup, uint8 id);
716  void ClearTextRepeatGroup(uint8 textGroup);
717 
718  protected:
719  bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0);
720  bool InitEntry(uint32 entry, CreatureData const* data = nullptr);
721 
722  // vendor items
724 
725  static float _GetHealthMod(int32 Rank);
726 
730 
733  time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
734  time_t m_respawnTime; // (secs) time of next respawn
735  uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
736  uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
738  uint32 m_boundaryCheckTime; // (msecs) remaining time for next evade boundary check
739  uint32 m_combatPulseTime; // (msecs) remaining time for next zone-in-combat pulse
740  uint32 m_combatPulseDelay; // (secs) how often the creature puts the entire zone in combat (only works in dungeons)
741 
742  ReactStates m_reactState; // for AI, not charmInfo
743  void RegenerateMana();
744  void RegenerateHealth();
745  void Regenerate(Powers power);
750 
755 
758 
761 
763 
764  CreatureTemplate const* m_creatureInfo; // Can differ from sObjectMgr->GetCreatureTemplate(GetEntry()) in difficulty mode > 0
766 
767  uint16 m_LootMode; // Bitmask (default: LOOT_MODE_DEFAULT) that determines what loot will be lootable
768 
769  bool IsInvisibleDueToDespawn() const override;
770  bool CanAlwaysSee(WorldObject const* obj) const override;
771 
772  private:
773  void ForcedDespawn(uint32 timeMSToDespawn = 0);
774  bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const; // No aggro from gray creatures
775 
776  //WaypointMovementGenerator vars
779 
780  //Formation var
783 
786 
788 };
789 
791 {
792  public:
793  AssistDelayEvent(ObjectGuid victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
794 
795  bool Execute(uint64 e_time, uint32 p_time) override;
796  void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); }
797  private:
799 
803 };
804 
806 {
807  public:
808  ForcedDespawnDelayEvent(Creature& owner) : BasicEvent(), m_owner(owner) { }
809  bool Execute(uint64 e_time, uint32 p_time) override;
810 
811  private:
813 };
814 
815 #endif
Definition: Creature.h:266
void RemoveFromWorld() override
Definition: Unit.cpp:11733
Position m_transportHomePosition
Definition: Creature.h:760
Definition: Creature.h:287
void SetSkinner(ObjectGuid guid)
Definition: Creature.h:582
uint32 mount
Definition: Creature.h:356
uint32 m_corpseDelay
Definition: Creature.h:736
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:764
Definition: Creature.h:258
bool RegenHealth
Definition: Creature.h:140
int16 maxlevel
Definition: Creature.h:94
Definition: DBCEnums.h:404
ChatType
Definition: Creature.h:338
bool RemoveItem(uint32 item_id, uint8 type)
Definition: Creature.cpp:62
Definition: DBCEnums.h:406
virtual void UpdateResistances(uint32 school)=0
void ResetPlayerDamageReq()
Definition: Creature.h:696
Definition: DBCEnums.h:411
VendorItem * GetItem(uint32 slot) const
Definition: Creature.h:387
void SetRespawnTime(uint32 respawn)
Definition: Creature.h:633
#define MAX_CREATURE_DIFFICULTIES
Definition: Creature.h:76
int32 expansion
Definition: Creature.h:95
float ModManaExtra
Definition: Creature.h:134
uint32 expansionUnknown
Definition: Creature.h:96
uint32 GetRespawnDelay() const
Definition: Creature.h:637
virtual void UpdateMaxPower(Powers power)=0
std::list< VendorItemCount > VendorItemCounts
Definition: Creature.h:420
Definition: Creature.h:341
Definition: Creature.h:42
std::unordered_map< uint8, EquipmentInfo > EquipmentInfoContainerInternal
Definition: Creature.h:283
CreatureData const * m_creatureData
Definition: Creature.h:765
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:677
uint32 SkinLootId
Definition: Creature.h:121
int8_t int8
Definition: Define.h:148
std::string Name
Definition: Creature.h:88
Position m_homePosition
Definition: Creature.h:759
std::unordered_map< ObjectGuid::LowType, CreatureAddon > CreatureAddonContainer
Definition: Creature.h:363
Definition: DBCEnums.h:407
void SetTransportHomePosition(float x, float y, float z, float o)
Definition: Creature.h:675
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map)
Definition: Creature.h:571
uint8 Type
Definition: Creature.h:376
uint32 maxcount
Definition: Creature.h:373
ObjectGuid m_victim
Definition: Creature.h:800
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:9339
#define MAX_SPELL_CHARM
Definition: Unit.h:325
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const
Definition: Creature.cpp:78
void AddLootMode(uint16 lootMode)
Definition: Creature.h:595
std::unordered_map< uint32, CreatureAddon > CreatureTemplateAddonContainer
Definition: Creature.h:364
bool HasLootMode(uint16 lootMode)
Definition: Creature.h:593
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
virtual uint8 GetPetAutoSpellSize() const
Definition: Creature.h:664
uint32 m_boundaryCheckTime
Definition: Creature.h:738
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1409
float scale
Definition: Creature.h:101
uint32 phaseid
Definition: Creature.h:312
Definition: Creature.h:343
Definition: QuestDef.h:279
bool m_isTempWorldObject
Definition: Creature.h:706
uint32 rank
Definition: Creature.h:102
uint8 movementType
Definition: Creature.h:307
StringVector Title
Definition: Creature.h:262
void SetNoCallAssistance(bool val)
Definition: Creature.h:618
uint32 id
Definition: Creature.h:293
SpellSchoolMask
Definition: SharedDefines.h:285
uint32 type_flags2
Definition: Creature.h:118
int16 minlevel
Definition: Creature.h:93
float ModExperience
Definition: Creature.h:137
Definition: SpellInfo.h:326
std::string AIName
Definition: Creature.h:127
ObjectGuid lootingGroupLowGUID
Definition: Creature.h:653
float HoverHeight
Definition: Creature.h:130
uint32 GetWaypointPath() const
Definition: Creature.h:680
uint32 dynamicflags
Definition: Creature.h:111
uint64 npcflag
Definition: Creature.h:98
Definition: SharedDefines.h:3942
uint32 displayid
Definition: Creature.h:296
float ModHealth
Definition: Creature.h:131
void UpdateWaypointID(uint32 wpID)
Definition: Creature.h:684
float speed_run
Definition: Creature.h:100
TrainerSpell()
Definition: Creature.h:426
void setRegeneratingHealth(bool regenHealth)
Definition: Creature.h:663
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo) const
Definition: Unit.cpp:9255
std::vector< uint32 > CreatureQuestItemList
Definition: Creature.h:209
time_t m_respawnTime
Definition: Creature.h:734
Definition: Creature.h:54
void Clear()
Definition: Creature.h:402
AiReaction
Definition: SharedDefines.h:4351
Unit & m_owner
Definition: Creature.h:802
float speed_walk
Definition: Creature.h:99
uint32 curhealth
Definition: Creature.h:305
uint32 trainerType
Definition: Creature.h:451
uint32 InhabitType
Definition: Creature.h:129
~TrainerSpellData()
Definition: Creature.h:448
bool m_AlreadyCallAssistance
Definition: Creature.h:751
std::vector< uint8 > CreatureTextRepeatIds
Definition: Creature.h:464
Definition: Object.h:355
bool is_trigger
Definition: Creature.h:323
Definition: Creature.h:332
Loot loot
Definition: Creature.h:578
Definition: Creature.h:50
uint32 curmana
Definition: Creature.h:306
bool m_AlreadySearchedAssistance
Definition: Creature.h:752
ObjectGuid m_lootRecipient
Definition: Creature.h:727
virtual bool HasSpell(uint32) const
Definition: Unit.h:1593
Definition: Creature.h:272
Stats
Definition: SharedDefines.h:235
virtual void UpdateArmor()=0
uint32 path_id
Definition: Creature.h:355
Definition: Creature.h:334
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:487
MovementGeneratorType GetDefaultMovementType() const
Definition: Creature.h:624
CreatureData const * GetCreatureData() const
Definition: Creature.h:559
arena_t NULL
Definition: jemalloc_internal.h:624
void AddToWorld() override
Definition: Unit.cpp:11724
Position const & GetHomePosition() const
Definition: Creature.h:673
void SetCurrentEquipmentId(uint8 id)
Definition: Creature.h:548
uint32 GenerateArmor(CreatureTemplate const *info) const
Definition: Creature.h:243
SpellSchools
Definition: SharedDefines.h:272
bool HasReactState(ReactStates state) const
Definition: Creature.h:504
void SetFormation(CreatureGroup *formation)
Definition: Creature.h:688
bool IsInEvadeMode() const
Definition: Creature.h:520
Definition: Creature.h:790
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:670
bool IsTrigger() const
Definition: Creature.h:496
float spawndist
Definition: Creature.h:303
uint32 bytes2
Definition: Creature.h:358
bool HasSearchedAssistance() const
Definition: Creature.h:620
uint32 GossipMenuId
Definition: Creature.h:92
Definition: Creature.h:345
Definition: Creature.h:333
Definition: Creature.h:56
CreatureFlagsExtra
Definition: Creature.h:40
uint32 ReqSkillRank
Definition: Creature.h:435
void SetHomePosition(const Position &pos)
Definition: Creature.h:671
Definition: Object.h:423
uint32 BaseMana
Definition: Creature.h:221
#define MAX_TRAINERSPELL_ABILITY_REQS
Definition: Creature.h:422
Definition: Creature.h:467
uint32 MechanicImmuneMask
Definition: Creature.h:141
bool IsReputationGainDisabled() const
Definition: Creature.h:693
uint32 flags_extra
Definition: Creature.h:142
uint32 GetCorpseDelay() const
Definition: Creature.h:493
uint32 GetCombatPulseDelay() const
Definition: Creature.h:644
void SetDisableReputationGain(bool disable)
Definition: Creature.h:692
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746
Definition: Creature.h:47
AssistDelayEvent(ObjectGuid victim, Unit &owner)
Definition: Creature.h:793
bool dbData
Definition: Creature.h:314
void LoadPath(uint32 pathid)
Definition: Creature.h:681
VendorItemCount(uint32 _item, uint32 _count)
Definition: Creature.h:412
uint64 LowType
Definition: ObjectGuid.h:199
StringVector TitleAlt
Definition: Creature.h:263
bool CanSwim() const
Definition: Creature.h:499
std::unordered_map< uint32, CreatureQuestItemList > CreatureQuestItemMap
Definition: Creature.h:210
Definition: DBCEnums.h:413
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:787
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
Definition: Creature.h:340
double distance(double x, double y)
Definition: g3dmath.h:731
uint32 faction
Definition: Creature.h:97
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:732
Definition: Creature.h:367
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:333
uint32 ReqSkillLine
Definition: Creature.h:434
uint16 m_LootMode
Definition: Creature.h:767
std::unordered_map< uint32, EquipmentInfoContainerInternal > EquipmentInfoContainer
Definition: Creature.h:284
time_t const & GetRespawnTime() const
Definition: Creature.h:631
Definition: SharedDefines.h:69
bool IsRacialLeader() const
Definition: Creature.h:494
uint32 m_combatPulseDelay
Definition: Creature.h:740
VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type)
Definition: Creature.h:369
float posX
Definition: Creature.h:298
UnitAI * i_AI
Definition: Unit.h:2242
uint32 phaseGroup
Definition: Creature.h:313
Position const & GetTransportHomePosition() const
Definition: Creature.h:678
#define true
Definition: CascPort.h:17
Definition: Creature.h:44
uint32 GetCurrentWaypointID() const
Definition: Creature.h:683
ReactStates m_reactState
Definition: Creature.h:742
Definition: DBCEnums.h:416
Definition: SharedDefines.h:3664
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:640
uint32 unit_flags2
Definition: Creature.h:110
uint32 GetFlags2() const
Definition: ItemTemplate.h:657
Definition: SharedDefines.h:3980
void RemoveLootMode(uint16 lootMode)
Definition: Creature.h:596
uint32 m_PlayerDamageReq
Definition: Creature.h:697
float m_respawnradius
Definition: Creature.h:737
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage)=0
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 spawntimesecs
Definition: Creature.h:302
Definition: DBCEnums.h:414
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:528
Definition: Creature.h:46
bool CanGeneratePickPocketLoot() const
Definition: Creature.h:581
Definition: Creature.h:317
#define MAX_KILL_CREDIT
Definition: Creature.h:72
Definition: Creature.h:805
void SetTransportHomePosition(const Position &pos)
Definition: Creature.h:676
virtual void SaveRespawnTime()
Definition: Object.h:524
Powers
Definition: SharedDefines.h:246
float GetOrientation() const
Definition: Position.h:107
uint32 bytes1
Definition: Creature.h:357
Definition: Creature.h:424
std::vector< VendorItem * > VendorItemList
Definition: Creature.h:381
Definition: Creature.h:45
uint32 trainer_type
Definition: Creature.h:113
virtual bool UpdateStats(Stats stat)=0
CreatureGroup * m_formation
Definition: Creature.h:781
int8 GetOriginalEquipmentId() const
Definition: Creature.h:546
Definition: CreatureGroups.h:56
time_t m_corpseRemoveTime
Definition: Creature.h:733
uint32 MovementType
Definition: Creature.h:128
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:12799
uint32 AttackPower
Definition: Creature.h:223
float ModDamage
Definition: Creature.h:136
void SetRespawnRadius(float dist)
Definition: Creature.h:641
void SetDefaultMovementType(MovementGeneratorType mgt)
Definition: Creature.h:625
LocaleConstant
Definition: Common.h:115
Definition: DBCEnums.h:415
uint32 mingold
Definition: Creature.h:125
Definition: Creature.h:347
float GetRespawnRadius() const
Definition: Creature.h:640
uint32 Entry
Definition: Creature.h:81
virtual void SetCanDualWield(bool value)
Definition: Unit.h:1360
std::string IconName
Definition: Creature.h:91
Definition: LootMgr.h:314
float posY
Definition: Creature.h:299
uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS]
Definition: Creature.h:437
float GetPositionY() const
Definition: Position.h:105
std::string FemaleName
Definition: Creature.h:89
std::unordered_map< uint8, CreatureTextRepeatIds > CreatureTextRepeatGroup
Definition: Creature.h:465
G3D::int16 z
Definition: Vector3int16.h:46
InhabitTypeValues
Definition: Creature.h:329
uint32 unit_flags
Definition: Creature.h:109
void SetPosition(const Position &pos)
Definition: Creature.h:668
StringVector Name
Definition: Creature.h:274
StringVector BoxText
Definition: Creature.h:269
CreatureAI * AI() const
Definition: Creature.h:525
Definition: Object.h:398
void SetLootMode(uint16 lootMode)
Definition: Creature.h:594
float GenerateBaseDamage(CreatureTemplate const *info) const
Definition: Creature.h:248
int8 equipmentId
Definition: Creature.h:297
Definition: Creature.h:51
void SetCorpseDelay(uint32 delay)
Definition: Creature.h:492
float GetPositionZ() const
Definition: Position.h:106
int32_t int32
Definition: Define.h:146
Definition: CreatureAI.h:68
bool m_regenHealth
Definition: Creature.h:753
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:700
Definition: Creature.h:410
G3D::int16 y
Definition: Vector2int16.h:38
uint16_t uint16
Definition: Define.h:151
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: Creature.h:234
Definition: Creature.h:53
uint32 trainer_class
Definition: Creature.h:114
Definition: DBCEnums.h:409
std::unordered_map< uint16, CreatureBaseStats > CreatureBaseStatsContainer
Definition: Creature.h:256
Definition: DBCEnums.h:408
virtual bool CanAlwaysSee(WorldObject const *) const
Definition: Object.h:659
bool m_AI_locked
Definition: Creature.h:754
uint32 m_combatPulseTime
Definition: Creature.h:739
bool isRegeneratingHealth()
Definition: Creature.h:662
StringVector OptionText
Definition: Creature.h:268
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:723
Definition: DBCEnums.h:419
uint32 m_originalEntry
Definition: Creature.h:757
Definition: Unit.h:571
Definition: DBCEnums.h:410
Spell const * _focusSpell
Definition: Creature.h:784
bool CanWalk() const
Definition: Creature.h:498
float combat_reach
Definition: Creature.h:320
bool Empty() const
Definition: Creature.h:394
Definition: Map.h:259
ReactStates
Definition: Unit.h:1127
float ModMana
Definition: Creature.h:133
uint32 m_path_id
Definition: Creature.h:778
Definition: SharedDefines.h:3672
uint32 ReqLevel
Definition: Creature.h:436
TrainerSpellData()
Definition: Creature.h:447
uint8 m_equipmentId
Definition: Creature.h:748
float ModHealthExtra
Definition: Creature.h:132
bool DisableReputationGain
Definition: Creature.h:762
Creature & m_owner
Definition: Creature.h:812
bool TriggerJustRespawned
Definition: Creature.h:782
bool CanFly() const override
Definition: Creature.h:500
virtual bool Execute(uint64, uint32)
Definition: EventProcessor.h:42
float RangeVariance
Definition: Creature.h:107
uint32 VehicleId
Definition: Creature.h:124
bool IsPet() const
Definition: Unit.h:1403
static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty)
Definition: Creature.h:176
uint32 GetItemCount() const
Definition: Creature.h:395
uint32 displayId_other_gender
Definition: Creature.h:322
void DoImmediateBoundaryCheck()
Definition: Creature.h:643
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:756
CreatureGroup * GetFormation()
Definition: Creature.h:687
void ResetLootMode()
Definition: Creature.h:597
DeathState
Definition: Unit.h:539
Definition: SharedDefines.h:3934
Definition: Creature.h:353
bool IsGoldRequired(ItemTemplate const *pProto) const
Definition: Creature.h:379
Definition: Creature.h:342
Definition: EventProcessor.h:28
Definition: Creature.h:48
uint32 RangeAttackTime
Definition: Creature.h:105
std::vector< std::string > StringVector
Definition: Common.h:142
bool IsGuard() const
Definition: Creature.h:497
uint32 Modelid1
Definition: Creature.h:84
ReactStates GetReactState() const
Definition: Creature.h:503
uint32 m_respawnDelay
Definition: Creature.h:735
std::unordered_map< uint32, TrainerSpell > TrainerSpellMap
Definition: Creature.h:443
uint32 SpellID
Definition: Creature.h:432
uint32 dynamicflags
Definition: Creature.h:311
bool IsCivilian() const
Definition: Creature.h:495
Definition: ItemTemplate.h:647
uint32 Modelid3
Definition: Creature.h:86
uint32 spawnMask
Definition: Creature.h:308
CreatureData()
Definition: Creature.h:289
uint32 Modelid2
Definition: Creature.h:85
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:10593
uint32 unit_flags
Definition: Creature.h:310
Definition: DB2Structure.h:710
uint32 RangedAttackPower
Definition: Creature.h:224
uint32 BaseArmor
Definition: Creature.h:222
StringVector Name
Definition: Creature.h:260
SPECIFIC_TYPE * Find(ContainerUnorderedMap< SPECIFIC_TYPE, KEY_TYPE > const &elements, KEY_TYPE const &handle, SPECIFIC_TYPE *)
Definition: TypeContainerFunctions.h:74
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: Creature.h:229
VendorItemList m_items
Definition: Creature.h:385
uint32 trainer_race
Definition: Creature.h:115
Definition: Creature.h:55
ObjectGuid _skinner
Definition: Creature.h:729
Definition: SharedDefines.h:85
uint32 m_groupLootTimer
Definition: Creature.h:652
void SetNoSearchAssistance(bool val)
Definition: Creature.h:619
SpellSchoolMask GetMeleeDamageSchoolMask() const override
Definition: Creature.h:527
virtual void SetObjectScale(float scale)
Definition: Object.h:111
uint32 _focusDelay
Locks the target during spell cast for proper facing
Definition: Creature.h:785
std::vector< uint32 > auras
Definition: Creature.h:360
float m_SightDistance
Definition: Creature.h:704
#define TC_GAME_API
Definition: Define.h:134
void ResetPickPocketRefillTimer()
Definition: Creature.h:580
TrainerSpellMap spellList
Definition: Creature.h:450
uint32 currentwaypoint
Definition: Creature.h:304
StringVector NameAlt
Definition: Creature.h:261
Definition: SharedDefines.h:3554
virtual void SetTarget(ObjectGuid const &)=0
uint32 item
Definition: Creature.h:372
uint32 BaseAttackTime
Definition: Creature.h:104
virtual std::string const & GetNameForLocaleIdx(LocaleConstant) const
Definition: Object.h:482
uint32 itemId
Definition: Creature.h:415
Definition: Creature.h:52
MovementGeneratorType
Definition: MotionMaster.h:35
uint32 dmgschool
Definition: Creature.h:103
Definition: DBCEnums.h:418
uint32 emote
Definition: Creature.h:359
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
Definition: DBCEnums.h:417
ObjectGuid GetSkinner() const
Definition: Creature.h:583
float orientation
Definition: Creature.h:301
uint8_t uint8
Definition: Define.h:152
Definition: Position.h:27
bool hasLootRecipient() const
Definition: Creature.h:586
uint32 incrtime
Definition: Creature.h:374
Definition: SharedDefines.h:3938
ForcedDespawnDelayEvent(Creature &owner)
Definition: Creature.h:808
Definition: Creature.h:331
void SetCombatPulseDelay(uint32 delay)
Definition: Creature.h:645
uint8 GetCurrentEquipmentId() const
Definition: Creature.h:547
ObjectGuid m_lootRecipientGroup
Definition: Creature.h:728
uint32 family
Definition: Creature.h:112
std::map< uint32, time_t > CreatureSpellCooldowns
Definition: Creature.h:456
Definition: Creature.h:445
uint16 mapid
Definition: Creature.h:294
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
float ModArmor
Definition: Creature.h:135
SkillType
Definition: SharedDefines.h:3881
const FieldDescriptor value
Definition: descriptor.h:1522
bool RacialLeader
Definition: Creature.h:138
int16_t int16
Definition: Define.h:147
uint32 phaseMask
Definition: Creature.h:295
Player session in the World.
Definition: WorldSession.h:882
Definition: ObjectGuid.h:189
Definition: DBCEnums.h:422
uint32_t uint32
Definition: g3dmath.h:168
void AddAssistant(ObjectGuid guid)
Definition: Creature.h:796
uint32 ExtendedCost
Definition: Creature.h:375
#define MAX_EQUIPMENT_ITEMS
Definition: Unit.h:1297
float bounding_radius
Definition: Creature.h:319
G3D::int16 x
Definition: Vector2int16.h:37
static Vector3int16 ceil(const Vector3 &v)
Definition: Vector3int16.cpp:55
GuidList m_assistants
Definition: Creature.h:801
float BaseVariance
Definition: Creature.h:106
uint32 Modelid4
Definition: Creature.h:87
uint32 lootid
Definition: Creature.h:119
uint32 pickpocketLootId
Definition: Creature.h:120
Definition: DBCEnums.h:421
bool IsCastable() const
Definition: Creature.h:440
Definition: SharedDefines.h:3671
Definition: Creature.h:58
Definition: Creature.h:277
Definition: DBCEnums.h:412
float GetPositionX() const
Definition: Position.h:104
uint16 GetLootMode() const
Definition: Creature.h:592
time_t lastIncrementTime
Definition: Creature.h:417
virtual void UpdateMaxHealth()=0
uint32 GetHealth() const
Definition: Unit.h:1426
WeaponAttackType
Definition: Unit.h:615
Definition: Creature.h:383
Definition: Creature.h:49
Type
Type of JSON value.
Definition: rapidjson.h:642
virtual bool hasQuest(uint32) const
Definition: Object.h:180
uint64 npcflag
Definition: Creature.h:309
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213
SkillType GetRequiredLootSkill() const
Definition: Creature.h:150
Definition: Unit.h:1305
std::unordered_map< uint16, CreatureModelInfo > CreatureModelContainer
Definition: Creature.h:327
uint32 maxgold
Definition: Creature.h:126
Definition: Creature.h:43
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:638
bool IsTameable(bool canTameExotic) const
Definition: Creature.h:167
uint32 m_waypointID
Definition: Creature.h:777
void SetReactState(ReactStates st)
Definition: Creature.h:502
virtual bool UpdateAllStats()=0
Definition: SharedDefines.h:3656
uint32 movementId
Definition: Creature.h:139
uint32 GetOriginalEntry() const
Definition: Creature.h:699
uint32 ScriptID
Definition: Creature.h:143
Definition: ItemTemplate.h:211
float posZ
Definition: Creature.h:300
uint32 unit_class
Definition: Creature.h:108
bool IsDamageEnoughForLootingAndReward() const
Definition: Creature.h:694
virtual bool hasInvolvedQuest(uint32) const
Definition: Object.h:181
std::string SubName
Definition: Creature.h:90
Definition: Creature.h:79
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
Definition: Creature.h:396
uint32 type
Definition: Creature.h:116
uint32 MoneyCost
Definition: Creature.h:433
Definition: DBCEnums.h:420
bool IsExotic() const
Definition: Creature.h:162
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
Definition: Creature.h:346
Definition: Group.h:191
int8 m_originalEquipmentId
Definition: Creature.h:749
Definition: Creature.h:218
Definition: DBCEnums.h:405
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
int8 gender
Definition: Creature.h:321
Definition: DBCStructure.h:338
Definition: SharedDefines.h:3665
uint32 count
Definition: Creature.h:416
uint32 type_flags
Definition: Creature.h:117
Definition: Creature.h:344
Definition: Spell.h:294