TrinityCore
Loading...
Searching...
No Matches
Creature.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CREATURE_H
19#define TRINITYCORE_CREATURE_H
20
21#include "Unit.h"
22#include "Common.h"
23#include "CreatureData.h"
24#include "DatabaseEnvFwd.h"
25#include "Duration.h"
26#include "GridObject.h"
27#include "MapObject.h"
28#include <list>
29
30class CreatureAI;
31class CreatureGroup;
32class Quest;
33class Player;
34class SpellInfo;
35class WorldSession;
36struct Loot;
37
39
48
49typedef std::list<VendorItemCount> VendorItemCounts;
50
51// max different by z coordinate for creature aggro reaction
52#define CREATURE_Z_ATTACK_RANGE 3
53
54#define MAX_VENDOR_ITEMS 150 // Limitation in 4.x.x item count in SMSG_LIST_INVENTORY
55
57{
58 None = 0,
59 Empty = 1
60};
61
63{
64 Generic = 0x01,
65 Ammo = 0x02,
66 Food = 0x04,
67 Poison = 0x08,
68 Reagent = 0x10,
69 Petition = 0x20,
70};
71
73
75static constexpr size_t CREATURE_TAPPERS_SOFT_CAP = 5;
76
77//used for handling non-repeatable random texts
78typedef std::vector<uint8> CreatureTextRepeatIds;
79typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup;
80
81class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public MapObject
82{
83 public:
84 explicit Creature(bool isWorldObject = false);
86
87 void AddToWorld() override;
88 void RemoveFromWorld() override;
89
90 float GetNativeObjectScale() const override;
91 void SetObjectScale(float scale) override;
92 void SetDisplayId(uint32 displayId, bool setNative = false) override;
93 void SetDisplayFromModel(uint32 modelIdx);
94
95 void DisappearAndDie() { ForcedDespawn(0); }
96
97 bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, Position const& pos, CreatureData const* data, uint32 vehId, bool dynamic = false);
98
99 static Creature* CreateCreature(uint32 entry, Map* map, Position const& pos, uint32 vehId = 0);
100 static Creature* CreateCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap = true, bool allowDuplicate = false);
101
102 bool LoadCreaturesAddon();
103 void LoadCreaturesSparringHealth(bool force = false);
104 void SelectLevel();
105 void UpdateLevelDependantStats();
106 void SelectWildBattlePetLevel();
107 void LoadEquipment(int8 id = 1, bool force = false);
108 void SetSpawnHealth();
109
110 ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
111
112 void Update(uint32 time) override; // overwrited Unit::Update
113 void Heartbeat() override;
114
115 Position GetRespawnPosition(float* dist = nullptr) const;
116 bool IsSpawnedOnTransport() const { return m_creatureData && m_creatureData->mapId != GetMapId(); }
117
118 void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio = false)
119 {
120 m_corpseDelay = delay;
121 if (ignoreCorpseDecayRatio)
122 m_ignoreCorpseDecayRatio = true;
123 }
124 uint32 GetCorpseDelay() const { return m_corpseDelay; }
125 bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
126 bool IsCivilian() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) != 0; }
127 bool IsTrigger() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) != 0; }
128 bool IsGuard() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD) != 0; }
129
130 void InitializeMovementCapabilities();
131 void UpdateMovementCapabilities();
132
133 CreatureMovementData const& GetMovementTemplate() const;
134
135 // Returns true if CREATURE_STATIC_FLAG_AQUATIC is set which strictly binds the creature to liquids
136 bool IsAquatic() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_AQUATIC); }
137
138 // Returns true if CREATURE_STATIC_FLAG_AMPHIBIOUS is set which allows a creature to enter and leave liquids while sticking to the ocean floor. These creatures will become able to swim when engaged
139 bool IsAmphibious() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_AMPHIBIOUS); }
140
141 // Returns true if CREATURE_STATIC_FLAG_FLOATING is set which is disabling the gravity of the creature on spawn and reset
142 bool IsFloating() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_FLOATING); }
143 void SetFloating(bool floating) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_FLOATING, floating); SetDisableGravity(floating); }
144
145 // Returns true if CREATURE_STATIC_FLAG_SESSILE is set which permanently roots the creature in place
146 bool IsSessile() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_SESSILE); }
147 void SetSessile(bool sessile) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_SESSILE, sessile); SetControlled(sessile, UNIT_STATE_ROOT); }
148
149 // Returns true if CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER is set which does not allow the creature to go below liquid surfaces
150 bool CannotPenetrateWater() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER); }
151 void SetCannotPenetrateWater(bool cannotPenetrateWater) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER, cannotPenetrateWater); }
152
153 // Returns true if CREATURE_STATIC_FLAG_3_CANT_SWIM is set which prevents 'Amphibious' creatures from swimming when engaged
154 bool IsSwimDisabled() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_3_CANT_SWIM); }
155
156 // Returns true if CREATURE_STATIC_FLAG_4_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS is set which prevents 'Amphibious' creatures from swimming when engaged until the victim is no longer on the ocean floor
158
159 bool CanSwim() const override;
160 bool CanEnterWater() const override { return (CanSwim() || IsAmphibious()); }
161 bool CanFly() const override { return (IsFlying() || HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)); }
162
164 void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
165
166 CreatureClassifications GetCreatureClassification() const { return GetCreatureTemplate()->Classification; }
167 bool HasClassification(CreatureClassifications classification) const { return GetCreatureTemplate()->Classification == classification; }
168
169 bool IsDungeonBoss() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS) != 0; }
170 bool IsAffectedByDiminishingReturns() const override { return Unit::IsAffectedByDiminishingReturns() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) != 0; }
171
172 Unit* SelectVictim();
173
174 void SetReactState(ReactStates st) { m_reactState = st; }
175 ReactStates GetReactState() const { return m_reactState; }
176 bool HasReactState(ReactStates state) const { return (m_reactState == state); }
177 void InitializeReactState();
178
181 void SetImmuneToAll(bool apply) override { Unit::SetImmuneToAll(apply, HasReactState(REACT_PASSIVE)); }
182 using Unit::IsImmuneToPC;
184 void SetImmuneToPC(bool apply) override { Unit::SetImmuneToPC(apply, HasReactState(REACT_PASSIVE)); }
187 void SetImmuneToNPC(bool apply) override { Unit::SetImmuneToNPC(apply, HasReactState(REACT_PASSIVE)); }
188
189 void SetUnkillable(bool unkillable) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_UNKILLABLE, unkillable); }
190
192 bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
193 bool CanResetTalents(Player* player) const;
194 bool CanCreatureAttack(Unit const* victim, bool force = true) const;
195 void LoadTemplateImmunities(int32 creatureImmunitiesId);
196 bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const override;
197 bool IsElite() const;
198 bool isWorldBoss() const;
199
200 void SetInteractionAllowedWhileHostile(bool interactionAllowed) override;
201 void SetInteractionAllowedInCombat(bool interactionAllowed) override;
202 void UpdateNearbyPlayersInteractions() override;
203
204 bool HasScalableLevels() const;
205 void ApplyLevelScaling();
206 uint8 GetLevelForTarget(WorldObject const* target) const override;
207
208 uint64 GetMaxHealthByLevel(uint8 level) const;
209 float GetHealthMultiplierForTarget(WorldObject const* target) const override;
210
211 float GetBaseDamageForLevel(uint8 level) const;
212 float GetDamageMultiplierForTarget(WorldObject const* target) const override;
213
214 float GetBaseArmorForLevel(uint8 level) const;
215 float GetArmorMultiplierForTarget(WorldObject const* target) const override;
216
218 bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); }
219
221 void SetRestoreStateOnEvade(bool restoreOnEvade) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_5_NO_LEAVE_COMBAT_STATE_RESTORE, !restoreOnEvade); }
222
223 bool AIM_Destroy();
224 bool AIM_Create(CreatureAI* ai = nullptr);
225 bool AIM_Initialize(CreatureAI* ai = nullptr);
226 void Motion_Initialize();
227
228 CreatureAI* AI() const { return reinterpret_cast<CreatureAI*>(GetAI()); }
229
230 SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType /*attackType*/ = BASE_ATTACK) const override { return m_meleeDamageSchoolMask; }
231 void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
232 bool CanMelee() const { return !_staticFlags.HasFlag(CREATURE_STATIC_FLAG_NO_MELEE_FLEE) && !_staticFlags.HasFlag(CREATURE_STATIC_FLAG_4_NO_MELEE_APPROACH); }
233 void SetCanMelee(bool canMelee, bool fleeFromMelee = false);
236 void SetTreatAsRaidUnit(bool treatAsRaidUnit) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_4_TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS, treatAsRaidUnit); }
237 void StartDefaultCombatMovement(Unit* victim, Optional<float> range = {}, Optional<float> angle = {});
238
239 bool HasSpell(uint32 spellID) const override;
240
241 bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr, bool updateLevel = true);
242
243 int32 GetCreatePowerValue(Powers power) const override;
244 bool UpdateStats(Stats stat) override;
245 bool UpdateAllStats() override;
246 void UpdateArmor() override;
247 void UpdateMaxHealth() override;
248 void UpdateMaxPower(Powers power) override;
249 uint32 GetPowerIndex(Powers power) const override;
250 void UpdateAttackPowerAndDamage(bool ranged = false) override;
251 void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) const override;
252
253 void SetCanDualWield(bool value) override;
254 int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
255 uint8 GetCurrentEquipmentId() const { return m_equipmentId; }
256 void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
257
258 float GetSpellDamageMod(CreatureClassifications classification) const;
259
260 VendorItemData const* GetVendorItems() const;
261 uint32 GetVendorItemCurrentCount(VendorItem const* vItem);
262 uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count);
263 void SetVendor(NPCFlags flags, bool apply);
264 void SetPetitioner(bool apply);
265
266 CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
267 CreatureData const* GetCreatureData() const { return m_creatureData; }
268 CreatureDifficulty const* GetCreatureDifficulty() const { return m_creatureDifficulty; }
269 CreatureAddon const* GetCreatureAddon() const;
270
271 std::string const& GetAIName() const;
272 std::string GetScriptName() const;
273 uint32 GetScriptId() const;
274 void InheritStringIds(Creature const* parent);
275 bool HasStringId(std::string_view id) const;
276 void SetScriptStringId(std::string id);
277 std::string_view GetStringId(StringIdType type) const { return m_stringIds[size_t(type)] ? std::string_view(*m_stringIds[size_t(type)]) : std::string_view(); }
278
279 SpawnTrackingStateData const* GetSpawnTrackingStateDataForPlayer(Player const* player) const override;
280
281 // override WorldObject function for proper name localization
282 std::string GetNameForLocaleIdx(LocaleConstant locale) const override;
283
284 bool HasLabel(int32 cretureLabel) const;
285 std::span<int32 const> GetLabels() const;
286
287 void setDeathState(DeathState s) override; // override virtual Unit::setDeathState
288
289 bool LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool allowDuplicate);
290 void SaveToDB();
291 // overriden in Pet
292 virtual void SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDifficulties);
293 static bool DeleteFromDB(ObjectGuid::LowType spawnId);
294
295 bool CanHaveLoot() const { return !_staticFlags.HasFlag(CREATURE_STATIC_FLAG_NO_LOOT); }
296 void SetCanHaveLoot(bool canHaveLoot) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_NO_LOOT, !canHaveLoot); }
297 uint32 GetLootId() const;
298 void SetLootId(Optional<uint32> lootId);
299 std::unique_ptr<Loot> m_loot;
300 std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> m_personalLoot;
301 void StartPickPocketRefillTimer();
302 void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
303 bool CanGeneratePickPocketLoot() const;
304 GuidUnorderedSet const& GetTapList() const { return m_tapList; }
305 void SetTapList(GuidUnorderedSet tapList) { m_tapList = std::move(tapList); }
306 bool hasLootRecipient() const { return !m_tapList.empty(); }
307 bool IsTapListNotClearedOnEvade() const { return m_dontClearTapListOnEvade; }
308 void SetDontClearTapListOnEvade(bool dontClear);
309 bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
310 Loot* GetLootForPlayer(Player const* player) const override;
311 bool IsFullyLooted() const;
312 bool IsSkinnedBy(Player const* player) const;
313
314 void SetTappedBy(Unit const* unit, bool withGroup = true);
315 void AllLootRemovedFromCorpse();
316
317 uint16 GetLootMode() const { return m_LootMode; }
318 bool HasLootMode(uint16 lootMode) const { return (m_LootMode & lootMode) != 0; }
319 void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
320 void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
321 void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
322 void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
323
325
326 bool CanStartAttack(Unit const* u, bool force) const;
327 float GetAttackDistance(Unit const* player) const;
328 float GetAggroRange(Unit const* target) const;
329
330 void SendAIReaction(AiReaction reactionType);
331
332 Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
333 Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
334 Unit* SelectNearestHostileUnitInAggroRange(bool useLOS = false, bool ignoreCivilians = false) const;
335
336 void DoFleeToGetAssistance();
337 void CallForHelp(float fRadius);
338 void CallAssistance();
339 void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
340 void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
341 bool HasSearchedAssistance() const { return m_AlreadySearchedAssistance; }
342 bool CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction = true) const;
343 bool _IsTargetAcceptable(Unit const* target) const;
344 bool IsIgnoringFeignDeath() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_2_IGNORE_FEIGN_DEATH); }
345 void SetIgnoreFeignDeath(bool ignoreFeignDeath) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_2_IGNORE_FEIGN_DEATH, ignoreFeignDeath); }
346 bool IsIgnoringSanctuarySpellEffect() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_2_IGNORE_SANCTUARY); }
347 void SetIgnoreSanctuarySpellEffect(bool ignoreSanctuary) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_2_IGNORE_SANCTUARY, ignoreSanctuary); }
348
349 void RemoveCorpse(bool setSpawnTime = true, bool destroyForNearbyPlayers = true);
350
351 void DespawnOrUnsummon(Milliseconds timeToDespawn = 0s, Seconds forceRespawnTime = 0s);
352
353 time_t const& GetRespawnTime() const { return m_respawnTime; }
354 time_t GetRespawnTimeEx() const;
355 void SetRespawnTime(uint32 respawn);
356 void Respawn(bool force = false);
357 void SaveRespawnTime(uint32 forceDelay = 0);
358
359 uint32 GetRespawnDelay() const { return m_respawnDelay; }
360 void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
361
362 float GetWanderDistance() const { return m_wanderDistance; }
363 void SetWanderDistance(float dist) { m_wanderDistance = dist; }
364
365 void DoImmediateBoundaryCheck() { m_boundaryCheckTime = 0; }
366
367 void SendZoneUnderAttackMessage(Player* attacker);
368
369 bool hasQuest(uint32 quest_id) const override;
370 bool hasInvolvedQuest(uint32 quest_id) const override;
371
372 bool CanRegenerateHealth() const { return !_staticFlags.HasFlag(CREATURE_STATIC_FLAG_5_NO_HEALTH_REGEN) && _regenerateHealth; }
373 void SetRegenerateHealth(bool value) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_5_NO_HEALTH_REGEN, !value); }
374 virtual uint8 GetPetAutoSpellSize() const;
375 virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const;
376 float GetPetChaseDistance() const;
377
378 bool IsIgnoringChaseRange() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_6_ALWAYS_STAND_ON_TARGET); }
379 void SetIgnoreChaseRange(bool ignoreChaseRange) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_6_ALWAYS_STAND_ON_TARGET, ignoreChaseRange); }
380
381 void SetCannotReachTarget(bool cannotReach);
382 bool CanNotReachTarget() const { return m_cannotReachTarget; }
383
384 void SetDefaultMount(Optional<uint32> mountCreatureDisplayId);
385
386 void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
387 void SetHomePosition(Position const& pos) { m_homePosition.Relocate(pos); }
388 void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }
389 Position const& GetHomePosition() const { return m_homePosition; }
390
391 void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
392 void SetTransportHomePosition(Position const& pos) { m_transportHomePosition.Relocate(pos); }
393 void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); }
394 Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
395
396 uint32 GetWaypointPathId() const { return _waypointPathId; }
397 void LoadPath(uint32 pathid) { _waypointPathId = pathid; }
398
399 // nodeId, pathId
400 std::pair<uint32, uint32> GetCurrentWaypointInfo() const { return _currentWaypointNodeInfo; }
401 void UpdateCurrentWaypointInfo(uint32 nodeId, uint32 pathId) { _currentWaypointNodeInfo = { nodeId, pathId }; }
402
403 bool IsReturningHome() const;
404
405 void SearchFormation();
406 CreatureGroup* GetFormation() { return m_formation; }
407 void SetFormation(CreatureGroup* formation) { m_formation = formation; }
408 bool IsFormationLeader() const;
409 void SignalFormationMovement();
410 bool IsFormationLeaderMoveAllowed() const;
411
412 void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
413 bool IsReputationGainDisabled() const { return DisableReputationGain; }
414 void LowerPlayerDamageReq(uint64 unDamage);
415 void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
417
418 uint32 GetOriginalEntry() const { return m_originalEntry; }
419 void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
420
421 // There's many places not ready for dynamic spawns. This allows them to live on for now.
422 void SetRespawnCompatibilityMode(bool mode = true) { m_respawnCompatibilityMode = mode; }
423 bool GetRespawnCompatibilityMode() const { return m_respawnCompatibilityMode; }
424
425 static float GetDamageMod(CreatureClassifications classification);
426
427 float m_SightDistance, m_CombatDistance;
428
429 bool m_isTempWorldObject; //true when possessed
430
431 // Handling caster facing during spellcast
432 void SetTarget(ObjectGuid const& guid) override;
433 void DoNotReacquireSpellFocusTarget();
434 void SetSpellFocus(Spell const* focusSpell, WorldObject const* target);
435 bool HasSpellFocus(Spell const* focusSpell = nullptr) const override;
436 void ReleaseSpellFocus(Spell const* focusSpell = nullptr, bool withDelay = true);
437
438 bool IsMovementPreventedByCasting() const override;
439
440 // Part of Evade mechanics
441 time_t GetLastDamagedTime() const { return _lastDamagedTime; }
442 void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
443
444 CreatureTextRepeatIds GetTextRepeatGroup(uint8 textGroup);
445 void SetTextRepeatId(uint8 textGroup, uint8 id);
446 void ClearTextRepeatGroup(uint8 textGroup);
447 bool IsEscorted() const;
448
449 bool CanGiveExperience() const;
450 void SetCanGiveExperience(bool xpEnabled) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_NO_XP, !xpEnabled); }
451
452 bool IsEngaged() const override;
453 void AtEngage(Unit* target) override;
454 void AtDisengage() override;
455
456 bool IsThreatFeedbackDisabled() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_3_NO_THREAT_FEEDBACK); }
457 void SetNoThreatFeedback(bool noThreatFeedback) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_3_NO_THREAT_FEEDBACK, noThreatFeedback); }
458 void ForcePartyMembersIntoCombat();
459
460 bool IsAggroGracePeriodExpired() { return _aggroGracePeriodExpired; }
461
462 void OverrideSparringHealthPct(float healthPct) { _sparringHealthPct = healthPct; }
463 void OverrideSparringHealthPct(std::vector<float> const& healthPct);
464 float GetSparringHealthPct() const { return _sparringHealthPct; }
465 uint32 CalculateDamageForSparring(Unit* attacker, uint32 damage);
466 bool ShouldFakeDamageFrom(Unit* attacker);
467
468 std::string GetDebugInfo() const override;
469
470 void ExitVehicle(Position const* exitPosition = nullptr) override;
471
472 bool HasFlag(CreatureStaticFlags flag) const { return _staticFlags.HasFlag(flag); }
473 bool HasFlag(CreatureStaticFlags2 flag) const { return _staticFlags.HasFlag(flag); }
474 bool HasFlag(CreatureStaticFlags3 flag) const { return _staticFlags.HasFlag(flag); }
475 bool HasFlag(CreatureStaticFlags4 flag) const { return _staticFlags.HasFlag(flag); }
476 bool HasFlag(CreatureStaticFlags5 flag) const { return _staticFlags.HasFlag(flag); }
477 bool HasFlag(CreatureStaticFlags6 flag) const { return _staticFlags.HasFlag(flag); }
478 bool HasFlag(CreatureStaticFlags7 flag) const { return _staticFlags.HasFlag(flag); }
479 bool HasFlag(CreatureStaticFlags8 flag) const { return _staticFlags.HasFlag(flag); }
480
481 uint32 GetGossipMenuId() const;
482 void SetGossipMenuId(uint32 gossipMenuId);
483
484 uint32 GetTrainerId() const;
485 void SetTrainerId(Optional<uint32> trainerId);
486
487 void SummonGraveyardTeleporter();
488
489 void InitializeInteractSpellId();
490 void SetInteractSpellId(int32 interactSpellId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::InteractSpellID), interactSpellId); }
491
493
494 protected:
495 void BuildValuesCreate(UF::UpdateFieldFlag flags, ByteBuffer& data, Player const* target) const override;
496 void BuildValuesUpdate(UF::UpdateFieldFlag flags, ByteBuffer& data, Player const* target) const override;
497
498 public:
499 void BuildValuesUpdateWithFlag(UF::UpdateFieldFlag flags, ByteBuffer& data, Player const* target) const override;
500 void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask,
501 UF::UnitData::Mask const& requestedUnitMask, Player const* target, bool ignoreNestedChangesMask) const;
502
503 struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer
504 {
505 explicit ValuesUpdateForPlayerWithMaskSender(Creature const* owner) : Owner(owner), IgnoreNestedChangesMask(false) { }
506
511
512 void operator()(Player const* player) const;
513 };
514
515 protected:
516 bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0);
517 bool InitEntry(uint32 entry, CreatureData const* data = nullptr);
518
519 // vendor items
521
522 static float GetHealthMod(CreatureClassifications classification);
523
526
529 time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
530 time_t m_respawnTime; // (secs) time of next respawn
531 uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
532 uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
535 uint32 m_boundaryCheckTime; // (msecs) remaining time for next evade boundary check
536
537 ReactStates m_reactState; // for AI, not charmInfo
538 void RegenerateHealth();
539 void Regenerate(Powers power);
544
549
552
555
557
561 std::array<std::string const*, 3> m_stringIds;
563
565 uint16 m_LootMode; // Bitmask (default: LOOT_MODE_DEFAULT) that determines what loot will be lootable
566
568
569 bool IsInvisibleDueToDespawn(WorldObject const* seer) const override;
570 bool CanAlwaysSee(WorldObject const* obj) const override;
571
572 private:
573 void ForcedDespawn(uint32 timeMSToDespawn = 0, Seconds forceRespawnTimer = 0s);
574 bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const; // No aggro from gray creatures
575
576 // Waypoint path
578 std::pair<uint32/*nodeId*/, uint32/*pathId*/> _currentWaypointNodeInfo;
579
580 // Formation var
584
586
587 /* Spell focus system */
588 void ReacquireSpellFocusTarget();
589 struct
590 {
591 ::Spell const* Spell = nullptr;
592 uint32 Delay = 0; // ms until the creature's target should snap back (0 = no snapback scheduled)
593 ObjectGuid Target; // the creature's "real" target while casting
594 float Orientation = 0.0f; // the creature's "real" orientation while casting
595 } _spellFocusInfo;
596
597 time_t _lastDamagedTime; // Part of Evade mechanics
599
600 // Draws data from m_creatureDifficulty and spawn/difficulty based override data and returns a CreatureStaticFlagsHolder value which contains the data of both
601 CreatureStaticFlagsHolder GenerateStaticFlags(CreatureDifficulty const* creatureDifficulty, ObjectGuid::LowType spawnId, Difficulty difficultyId) const;
602 void ApplyAllStaticFlags(CreatureStaticFlagsHolder const& flags);
603
604 // Regenerate health
605 bool _regenerateHealth; // Set on creation
606
612};
613
615{
616 public:
617 AssistDelayEvent(ObjectGuid victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
618
619 bool Execute(uint64 e_time, uint32 p_time) override;
620 void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); }
621 private:
623
627};
628
630{
631 public:
632 ForcedDespawnDelayEvent(Creature& owner, Seconds respawnTimer) : BasicEvent(), m_owner(owner), m_respawnTimer(respawnTimer) { }
633 bool Execute(uint64 e_time, uint32 p_time) override;
634
635 private:
638};
639
640#endif
LocaleConstant
Definition Common.h:51
@ CREATURE_FLAG_EXTRA_DUNGEON_BOSS
@ CREATURE_FLAG_EXTRA_TRIGGER
@ CREATURE_FLAG_EXTRA_CIVILIAN
@ CREATURE_FLAG_EXTRA_GUARD
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
CreatureStaticFlags7
CreatureStaticFlags6
@ CREATURE_STATIC_FLAG_6_ALWAYS_STAND_ON_TARGET
CreatureStaticFlags8
CreatureStaticFlags5
@ CREATURE_STATIC_FLAG_5_NO_HEALTH_REGEN
@ CREATURE_STATIC_FLAG_5_NO_LEAVE_COMBAT_STATE_RESTORE
CreatureStaticFlags
@ CREATURE_STATIC_FLAG_AQUATIC
@ CREATURE_STATIC_FLAG_NO_XP
@ CREATURE_STATIC_FLAG_NO_MELEE_FLEE
@ CREATURE_STATIC_FLAG_UNKILLABLE
@ CREATURE_STATIC_FLAG_SESSILE
@ CREATURE_STATIC_FLAG_NO_LOOT
@ CREATURE_STATIC_FLAG_FLOATING
@ CREATURE_STATIC_FLAG_AMPHIBIOUS
CreatureStaticFlags3
@ CREATURE_STATIC_FLAG_3_CANT_SWIM
@ CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER
@ CREATURE_STATIC_FLAG_3_NO_THREAT_FEEDBACK
CreatureStaticFlags4
@ CREATURE_STATIC_FLAG_4_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS
@ CREATURE_STATIC_FLAG_4_NO_MELEE_APPROACH
@ CREATURE_STATIC_FLAG_4_IGNORE_LOS_WHEN_CASTING_ON_ME
@ CREATURE_STATIC_FLAG_4_TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS
CreatureStaticFlags2
@ CREATURE_STATIC_FLAG_2_IGNORE_FEIGN_DEATH
@ CREATURE_STATIC_FLAG_2_IGNORE_SANCTUARY
const uint32 MAX_CREATURE_SPELLS
VendorInventoryReason
Definition Creature.h:57
VendorDataTypeFlags
Definition Creature.h:63
std::vector< uint8 > CreatureTextRepeatIds
Definition Creature.h:78
std::list< VendorItemCount > VendorItemCounts
Definition Creature.h:49
std::unordered_map< uint8, CreatureTextRepeatIds > CreatureTextRepeatGroup
Definition Creature.h:79
static constexpr uint8 WILD_BATTLE_PET_DEFAULT_LEVEL
Definition Creature.h:74
static constexpr size_t CREATURE_TAPPERS_SOFT_CAP
Definition Creature.h:75
Difficulty
Definition DBCEnums.h:932
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
uint16 flags
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
MovementGeneratorType
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:433
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:435
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
SpellSchoolMask
StringIdType
AiReaction
WeaponAttackType
@ BASE_ATTACK
Powers
@ LOOT_MODE_DEFAULT
Stats
CreatureClassifications
SpellSchools
ReactStates
@ REACT_PASSIVE
@ MOVEMENTFLAG_CAN_FLY
NPCFlags
Non Player Character flags.
DeathState
Definition Unit.h:251
@ UNIT_STATE_EVADE
Definition Unit.h:283
@ UNIT_STATE_ROOT
Definition Unit.h:271
ObjectGuid m_victim
Definition Creature.h:624
AssistDelayEvent(ObjectGuid victim, Unit &owner)
Definition Creature.h:617
void AddAssistant(ObjectGuid guid)
Definition Creature.h:620
GuidList m_assistants
Definition Creature.h:625
void SetUpdateFieldValue(UF::UpdateFieldPrivateSetter< T > setter, typename UF::UpdateFieldPrivateSetter< T >::value_type value)
Definition BaseEntity.h:221
bool IsTreatedAsRaidUnit() const
Definition Creature.h:235
bool HasClassification(CreatureClassifications classification) const
Definition Creature.h:167
time_t _pickpocketLootRestore
Timers.
Definition Creature.h:528
bool CanMelee() const
Definition Creature.h:232
VendorItemCounts m_vendorItemCounts
Definition Creature.h:520
time_t const & GetRespawnTime() const
Definition Creature.h:353
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:386
bool IsTapListNotClearedOnEvade() const
Definition Creature.h:307
float m_wanderDistance
Definition Creature.h:534
void SetNoSearchAssistance(bool val)
Definition Creature.h:340
void RemoveLootMode(uint16 lootMode)
Definition Creature.h:321
void SetUnkillable(bool unkillable)
Definition Creature.h:189
void SetIgnoreSanctuarySpellEffect(bool ignoreSanctuary)
Definition Creature.h:347
CreatureDifficulty const * m_creatureDifficulty
Definition Creature.h:560
bool HasLootMode(uint16 lootMode) const
Definition Creature.h:318
int8 GetOriginalEquipmentId() const
Definition Creature.h:254
bool IsTrigger() const
Definition Creature.h:127
std::array< std::string const *, 3 > m_stringIds
Definition Creature.h:561
void SetHomePosition(Position const &pos)
Definition Creature.h:387
void ResetLootMode()
Definition Creature.h:322
void DoImmediateBoundaryCheck()
Definition Creature.h:365
CreatureTextRepeatGroup m_textRepeat
Definition Creature.h:598
float _sparringHealthPct
Definition Creature.h:611
bool _regenerateHealth
Definition Creature.h:605
CreatureStaticFlagsHolder _staticFlags
Definition Creature.h:567
bool IsDungeonBoss() const
Definition Creature.h:169
SpellSchoolMask m_meleeDamageSchoolMask
Definition Creature.h:550
bool IsAggroGracePeriodExpired()
Definition Creature.h:460
Optional< uint32 > m_lootId
Definition Creature.h:564
int8 m_originalEquipmentId
Definition Creature.h:543
bool GetRespawnCompatibilityMode() const
Definition Creature.h:423
bool IsIgnoringChaseRange() const
Definition Creature.h:378
void SetDisableReputationGain(bool disable)
Definition Creature.h:412
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition Creature.h:541
std::unique_ptr< Loot > m_loot
Definition Creature.h:299
CreatureDifficulty const * GetCreatureDifficulty() const
Definition Creature.h:268
Position m_transportHomePosition
Definition Creature.h:554
CreatureClassifications GetCreatureClassification() const
Definition Creature.h:166
Optional< uint32 > _defaultMountDisplayIdOverride
Definition Creature.h:607
bool IsSessile() const
Definition Creature.h:146
uint16 GetLootMode() const
Definition Creature.h:317
bool IsIgnoringFeignDeath() const
Definition Creature.h:344
bool IsCivilian() const
Definition Creature.h:126
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
bool IsReputationGainDisabled() const
Definition Creature.h:413
float GetSparringHealthPct() const
Definition Creature.h:464
bool CanIgnoreLineOfSightWhenCastingOnMe() const
Definition Creature.h:234
Optional< std::string > m_scriptStringId
Definition Creature.h:562
bool m_cannotReachTarget
Definition Creature.h:547
bool m_respawnCompatibilityMode
Definition Creature.h:583
bool IsSwimDisabled() const
Definition Creature.h:154
bool IsFloating() const
Definition Creature.h:142
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition Creature.h:300
CreatureTemplate const * m_creatureInfo
Definition Creature.h:558
bool IsSpawnedOnTransport() const
Definition Creature.h:116
bool CanFly() const override
Definition Creature.h:161
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:388
Position const & GetHomePosition() const
Definition Creature.h:389
void SetLastDamagedTime(time_t val)
Definition Creature.h:442
bool IsEvadingAttacks() const
Definition Creature.h:218
bool HasReactState(ReactStates state) const
Definition Creature.h:176
bool m_triggerJustAppeared
Definition Creature.h:582
bool _aggroGracePeriodExpired
Definition Creature.h:585
void SetCanGiveExperience(bool xpEnabled)
Definition Creature.h:450
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:393
uint32 GetOriginalEntry() const
Definition Creature.h:418
bool IsThreatFeedbackDisabled() const
Definition Creature.h:456
MovementGeneratorType m_defaultMovementType
Definition Creature.h:540
bool CanHaveLoot() const
Definition Creature.h:295
void SetReactState(ReactStates st)
Definition Creature.h:174
UF::OptionalUpdateField< UF::VendorData, int32(WowCS::EntityFragment::FVendor_C), 0 > m_vendorData
Definition Creature.h:492
GuidUnorderedSet const & GetTapList() const
Definition Creature.h:304
uint32 _waypointPathId
Definition Creature.h:577
void ResetPlayerDamageReq()
Definition Creature.h:415
int32 _creatureImmunitiesId
Definition Creature.h:608
std::pair< uint32, uint32 > _currentWaypointNodeInfo
Definition Creature.h:578
void SetCannotPenetrateWater(bool cannotPenetrateWater)
Definition Creature.h:151
bool hasLootRecipient() const
Definition Creature.h:306
void SetRespawnCompatibilityMode(bool mode=true)
Definition Creature.h:422
void SetCurrentEquipmentId(uint8 id)
Definition Creature.h:256
void SetRespawnDelay(uint32 delay)
Definition Creature.h:360
bool HasFlag(CreatureStaticFlags7 flag) const
Definition Creature.h:478
uint32 m_cannotReachTimer
Definition Creature.h:548
uint32 m_respawnDelay
Definition Creature.h:531
time_t m_corpseRemoveTime
Definition Creature.h:529
void UpdateCurrentWaypointInfo(uint32 nodeId, uint32 pathId)
Definition Creature.h:401
void SetRestoreStateOnEvade(bool restoreOnEvade)
Definition Creature.h:221
time_t m_respawnTime
Definition Creature.h:530
uint32 _gossipMenuId
Definition Creature.h:609
void SetRegenerateHealth(bool value)
Definition Creature.h:373
bool HasFlag(CreatureStaticFlags3 flag) const
Definition Creature.h:474
CreatureData const * m_creatureData
Definition Creature.h:559
float m_CombatDistance
Definition Creature.h:427
SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType=BASE_ATTACK) const override
Definition Creature.h:230
bool HasFlag(CreatureStaticFlags2 flag) const
Definition Creature.h:473
uint16 m_LootMode
Definition Creature.h:565
uint32 m_boundaryCheckTime
Definition Creature.h:535
Position m_homePosition
Definition Creature.h:553
uint32 GetWaypointPathId() const
Definition Creature.h:396
CreatureData const * GetCreatureData() const
Definition Creature.h:267
std::pair< uint32, uint32 > GetCurrentWaypointInfo() const
Definition Creature.h:400
void SetFloating(bool floating)
Definition Creature.h:143
ObjectGuid::LowType GetSpawnId() const
Definition Creature.h:110
bool CanNotReachTarget() const
Definition Creature.h:382
bool m_AlreadyCallAssistance
Definition Creature.h:545
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:266
uint32 GetRespawnDelay() const
Definition Creature.h:359
Position const & GetTransportHomePosition() const
Definition Creature.h:394
void SetSessile(bool sessile)
Definition Creature.h:147
bool CanRegenerateHealth() const
Definition Creature.h:372
bool DisableReputationGain
Definition Creature.h:556
CreatureGroup * m_formation
Definition Creature.h:581
void SetInteractSpellId(int32 interactSpellId)
Definition Creature.h:490
bool HasSearchedAssistance() const
Definition Creature.h:341
void SetTransportHomePosition(Position const &pos)
Definition Creature.h:392
bool IsStateRestoredOnEvade() const
Definition Creature.h:220
uint32 m_corpseDelay
Definition Creature.h:532
bool HasFlag(CreatureStaticFlags4 flag) const
Definition Creature.h:475
bool HasFlag(CreatureStaticFlags6 flag) const
Definition Creature.h:477
void SetCanHaveLoot(bool canHaveLoot)
Definition Creature.h:296
void SetNoThreatFeedback(bool noThreatFeedback)
Definition Creature.h:457
void SetImmuneToNPC(bool apply) override
Definition Creature.h:187
uint8 m_equipmentId
Definition Creature.h:542
CreatureGroup * GetFormation()
Definition Creature.h:406
bool m_AlreadySearchedAssistance
Definition Creature.h:546
uint32 GetCorpseDelay() const
Definition Creature.h:124
GuidUnorderedSet m_tapList
Definition Creature.h:524
bool m_dontClearTapListOnEvade
Definition Creature.h:525
bool CannotPenetrateWater() const
Definition Creature.h:150
void OverrideSparringHealthPct(float healthPct)
Definition Creature.h:462
std::string_view GetStringId(StringIdType type) const
Definition Creature.h:277
bool CanEnterWater() const override
Definition Creature.h:160
uint32 m_originalEntry
Definition Creature.h:551
void SetImmuneToAll(bool apply) override
Definition Creature.h:181
bool IsIgnoringSanctuarySpellEffect() const
Definition Creature.h:346
bool HasFlag(CreatureStaticFlags8 flag) const
Definition Creature.h:479
bool m_isTempWorldObject
Definition Creature.h:429
void AddLootMode(uint16 lootMode)
Definition Creature.h:320
ObjectGuid Target
Definition Creature.h:593
ReactStates m_reactState
Definition Creature.h:537
time_t _lastDamagedTime
Definition Creature.h:597
ReactStates GetReactState() const
Definition Creature.h:175
void SetTransportHomePosition(float x, float y, float z, float o)
Definition Creature.h:391
void SetWanderDistance(float dist)
Definition Creature.h:363
time_t GetLastDamagedTime() const
Definition Creature.h:441
Optional< uint32 > _trainerId
Definition Creature.h:610
bool HasFlag(CreatureStaticFlags flag) const
Definition Creature.h:472
uint8 GetCurrentEquipmentId() const
Definition Creature.h:255
void SetFormation(CreatureGroup *formation)
Definition Creature.h:407
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
void SetMeleeDamageSchool(SpellSchools school)
Definition Creature.h:231
float GetWanderDistance() const
Definition Creature.h:362
bool IsAmphibious() const
Definition Creature.h:139
void ResetPickPocketRefillTimer()
Definition Creature.h:302
void SetNoCallAssistance(bool val)
Definition Creature.h:339
void SetTreatAsRaidUnit(bool treatAsRaidUnit)
Definition Creature.h:236
bool IsAffectedByDiminishingReturns() const override
Definition Creature.h:170
bool IsRacialLeader() const
Definition Creature.h:125
bool m_ignoreCorpseDecayRatio
Definition Creature.h:533
bool CanOnlySwimIfTargetSwims() const
Definition Creature.h:157
bool IsAquatic() const
Definition Creature.h:136
bool HasFlag(CreatureStaticFlags5 flag) const
Definition Creature.h:476
void SetIgnoreChaseRange(bool ignoreChaseRange)
Definition Creature.h:379
bool IsInEvadeMode() const
Definition Creature.h:217
bool IsGuard() const
Definition Creature.h:128
CreatureAI * AI() const
Definition Creature.h:228
void SetLootMode(uint16 lootMode)
Definition Creature.h:319
void SetDefaultMovementType(MovementGeneratorType mgt)
Definition Creature.h:164
void LoadPath(uint32 pathid)
Definition Creature.h:397
void SetTapList(GuidUnorderedSet tapList)
Definition Creature.h:305
void SetOriginalEntry(uint32 entry)
Definition Creature.h:419
void DisappearAndDie()
Definition Creature.h:95
void SetIgnoreFeignDeath(bool ignoreFeignDeath)
Definition Creature.h:345
uint64 m_PlayerDamageReq
Definition Creature.h:416
Seconds const m_respawnTimer
Definition Creature.h:637
ForcedDespawnDelayEvent(Creature &owner, Seconds respawnTimer)
Definition Creature.h:632
Definition Map.h:225
uint64 LowType
Definition ObjectGuid.h:321
virtual void BuildValuesUpdateWithFlag(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const
Definition Object.cpp:135
virtual bool hasQuest(uint32) const
Definition Object.h:103
virtual void BuildValuesCreate(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const =0
virtual void BuildValuesUpdate(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const =0
virtual Loot * GetLootForPlayer(Player const *player) const
Definition Object.h:167
virtual void SetObjectScale(float scale)
Definition Object.h:93
virtual bool hasInvolvedQuest(uint32) const
Definition Object.h:104
virtual SpawnTrackingStateData const * GetSpawnTrackingStateDataForPlayer(Player const *player) const
Definition Object.h:169
Definition Spell.h:277
Definition Unit.h:635
void SetImmuneToAll(bool apply, bool keepCombat)
Definition Unit.cpp:8505
void SetImmuneToPC(bool apply, bool keepCombat)
Definition Unit.cpp:8518
virtual bool IsMovementPreventedByCasting() const
Definition Unit.cpp:3261
virtual MovementGeneratorType GetDefaultMovementType() const
Definition Unit.cpp:10675
void Heartbeat() override
Definition Unit.cpp:502
virtual int32 GetCreatePowerValue(Powers power) const
void AddToWorld() override
Definition Unit.cpp:10233
virtual float GetArmorMultiplierForTarget(WorldObject const *) const
Definition Unit.h:809
virtual void SetCanDualWield(bool value)
Definition Unit.h:704
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11545
virtual bool UpdateAllStats()=0
virtual void AtEngage(Unit *)
Definition Unit.h:1980
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
virtual void AtDisengage()
Definition Unit.h:1981
std::string GetDebugInfo() const override
Definition Unit.cpp:14591
void SetImmuneToNPC(bool apply, bool keepCombat)
Definition Unit.cpp:8541
UnitAI * GetAI() const
Definition Unit.h:668
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13361
virtual void SetInteractionAllowedWhileHostile(bool interactionAllowed)
Definition Unit.cpp:9292
virtual bool HasSpell(uint32) const
Definition Unit.h:1084
virtual bool IsAffectedByDiminishingReturns() const
Definition Unit.h:686
bool IsImmuneToNPC() const
Definition Unit.h:1048
virtual void SetInteractionAllowedInCombat(bool interactionAllowed)
Definition Unit.cpp:9302
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
Definition Unit.cpp:7917
bool IsImmuneToAll() const
Definition Unit.h:1042
virtual void UpdateNearbyPlayersInteractions()
Definition Unit.cpp:9313
virtual void UpdateArmor()=0
virtual float GetDamageMultiplierForTarget(WorldObject const *) const
Definition Unit.h:808
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:1734
virtual void UpdateMaxPower(Powers power)=0
uint64 GetHealth() const
Definition Unit.h:788
virtual bool UpdateStats(Stats stat)=0
uint8 GetLevelForTarget(WorldObject const *) const override
Definition Unit.h:759
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage) const =0
virtual void SetTarget(ObjectGuid const &)=0
virtual uint32 GetPowerIndex(Powers power) const =0
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
Definition Unit.h:1881
virtual float GetHealthMultiplierForTarget(WorldObject const *) const
Definition Unit.h:807
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
virtual void Update(uint32 time) override
Definition Unit.cpp:423
virtual bool CanSwim() const
Definition Unit.cpp:12944
virtual float GetNativeObjectScale() const
Definition Unit.h:1608
void RemoveFromWorld() override
Definition Unit.cpp:10241
virtual void UpdateMaxHealth()=0
virtual bool HasSpellFocus(Spell const *=nullptr) const
Definition Unit.h:1490
virtual void setDeathState(DeathState s)
Definition Unit.cpp:9161
bool IsFlying() const
Definition Unit.h:1807
virtual bool IsEngaged() const
Definition Unit.h:1034
bool IsImmuneToPC() const
Definition Unit.h:1045
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition Unit.cpp:10779
virtual void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:12835
constexpr uint32 GetMapId() const
Definition Position.h:216
virtual bool IsInvisibleDueToDespawn(WorldObject const *seer) const
Definition Object.h:607
std::string GetNameForLocaleIdx(LocaleConstant) const override
Definition Object.h:345
virtual bool CanAlwaysSee(WorldObject const *) const
Definition Object.h:604
Player session in the World.
UpdateFieldFlag
Definition UpdateField.h:37
ValuesUpdateForPlayerWithMaskSender(Creature const *owner)
Definition Creature.h:505
Definition Loot.h:286
UpdateField< int32, 96, 117 > InteractSpellID
time_t lastIncrementTime
Definition Creature.h:46
uint32 itemId
Definition Creature.h:44