55#include <G3D/g3dmath.h>
63 char const*
const ChaseStates[] = {
"Run",
"CanWalk",
"AlwaysWalk" };
64 char const*
const RandomStates[] = {
"Walk",
"CanRun",
"AlwaysRun" };
66 std::ostringstream str;
83 return vendorItem.item == item_id && vendorItem.Type == type;
86 bool found = newEnd !=
m_items.end();
94 if (vendorItem.item == item_id && vendorItem.ExtendedCost == extendedCost && vendorItem.Type == type)
121 return &(*selectedItr);
127 if (model.CreatureDisplayID)
136 if (displayId == model.CreatureDisplayID)
146 if (modelInfo && modelInfo->is_trigger)
156 if (modelInfo && !modelInfo->is_trigger)
176 queryTemp.
Allow =
true;
198 stats.Display.TotalProbability += model.Probability;
199 return { model.CreatureDisplayID, model.DisplayScale, model.Probability };
202 stats.HpMulti = creatureDifficulty->HealthModifier;
203 stats.EnergyMulti = creatureDifficulty->ManaModifier;
205 stats.CreatureMovementInfoID = movementId;
206 stats.RequiredExpansion = RequiredExpansion;
207 stats.HealthScalingExpansion = creatureDifficulty->HealthScalingExpansion;
208 stats.VignetteID = VignetteID;
209 stats.Class = unit_class;
210 stats.CreatureDifficultyID = creatureDifficulty->CreatureDifficultyID;
211 stats.WidgetSetID = WidgetSetID;
212 stats.WidgetSetUnitConditionID = WidgetSetUnitConditionID;
214 stats.Title = SubName;
215 stats.TitleAlt = TitleAlt;
216 stats.CursorName = IconName;
218 if (std::vector<uint32>
const* items =
sObjectMgr->GetCreatureQuestItemList(
Entry, difficulty))
219 stats.QuestItems.assign(items->begin(), items->end());
221 if (std::vector<int32>
const* currencies =
sObjectMgr->GetCreatureQuestCurrencyList(
Entry))
222 stats.QuestCurrencies.assign(currencies->begin(), currencies->end());
234 queryTemp.ShrinkToFit();
235 return queryTemp.Move();
252 DefaultCreatureDifficulty()
257 HealthScalingExpansion = 0;
258 HealthModifier = 1.f;
261 DamageModifier = 1.f;
262 CreatureDifficultyID = 0;
266 PickPocketLootID = 0;
272 static const DefaultCreatureDifficulty defDifficulty;
273 return &defDifficulty;
297 return sObjectMgr->GetCreatureBaseStats(level, unitClass);
307 m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_ignoreCorpseDecayRatio(false), m_wanderDistance(0.0f), m_boundaryCheckTime(2500), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(
REACT_AGGRESSIVE),
308 m_defaultMovementType(
IDLE_MOTION_TYPE), m_spawnId(
UI64LIT(0)), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_cannotReachTarget(false), m_cannotReachTimer(0),
309 m_meleeDamageSchoolMask(
SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_creatureDifficulty(nullptr), _waypointPathId(0), _currentWaypointNodeInfo(0, 0),
310 m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), _lastDamagedTime(0),
311 _regenerateHealth(true), _creatureImmunitiesId(0), _gossipMenuId(0), _sparringHealthPct(0)
385 sFormationMgr->AddCreatureToGroup(formationInfo->LeaderSpawnId,
this);
428 ai->CorpseRemoved(respawnDelay);
430 if (destroyForNearbyPlayers)
454 transport->CalculatePassengerPosition(x, y, z, &o);
492 TC_LOG_ERROR(
"sql.sql",
"Creature::InitEntry creature entry {} does not exist.", entry);
509 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", entry);
517 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has invalid model {} defined in table `creature_template`, can't load.", entry, model.
CreatureDisplayID);
593 uint32 unitFlags, unitFlags2, unitFlags3;
603 unitFlags &= ~UNIT_FLAG_IN_COMBAT;
627 if (previousHealth > 0)
664 owner->VehicleSpellInitialize();
753 if (!linkedRespawnTime)
758 if (targetGuid == dbtableHighGuid)
763 time_t baseRespawnTime = std::max(linkedRespawnTime, now);
768 if (baseRespawnTime <= std::numeric_limits<time_t>::max() - offset)
844 if (
Player* player = it->GetSource())
846 if (player->IsGameMaster())
889 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}",
GetDebugInfo());
892 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}",
GetDebugInfo());
926 if (curValue >= maxValue)
929 float addvalue = 0.0f;
952 addvalue =
uint32((27.0f / 5.0f + 17.0f) * ManaIncreaseRate);
955 addvalue = maxValue / 3;
979 if (curValue >= maxValue)
989 addvalue = 0.015f * ((float)
GetMaxHealth()) * HealthIncreaseRate;
992 addvalue = maxValue/3;
1089 TC_LOG_ERROR(
"sql.sql",
"Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1103 TC_LOG_ERROR(
"entities.unit",
"Creature::Create(): given coordinates for creature (guidlow {}, entry {}) are not valid (X: {}, Y: {}, Z: {}, O: {})", guidlow, entry, pos.
GetPositionX(), pos.
GetPositionY(), pos.
GetPositionZ(), pos.
GetOrientation());
1190 if (!creature->Create(lowGuid, map, entry, pos,
nullptr, vehId))
1202 if (!creature->
LoadFromDB(spawnId, map, addToMap, allowDuplicate))
1213 Unit* target =
nullptr;
1225 if (owner->IsInCombat())
1229 for (ControlList::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
1231 if ((*itr)->IsInCombat())
1257 if (!iAuras.empty())
1259 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
1261 if ((*itr)->GetBase()->IsPermanent())
1365 for (
auto const* itr = group->GetFirstMember(); itr !=
nullptr; itr = itr->next())
1366 if (
GetMap()->IsRaid() || group->SameSubGroup(player, itr->GetSource()))
1367 m_tapList.insert(itr->GetSource()->GetGUID());
1403 if (!loot->isLooted())
1424 TC_LOG_ERROR(
"entities.unit",
"Creature::SaveToDB failed, cannot get creature data!");
1430 if (transport->GetMapIdForSpawning() >= 0)
1431 mapId = transport->GetMapIdForSpawning();
1459 if (spawnNpcFlags != cinfo->npcflag)
1460 npcflag = spawnNpcFlags;
1465 if (
m_unitData->Flags2 != cinfo->unit_flags2)
1468 if (
m_unitData->Flags3 != cinfo->unit_flags3)
1516 trans->Append(stmt);
1524 stmt->
setString(index++, [&data]() -> std::string
1529 std::ostringstream os;
1531 os <<
int32(*itr++);
1534 os <<
',' <<
int32(*itr);
1552 if (npcflag.has_value())
1557 if (unitFlags.has_value())
1562 if (unitFlags2.has_value())
1567 if (unitFlags3.has_value())
1571 trans->Append(stmt);
1616 SetPower(powerType, powerTypeEntry->DefaultPower);
1624 float weaponBaseMinDamage = basedamage;
1625 float weaponBaseMaxDamage = basedamage * 1.5f;
1650 if (areaTable->WildBattlePetLevelMin > 0)
1651 wildBattlePetLevel =
urand(areaTable->WildBattlePetLevelMin, areaTable->WildBattlePetLevelMax);
1659 switch (classification)
1688 switch (classification)
1711 switch (classification)
1752 if (
GetHealth() - damage <= sparringHealth)
1794 TC_LOG_ERROR(
"sql.sql",
"Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1832 if (!allowDuplicate)
1837 std::vector <Creature*> despawnList;
1839 if (creatureBounds.first != creatureBounds.second)
1841 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1843 if (itr->second->IsAlive())
1845 TC_LOG_DEBUG(
"maps",
"Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1850 despawnList.push_back(itr->second);
1851 TC_LOG_DEBUG(
"maps",
"Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1855 for (
Creature* despawnCreature : despawnList)
1857 despawnCreature->AddObjectToRemoveList();
1865 TC_LOG_ERROR(
"sql.sql",
"Creature (SpawnID {}) not found in table `creature`, can't load. ", spawnId);
1908 TC_LOG_ERROR(
"entities.unit",
"Creature (SpawnID {}) trying to load despite a respawn timer in progress:\n{}", spawnId,
GetDebugInfo());
1935 if (addToMap && !
GetMap()->AddToMap(
this))
2014 [spawnId, charTrans](
Map* map) ->
void
2017 std::vector<Creature*> toUnload;
2018 for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetCreatureBySpawnIdStore(), spawnId))
2019 toUnload.push_back(pair.second);
2020 for (Creature* creature : toUnload)
2021 map->AddObjectToRemoveList(creature);
2022 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, spawnId, charTrans);
2036 trans->Append(stmt);
2041 trans->Append(stmt);
2045 trans->Append(stmt);
2049 trans->Append(stmt);
2053 trans->Append(stmt);
2058 trans->Append(stmt);
2063 trans->Append(stmt);
2068 trans->Append(stmt);
2073 trans->Append(stmt);
2145 if (notAbove == 0 && notBelow == 0)
2148 if (playerLevel <= notBelow || (playerLevel >= notAbove && notAbove > 0))
2160 float maxRadius = 45.0f * aggroRate;
2161 float minRadius = 5.0f * aggroRate;
2166 int32 levelDifference = creatureLevel - playerLevel;
2173 float aggroRadius = baseAggroDistance + float(levelDifference);
2185 if (creatureLevel > expansionMaxLevel)
2186 aggroRadius = baseAggroDistance + float(expansionMaxLevel - playerLevel);
2189 if (aggroRadius > maxRadius)
2190 aggroRadius = maxRadius;
2191 else if (aggroRadius < minRadius)
2192 aggroRadius = minRadius;
2194 return (aggroRadius * aggroRate);
2274 uint32 unitFlags, unitFlags2, unitFlags3;
2358 TC_LOG_DEBUG(
"entities.unit",
"Respawning creature {} ({})",
2365 if (timeMSToDespawn)
2379 bool overrideRespawnTime =
false;
2382 if (forceRespawnTimer > Seconds::zero())
2386 overrideRespawnTime =
true;
2400 if (forceRespawnTimer > Seconds::zero())
2418 summon->UnSummon(timeToDespawn.count());
2427 static uint32 constexpr placeholderSpellId = std::numeric_limits<uint32>::max();
2431 for (std::size_t i = 0; i < immunities->
School.size(); ++i)
2432 if (immunities->
School[i])
2435 for (std::size_t i = 0; i < immunities->
DispelType.size(); ++i)
2439 for (std::size_t i = 0; i < immunities->
Mechanic.size(); ++i)
2455 applyCreatureImmunities(immunities,
false);
2461 applyCreatureImmunities(immunities,
true);
2468 bool requireImmunityPurgesEffectAttribute )
const
2498 Unit* target =
nullptr;
2510 TC_LOG_ERROR(
"entities.unit",
"Creature {} SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.",
GetGUID().
ToString());
2514 Unit* target =
nullptr;
2530 TC_LOG_DEBUG(
"network",
"WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2543 std::list<Creature*> assistList;
2548 if (!assistList.empty())
2551 while (!assistList.empty())
2555 assistList.pop_front();
2698 if (!ai->CanAIAttack(victim))
2711 if (
GetMap()->IsDungeon())
2756 Mount(mountDisplayId);
2769 if (creatureAddon->
emote != 0)
2781 if (creatureAddon->
PathId != 0)
2784 if (!creatureAddon->
auras.empty())
2786 for (std::vector<uint32>::const_iterator itr = creatureAddon->
auras.begin(); itr != creatureAddon->
auras.end(); ++itr)
2789 if (!AdditionalSpellInfo)
2809 if (force || std::find(templateValues->begin(), templateValues->end(),
_sparringHealthPct) != templateValues->end())
2837 if (!currentMovement)
2840 bool canChangeMovement = [&]
2842 if (wasFleeingFromMelee)
2848 if (!canChangeMovement)
2942 return *movementOverride;
2969 bool isFullySkinned = [&]() ->
bool
2974 bool hasSkinningLoot =
false;
2979 if (!loot->isLooted())
2982 hasSkinningLoot =
true;
2986 return hasSkinningLoot;
3017 auto sender = [&](
Player const* receiver)
3019 receiver->PlayerTalkClass->SendQuestGiverStatus(receiver->GetQuestDialogStatus(
this),
GetGUID());
3043 int32 delta = mindelta == maxdelta ? mindelta :
irand(mindelta, maxdelta);
3054 return std::max(baseHealth * creatureDifficulty->
HealthModifier, 1.0f);
3106 if (
Unit const* unitTarget = target->
ToUnit())
3111 return RoundToInterval<uint8>(level, 1u, 255u);
3122 int32 targetLevel = unitTarget->m_unitData->EffectiveLevel;
3124 targetLevel = unitTarget->GetLevel();
3126 int32 targetLevelDelta = 0;
3131 scalingLevelMin = scalingLevelMax;
3133 int32 maxCreatureScalingLevel = playerTarget->m_activePlayerData->MaxCreatureScalingLevel;
3134 targetLevelDelta = std::min(maxCreatureScalingLevel > 0 ? maxCreatureScalingLevel - targetLevel : 0, *playerTarget->m_activePlayerData->ScalingPlayerLevelDelta);
3137 int32 levelWithDelta = targetLevel + targetLevelDelta;
3138 int32 level =
RoundToInterval(levelWithDelta, scalingLevelMin, scalingLevelMax) + scalingLevelDelta;
3196 if (itr->itemId == vItem->
item)
3210 if ((vCount->
count + diff * pProto->GetBuyCount()) >= vItem->
maxcount)
3216 vCount->
count += diff * pProto->GetBuyCount();
3220 return vCount->
count;
3230 if (itr->itemId == vItem->
item)
3248 if ((vCount->
count + diff * pProto->GetBuyCount()) < vItem->
maxcount)
3249 vCount->
count += diff * pProto->GetBuyCount();
3254 vCount->
count = vCount->
count > used_count ? vCount->
count-used_count : 0;
3256 return vCount->
count;
3264 if (cl->Name.size() > locale && !cl->Name[locale].empty())
3265 return cl->Name[locale];
3280 return m_charmInfo->GetCharmSpell(pos)->GetAction();
3295 if (spellInfo->GetRecoveryTime() == 0 && spellInfo->RangeEntry && spellInfo->RangeEntry->ID != 1 && spellInfo->RangeEntry->ID != 2 && spellInfo->GetMaxRange() > range)
3296 range = spellInfo->GetMaxRange();
3311 TC_LOG_DEBUG(
"entities.unit.chase",
"Creature::SetCannotReachTarget() called with true. Details: {}",
GetDebugInfo());
3317 mountCreatureDisplayId.reset();
3327 if (target &&
IsPet())
3340 if (levelDiff < -25)
3344 float aggroRadius = 20;
3347 aggroRadius -= (float)levelDiff;
3361 if (aggroRadius < 10)
3364 return (aggroRadius);
3376 Unit* target =
nullptr;
3474 if (!turnDisabled && noTurnDuringCast && target)
3477 if (noTurnDuringCast)
3487 TC_LOG_WARN(
"entities.unit",
"Creature '{}' (entry {}) has spell focus (spell id {}, delay {}ms) despite being dead.",
3526 TC_LOG_ERROR(
"entities.unit",
"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {}",
GetDebugInfo());
3572 if (std::find(repeats.begin(), repeats.end(),
id) == repeats.end())
3573 repeats.push_back(
id);
3582 CreatureTextRepeatGroup::const_iterator groupItr =
m_textRepeat.find(textGroup);
3584 ids = groupItr->second;
3591 CreatureTextRepeatGroup::iterator groupItr =
m_textRepeat.find(textGroup);
3593 groupItr->second.clear();
3604 return ai->IsEngaged();
3631 for (
auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); ++seat)
3639 ai->JustEngagedWith(target);
3641 formation->MemberEngagingTarget(
this, target);
3663 return ai->IsEscorted();
3669 std::stringstream sstr;
3730 auto itr = clickBounds.begin();
3732 if (itr != clickBounds.end() && ++itr == clickBounds.end())
@ SPELL_SPIRIT_HEAL_CHANNEL_AOE
constexpr uint8 MAX_SPELL_CHARM
const uint32 CREATURE_REGEN_INTERVAL
@ CREATURE_FLAG_EXTRA_DUNGEON_BOSS
@ CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING
@ CREATURE_FLAG_EXTRA_CANNOT_ENTER_COMBAT
@ CREATURE_FLAG_EXTRA_NO_XP
@ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK
@ CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH
@ CREATURE_FLAG_EXTRA_NO_TAUNT
@ CREATURE_FLAG_EXTRA_GHOST_VISIBILITY
@ CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK
@ CREATURE_FLAG_EXTRA_WORLDEVENT
@ CREATURE_STATIC_FLAG_CAN_SWIM
@ CREATURE_STATIC_FLAG_NO_XP
@ CREATURE_STATIC_FLAG_NO_MELEE_FLEE
CreatureChaseMovementType
const uint8 MAX_KILL_CREDIT
@ CREATURE_STATIC_FLAG_4_NO_BIRTH_ANIM
@ CREATURE_STATIC_FLAG_4_NO_MELEE_APPROACH
@ CREATURE_STATIC_FLAG_5_NO_HEALTH_REGEN
@ CREATURE_STATIC_FLAG_5_INTERACT_WHILE_HOSTILE
CreatureRandomMovementType
const uint32 CREATURE_NOPATH_EVADE_TIME
@ CREATURE_STATIC_FLAG_3_ALLOW_INTERACTION_WHILE_IN_COMBAT
@ CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT
const uint32 MAX_CREATURE_SPELLS
const uint32 PET_FOCUS_REGEN_INTERVAL
@ NPC_ALLIANCE_GRAVEYARD_TELEPORT
@ NPC_HORDE_GRAVEYARD_TELEPORT
std::vector< uint8 > CreatureTextRepeatIds
#define CREATURE_Z_ATTACK_RANGE
static constexpr uint8 WILD_BATTLE_PET_DEFAULT_LEVEL
static constexpr size_t CREATURE_TAPPERS_SOFT_CAP
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
DB2Storage< ChrRacesEntry > sChrRacesStore("ChrRaces.db2", &ChrRacesLoadInfo::Instance)
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", &CreatureDisplayInfoLoadInfo::Instance)
DB2Storage< FactionTemplateEntry > sFactionTemplateStore("FactionTemplate.db2", &FactionTemplateLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
@ UnitsUseDefaultPowerOnInit
@ FACTION_TEMPLATE_FLAG_PVP
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
#define MAX_FALL_DISTANCE
#define SIZE_OF_GRID_CELL
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define MAX_VISIBILITY_DISTANCE
#define DEFAULT_PLAYER_COMBAT_REACH
@ TEMPSUMMON_TIMED_DESPAWN
#define DEFAULT_PLAYER_DISPLAY_SCALE
std::optional< T > Optional
Optional helper class to wrap optional values within.
int32 irand(int32 min, int32 max)
uint32 urand(uint32 min, uint32 max)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void ClearGossipMenuFor(Player *player)
@ SERVERSIDE_VISIBILITY_GHOST
constexpr uint32 GetMaxLevelForExpansion(uint32 expansion)
@ SPELL_ATTR5_AI_DOESNT_FACE_TARGET
@ SPELL_SCHOOL_MASK_NORMAL
@ CREATURE_TYPE_NON_COMBAT_PET
@ CREATURE_TYPE_MECHANICAL
@ SPELL_EFFECT_KNOCK_BACK_DEST
@ SPELL_EFFECT_KNOCK_BACK
float const GROUND_HEIGHT_TOLERANCE
@ FACTION_ALLIANCE_GENERIC
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
@ CREATURE_TYPE_FLAG_BOSS_MOB
@ CREATURE_TYPE_FLAG_ALLOW_INTERACTION_WHILE_IN_COMBAT
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Creature can be targeted by spells that require target to be in caster's party/raid.
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
@ LINKED_RESPAWN_CREATURE_TO_GO
@ LINKED_RESPAWN_CREATURE_TO_CREATURE
@ LINKED_RESPAWN_GO_TO_CREATURE
@ SPELL_AURA_MOD_POWER_REGEN
@ SPELL_AURA_PREVENTS_FLEEING
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
@ SPELL_AURA_MOD_DETECTED_RANGE
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ SPELL_AURA_MOD_DETECT_RANGE
@ UNIT_FLAG2_REGENERATE_POWER
NPCFlags
Non Player Character flags.
@ UNIT_NPC_FLAG_SPELLCLICK
#define MAX_EQUIPMENT_ITEMS
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_PLAYER_CONTROLLED
@ UNIT_MOD_RESISTANCE_SHADOW
@ UNIT_MOD_RESISTANCE_FROST
@ UNIT_MOD_RESISTANCE_HOLY
@ UNIT_MOD_RESISTANCE_ARCANE
@ UNIT_MOD_RESISTANCE_FIRE
@ UNIT_MOD_RESISTANCE_NATURE
@ UNIT_MOD_ATTACK_POWER_RANGED
@ UNIT_STATE_ATTACK_PLAYER
@ UNIT_STATE_IGNORE_PATHFINDING
@ UNIT_STATE_ALL_ERASABLE
T RoundToInterval(T &num, T floor, T ceil)
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
@ WORLD_DEL_SPAWNGROUP_MEMBER
@ WORLD_DEL_GAME_EVENT_MODEL_EQUIP
@ WORLD_DEL_CREATURE_ADDON
@ WORLD_DEL_LINKED_RESPAWN
@ WORLD_DEL_GAME_EVENT_CREATURE
@ WORLD_DEL_LINKED_RESPAWN_MASTER
bool Execute(uint64 e_time, uint32 p_time) override
void AddAssistant(ObjectGuid guid)
Unit * GetAnyTarget() const
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
virtual void JustAppeared()
virtual bool CheckInRoom()
Creature * GetLeader() const
void FormationReset(bool dismiss)
void LeaderStartedMoving()
bool IsLeader(Creature const *creature) const
bool CanLeaderStartMoving() const
bool HasFlag(CreatureStaticFlags flag) const
void ApplyFlag(CreatureStaticFlags flag, bool apply)
bool IsSwimPrevented() const
bool HasClassification(CreatureClassifications classification) const
bool LoadCreaturesAddon()
time_t _pickpocketLootRestore
Timers.
bool HasSpell(uint32 spellID) const override
uint32 CalculateDamageForSparring(Unit *attacker, uint32 damage)
VendorItemCounts m_vendorItemCounts
void SetHomePosition(float x, float y, float z, float o)
void SetNoSearchAssistance(bool val)
void ReleaseSpellFocus(Spell const *focusSpell=nullptr, bool withDelay=true)
CreatureDifficulty const * m_creatureDifficulty
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
void Respawn(bool force=false)
void SetInteractionAllowedInCombat(bool interactionAllowed) override
struct Creature::@208 _spellFocusInfo
bool CanSwim() const override
CreatureTextRepeatGroup m_textRepeat
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
VendorItemData const * GetVendorItems() const
void StartDefaultCombatMovement(Unit *victim, Optional< float > range={}, Optional< float > angle={})
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const *data=nullptr, uint32 vehId=0)
CreatureStaticFlagsHolder _staticFlags
bool IsDungeonBoss() const
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
float GetHealthMultiplierForTarget(WorldObject const *target) const override
bool IsReturningHome() const
Optional< uint32 > m_lootId
void UpdateLevelDependantStats()
int8 m_originalEquipmentId
void setDeathState(DeathState s) override
static Creature * CreateCreatureFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
bool UpdateAllStats() override
void CallForHelp(float fRadius)
float GetAttackDistance(Unit const *player) const
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
std::unique_ptr< Loot > m_loot
void Update(uint32 time) override
CreatureDifficulty const * GetCreatureDifficulty() const
bool _IsTargetAcceptable(Unit const *target) const
CreatureClassifications GetCreatureClassification() const
Optional< uint32 > _defaultMountDisplayIdOverride
bool IsIgnoringFeignDeath() const
float GetSparringHealthPct() const
void SetRespawnTime(uint32 respawn)
void SetObjectScale(float scale) override
Optional< std::string > m_scriptStringId
uint32 m_spells[MAX_CREATURE_SPELLS]
void ApplyAllStaticFlags(CreatureStaticFlagsHolder const &flags)
static float GetDamageMod(CreatureClassifications classification)
bool m_respawnCompatibilityMode
void SelectWildBattlePetLevel()
std::string GetNameForLocaleIdx(LocaleConstant locale) const override
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
CreatureTemplate const * m_creatureInfo
bool IsSpawnedOnTransport() const
void UpdateNearbyPlayersInteractions() override
bool CanFly() const override
Position const & GetHomePosition() const
bool CanGiveExperience() const
CreatureTextRepeatIds GetTextRepeatGroup(uint8 textGroup)
void LoadEquipment(int8 id=1, bool force=false)
uint8 GetLevelForTarget(WorldObject const *target) const override
void SetTrainerId(Optional< uint32 > trainerId)
bool HasReactState(ReactStates state) const
bool AIM_Initialize(CreatureAI *ai=nullptr)
void DoNotReacquireSpellFocusTarget()
void RemoveCorpse(bool setSpawnTime=true, bool destroyForNearbyPlayers=true)
void SendZoneUnderAttackMessage(Player *attacker)
Send a message to LocalDefense channel for players opposition team in the zone.
bool m_triggerJustAppeared
void StartPickPocketRefillTimer()
void AllLootRemovedFromCorpse()
static Creature * CreateCreature(uint32 entry, Map *map, Position const &pos, uint32 vehId=0)
float GetAggroRange(Unit const *target) const
void LoadTemplateImmunities(int32 creatureImmunitiesId)
void SignalFormationMovement()
void SetDisplayFromModel(uint32 modelIdx)
bool IsEngaged() const override
MovementGeneratorType m_defaultMovementType
Unit * SelectNearestHostileUnitInAggroRange(bool useLOS=false, bool ignoreCivilians=false) const
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 entry, Position const &pos, CreatureData const *data, uint32 vehId, bool dynamic=false)
void SetReactState(ReactStates st)
uint32 GetTrainerId() const
void RemoveFromWorld() override
void SetTextRepeatId(uint8 textGroup, uint8 id)
void ResetPlayerDamageReq()
int32 _creatureImmunitiesId
void SetRespawnCompatibilityMode(bool mode=true)
void SetCannotReachTarget(bool cannotReach)
bool ShouldFakeDamageFrom(Unit *attacker)
void ClearTextRepeatGroup(uint8 textGroup)
void SetRespawnDelay(uint32 delay)
void AddToWorld() override
uint32 m_cannotReachTimer
void SetScriptStringId(std::string id)
void SetTappedBy(Unit const *unit, bool withGroup=true)
void InitializeMovementCapabilities()
void InitializeInteractSpellId()
bool IsSkinnedBy(Player const *player) const
time_t m_corpseRemoveTime
void ForcedDespawn(uint32 timeMSToDespawn=0, Seconds forceRespawnTimer=0s)
uint32 m_combatPulseDelay
float GetPetChaseDistance() const
bool IsFormationLeaderMoveAllowed() const
void SummonGraveyardTeleporter()
bool IsImmuneToNPC() const
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
float GetArmorMultiplierForTarget(WorldObject const *target) const override
bool HasStringId(std::string_view id) const
float GetSpellDamageMod(CreatureClassifications classification) const
void DoFleeToGetAssistance()
float GetDamageMultiplierForTarget(WorldObject const *target) const override
bool CanResetTalents(Player *player) const
void AtEngage(Unit *target) override
uint32 GetScriptId() const
CreatureData const * m_creatureData
void AtDisengage() override
bool hasInvolvedQuest(uint32 quest_id) const override
uint32 m_boundaryCheckTime
bool isCanInteractWithBattleMaster(Player *player, bool msg) const
uint32 GetWaypointPathId() const
Loot * GetLootForPlayer(Player const *player) const override
CreatureData const * GetCreatureData() const
bool CanGeneratePickPocketLoot() const
ObjectGuid::LowType GetSpawnId() const
void SetInteractionAllowedWhileHostile(bool interactionAllowed) override
bool CanNotReachTarget() const
bool m_AlreadyCallAssistance
CreatureTemplate const * GetCreatureTemplate() const
uint32 GetRespawnDelay() const
void SetDontClearTapListOnEvade(bool dontClear)
bool IsFormationLeader() const
bool CanCreatureAttack(Unit const *victim, bool force=true) const
bool CanRegenerateHealth() const
bool DisableReputationGain
void SetTarget(ObjectGuid const &guid) override
float GetBaseDamageForLevel(uint8 level) const
CreatureGroup * m_formation
static bool DeleteFromDB(ObjectGuid::LowType spawnId)
void SetInteractSpellId(int32 interactSpellId)
void InitializeReactState()
bool AIM_Create(CreatureAI *ai=nullptr)
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const override
std::array< std::string_view, 3 > m_stringIds
void LoadCreaturesSparringHealth(bool force=false)
uint32 UpdateVendorItemCurrentCount(VendorItem const *vItem, uint32 used_count)
bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const
bool isTappedBy(Player const *player) const
Creature(bool isWorldObject=false)
CreatureGroup * GetFormation()
uint32 GetCorpseDelay() const
GuidUnorderedSet m_tapList
bool m_dontClearTapListOnEvade
uint64 GetMaxHealthByLevel(uint8 level) const
void OverrideSparringHealthPct(float healthPct)
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
float GetNativeObjectScale() const override
bool HasScalableLevels() const
void SetDefaultMount(Optional< uint32 > mountCreatureDisplayId)
void ExitVehicle(Position const *exitPosition=nullptr) override
uint32 GetVendorItemCurrentCount(VendorItem const *vItem)
float GetBaseArmorForLevel(uint8 level) const
void SetDisplayId(uint32 displayId, bool setNative=false) override
std::string GetScriptName() const
void LowerPlayerDamageReq(uint64 unDamage)
time_t GetLastDamagedTime() const
MovementGeneratorType GetDefaultMovementType() const override
void SetSpellFocus(Spell const *focusSpell, WorldObject const *target)
Optional< uint32 > _trainerId
bool HasFlag(CreatureStaticFlags flag) const
bool IsInvisibleDueToDespawn(WorldObject const *seer) const override
bool IsFullyLooted() const
void SaveRespawnTime(uint32 forceDelay=0)
uint8 GetCurrentEquipmentId() const
bool InitEntry(uint32 entry, CreatureData const *data=nullptr)
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
void SetMeleeDamageSchool(SpellSchools school)
static float GetHealthMod(CreatureClassifications classification)
Unit * SelectNearestTargetInAttackDistance(float dist=0) const
CreatureMovementData const & GetMovementTemplate() const
void SendAIReaction(AiReaction reactionType)
void SetGossipMenuId(uint32 gossipMenuId)
bool IsAmphibious() const
void ResetPickPocketRefillTimer()
void SetNoCallAssistance(bool val)
void SetTreatAsRaidUnit(bool treatAsRaidUnit)
void UpdateMovementCapabilities()
bool m_ignoreCorpseDecayRatio
bool CanAlwaysSee(WorldObject const *obj) const override
bool hasQuest(uint32 quest_id) const override
void Regenerate(Powers power)
time_t GetRespawnTimeEx() const
CreatureAddon const * GetCreatureAddon() const
std::string const & GetAIName() const
void SetLootId(Optional< uint32 > lootId)
bool IsImmuneToPC() const
void SetCanDualWield(bool value) override
bool IsInEvadeMode() const
void ReacquireSpellFocusTarget()
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
std::string GetDebugInfo() const override
bool CanStartAttack(Unit const *u, bool force) const
bool IsMovementPreventedByCasting() const override
void SetOriginalEntry(uint32 entry)
bool HasSpellFocus(Spell const *focusSpell=nullptr) const override
uint32 GetGossipMenuId() const
void SetIgnoreFeignDeath(bool ignoreFeignDeath)
virtual uint8 GetPetAutoSpellSize() const
constexpr std::underlying_type_t< T > AsUnderlyingType() const
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
Milliseconds CalculateTime(Milliseconds t_offset) const
void SetValue(FLAG_TYPE flag, T_VALUES value)
Seconds const m_respawnTimer
bool Execute(uint64 e_time, uint32 p_time) override
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
MapStoredObjectTypesContainer & GetObjectsStore()
time_t GetLinkedRespawnTime(ObjectGuid guid) const
void GetFullTerrainStatusForPosition(PhaseShift const &phaseShift, float x, float y, float z, PositionFullTerrainStatus &data, Optional< map_liquidHeaderTypeFlags > reqLiquidType={}, float collisionHeight=2.03128f)
void ApplyDynamicModeRespawnScaling(WorldObject const *obj, ObjectGuid::LowType spawnId, uint32 &respawnDelay, uint32 mode) const
ObjectGuid::LowType GenerateLowGuid()
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
void SaveRespawnInfoDB(RespawnInfo const &info, CharacterDatabaseTransaction dbTrans=nullptr)
bool IsSpawnGroupActive(uint32 groupId) const
void SaveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 entry, time_t respawnTime, uint32 gridId, CharacterDatabaseTransaction dbTrans=nullptr, bool startup=false)
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
PlayerList const & GetPlayers() const
SpawnedPoolData & GetPoolData()
void Respawn(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
MovementGeneratorType GetCurrentMovementGeneratorType() const
void MoveFleeing(Unit *enemy, Milliseconds time=0ms)
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MoveSeekAssistance(float x, float y, float z)
MovementGenerator * GetCurrentMovementGenerator() const
void MoveFall(uint32 id=0)
void Remove(MovementGenerator *movement, MovementSlot slot=MOTION_SLOT_ACTIVE)
virtual MovementGeneratorType GetMovementGeneratorType() const =0
static ObjectGuid const Empty
static void ChooseCreatureFlags(CreatureTemplate const *cInfo, uint64 *npcFlags, uint32 *unitFlags, uint32 *unitFlags2, uint32 *unitFlags3, CreatureStaticFlagsHolder const &staticFlags, CreatureData const *data=nullptr)
static std::string_view GetLocaleString(std::vector< std::string > const &data, LocaleConstant locale)
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
void SetDynamicFlag(uint32 flag)
static Creature * ToCreature(Object *o)
float GetObjectScale() const
static Unit * ToUnit(Object *o)
ObjectGuid const & GetGUID() const
bool HasDynamicFlag(uint32 flag) const
CreateObjectBits m_updateFlag
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
void ReplaceAllDynamicFlags(uint32 flag)
UF::UpdateFieldHolder m_values
void RemoveDynamicFlag(uint32 flag)
void _Create(ObjectGuid const &guid)
static ObjectGuid GetGUID(Object const *o)
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
static Player * ToPlayer(Object *o)
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
Group * GetGroup(Optional< uint8 > partyIndex)
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
void setFloat(const uint8 index, const float value)
void setUInt8(const uint8 index, const uint8 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt16(const uint8 index, const uint16 value)
void setNull(const uint8 index)
void setString(const uint8 index, const std::string &value)
void setUInt64(const uint8 index, const uint64 value)
bool HasAttribute(SpellAttr0 attribute) const
bool HasAura(AuraType aura) const
static CreatureImmunities const * GetCreatureImmunities(int32 creatureImmunitiesId)
SpellInfo const * GetSpellInfo() const
bool IsFocusDisabled() const
int32 GetCastTime() const
void EvaluateSuppressed(bool canExpire=false)
Unit * GetCurrentVictim()
Unit * GetAnyTarget() const
void Update(uint32 tdiff)
bool Remove(KEY_TYPE const &handle)
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
virtual void InitializeAI()
void ClearUnitState(uint32 f)
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Vehicle * GetVehicle() const
virtual bool IsMovementPreventedByCasting() const
bool IsBattleMaster() const
bool isTargetableForAttack(bool checkFakeDeath=true) const
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
float GetHealthPct() const
void AIUpdateTick(uint32 diff)
void SetHealth(uint64 val)
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
void UpdateObjectVisibility(bool forced=true) override
int64 ModifyHealth(int64 val)
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
void ReplaceAllNpcFlags2(NPCFlags2 flags)
float GetDisplayScale() const
ThreatManager & GetThreatManager()
void ReplaceAllPvpFlags(UnitPVPStateFlags flags)
void AddToWorld() override
void SetModRangedHaste(float rangedHaste)
void ReplaceAllUnitFlags3(UnitFlags3 flags)
virtual void SetCanDualWield(bool value)
void SetControlled(bool apply, UnitState state)
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
void SetCreateHealth(uint32 val)
std::unique_ptr< CharmInfo > m_charmInfo
void UpdateDisplayPower()
void UpdateSpeed(UnitMoveType mtype)
bool IsPolymorphed() const
bool IsAreaSpiritHealer() const
void SetFaction(uint32 faction) override
virtual void SetPvP(bool state)
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value)
virtual void AtEngage(Unit *)
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Unit * getAttackerForHelper() const
std::forward_list< AuraEffect * > AuraEffectList
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Trinity::unique_trackable_ptr< Vehicle > m_vehicleKit
bool IsAreaSpiritHealerIndividual() const
void SetAnimTier(AnimTier animTier, bool notifyClient=true)
void ReplaceAllUnitFlags(UnitFlags flags)
MotionMaster * GetMotionMaster()
Powers GetPowerType() const
bool HasUnitFlag(UnitFlags flags) const
bool SetHover(bool enable, bool updateAnimTier=true)
void SetFacingToObject(WorldObject const *object, bool force=true)
Aura * AddAura(uint32 spellId, Unit *target)
void SetModHaste(float haste)
virtual void AtDisengage()
bool HasUnitFlag2(UnitFlags2 flags) const
std::string GetDebugInfo() const override
void ReplaceAllPetFlags(UnitPetFlag flags)
float GetCombatReach() const override
void ReplaceAllVisFlags(UnitVisFlags flags)
int32 GetMaxPower(Powers power) const
TempSummon * ToTempSummon()
bool IsQuestGiver() const
ObjectGuid GetCharmerOrOwnerGUID() const override
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
void SetModHasteRegen(float hasteRegen)
virtual void SetInteractionAllowedWhileHostile(bool interactionAllowed)
float GetNativeDisplayScale() const
void SetUninteractible(bool apply)
void SetBaseAttackTime(WeaponAttackType att, uint32 val)
void AddUnitState(uint32 f)
float GetTotalAuraMultiplier(AuraType auraType) const
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
void SetSheath(SheathState sheathed)
bool IsOnVehicle(Unit const *vehicle) const
void SetBoundingRadius(float boundingRadius)
void SetCreateMana(uint32 val)
bool isInAccessiblePlaceFor(Creature const *c) const
bool IsCharmedOwnedByPlayerOrPlayer() const
virtual void SetInteractionAllowedInCombat(bool interactionAllowed)
Unit * EnsureVictim() const
void SetModSpellHaste(float spellHaste)
Unit * GetCharmerOrOwner() const
virtual void UpdateDamagePhysical(WeaponAttackType attType)
uint32 GetCreatureType() const
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
bool SetSwim(bool enable)
void SetCombatReach(float combatReach)
void SetEmoteState(Emote emote)
virtual void UpdateNearbyPlayersInteractions()
float GetTotalAuraMultiplierByMiscValue(AuraType auraType, int32 misc_value) const
uint32 GetDisplayId() const
uint32 GetNativeDisplayId() const
uint64 GetMaxHealth() const
float GetHoverOffset() const
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
uint32 GetFaction() const override
uint32 GetCreateHealth() const
void SetAI(UnitAI *newAI)
bool HasAuraType(AuraType auraType) const
void EngageWithTarget(Unit *who)
bool HasNpcFlag(NPCFlags flags) const
uint8 GetLevelForTarget(WorldObject const *) const override
int32 GetTotalAuraModifier(AuraType auraType) const
void SetFullPower(Powers power)
void SetMovementAnimKitId(uint16 animKitId)
void SetMaxHealth(uint64 val)
void SetPowerType(Powers power, bool sendUpdate=true)
int32 GetPower(Powers power) const
void SetModTimeRate(float timeRate)
bool IsUnderWater() const
void SetSpeedRate(UnitMoveType mtype, float rate)
DeathState getDeathState() const
void SetFacingTo(float const ori, bool force=true)
bool IsEngagedBy(Unit const *who) const
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading=false)
bool HasUnitState(const uint32 f) const
virtual void Update(uint32 time) override
void ProcessPositionDataChanged(PositionFullTerrainStatus const &data) override
void SetLevel(uint8 lvl, bool sendUpdate=true)
void SetCanModifyStats(bool modifyStats)
void RemoveUnitMovementFlag(uint32 f)
void SetClass(uint8 classId)
virtual bool CanSwim() const
void RemoveFromWorld() override
bool IsOnOceanFloor() const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Powers CalculateDisplayPowerType() const
void DoMeleeAttackIfReady()
int32 GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
void ReplaceAllUnitFlags2(UnitFlags2 flags)
bool IsWildBattlePet() const
virtual void setDeathState(DeathState s)
CombatManager & GetCombatManager()
void SetUnitFlag(UnitFlags flags)
void SetVignette(uint32 vignetteId)
bool IsUninteractible() const
bool IsSpiritHealer() const
void SetInFront(WorldObject const *target)
void SetModCastingSpeed(float castingSpeed)
Vehicle * GetVehicleKit() const
void ReplaceAllNpcFlags(NPCFlags flags)
bool IsSpiritService() const
void SetStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float val)
void SetShapeshiftForm(ShapeshiftForm form)
void SetMeleeAnimKitId(uint16 animKitId)
ObjectGuid GetTarget() const
void SetMountDisplayId(uint32 mountDisplayId)
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
void SetWildBattlePetLevel(uint32 wildBattlePetLevel)
void SetIsCombatDisallowed(bool apply)
void RemoveUnitFlag(UnitFlags flags)
void SetAIAnimKitId(uint16 animKitId)
Player * m_playerMovingMe
virtual void ExitVehicle(Position const *exitPosition=nullptr)
void Reset(bool evading=false)
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
void Install()
Initializes power type for vehicle. Nothing more.
constexpr uint32 GetMapId() const
virtual bool IsInvisibleDueToDespawn(WorldObject const *seer) const
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
virtual void UpdateObjectVisibilityOnDestroy()
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
bool IsHostileTo(WorldObject const *target) const
float GetTransOffsetX() const
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
PhaseShift & GetPhaseShift()
ZoneScript * GetZoneScript() const
TransportBase * GetTransport() const
void setActive(bool isActiveObject)
float GetTransOffsetY() const
std::string const & GetName() const
virtual void SetMap(Map *map)
float GetTransOffsetZ() const
void AddObjectToRemoveList()
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
bool IsNeutralToAll() const
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
void SetName(std::string newname)
float GetVisibilityRange() const
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
float GetTransOffsetO() const
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
MovementInfo m_movementInfo
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
float GetDistanceZ(WorldObject const *obj) const
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
bool IsFriendlyTo(WorldObject const *target) const
bool IsInMap(WorldObject const *obj) const
WorldPacket const * Write() override
WorldPacket const * Write() override
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
virtual void OnCreatureRemove(Creature *)
virtual void OnCreatureCreate(Creature *)
@ CONFIG_CORPSE_DECAY_ELITE
@ CONFIG_NO_GRAY_AGGRO_BELOW
@ CONFIG_CORPSE_DECAY_OBSOLETE
@ CONFIG_CREATURE_PICKPOCKET_REFILL
@ CONFIG_RESPAWN_DYNAMICMODE
@ CONFIG_MAX_PLAYER_LEVEL
@ CONFIG_CORPSE_DECAY_MINUSMOB
@ CONFIG_CORPSE_DECAY_NORMAL
@ CONFIG_CORPSE_DECAY_TRIVIAL
@ CONFIG_NO_GRAY_AGGRO_ABOVE
@ CONFIG_CREATURE_STOP_FOR_PLAYER
@ CONFIG_CORPSE_DECAY_RARE
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
@ CONFIG_CORPSE_DECAY_RAREELITE
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
@ RATE_CREATURE_DAMAGE_NORMAL
@ RATE_CREATURE_DAMAGE_RAREELITE
@ RATE_CREATURE_DAMAGE_ELITE
@ RATE_CREATURE_SPELLDAMAGE_TRIVIAL
@ RATE_CREATURE_SPELLDAMAGE_NORMAL
@ RATE_CREATURE_SPELLDAMAGE_RAREELITE
@ RATE_CREATURE_HP_OBSOLETE
@ RATE_CREATURE_DAMAGE_OBSOLETE
@ RATE_CREATURE_DAMAGE_MINUSMOB
@ RATE_CREATURE_HP_NORMAL
@ RATE_CREATURE_HP_MINUSMOB
@ RATE_CREATURE_HP_TRIVIAL
@ RATE_CORPSE_DECAY_LOOTED
@ RATE_CREATURE_DAMAGE_RARE
@ RATE_CREATURE_DAMAGE_TRIVIAL
@ RATE_CREATURE_SPELLDAMAGE_ELITE
@ RATE_CREATURE_SPELLDAMAGE_MINUSMOB
@ RATE_CREATURE_HP_RAREELITE
@ RATE_CREATURE_SPELLDAMAGE_OBSOLETE
@ RATE_CREATURE_SPELLDAMAGE_RARE
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
ObjectData const creatureData[]
TC_GAME_API uint32 GetId(std::string_view username)
CreatureAI * SelectAI(Creature *creature)
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomWeightedContainerElement(C const &container, std::span< double > const &weights) -> decltype(std::begin(container))
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
auto MapGetValuePtr(M &map, typename M::key_type const &key)
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level)
bool IsValidMapCoord(float c)
GridCoord ComputeGridCoord(float x, float y)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
std::vector< uint32 > auras
VisibilityDistanceType visibilityDistanceType
static CreatureBaseStats const * GetBaseStats(uint8 level, uint8 unitClass)
Optional< uint64 > npcflag
Optional< CreatureModel > display
Optional< uint32 > unit_flags2
Optional< uint32 > unit_flags3
Optional< uint32 > unit_flags
int32 GetHealthScalingExpansion() const
CreatureStaticFlagsHolder StaticFlags
std::bitset< MAX_MECHANIC > Mechanic
std::vector< SpellEffectName > Effect
EnumFlag< SpellOtherImmunity > Other
std::bitset< MAX_SPELL_SCHOOL > School
std::bitset< DISPEL_MAX > DispelType
std::vector< AuraType > Aura
static CreatureModel const DefaultVisibleModel
static CreatureModel const DefaultInvisibleModel
CreatureRandomMovementType Random
bool HoverInitiallyEnabled
std::string ToString() const
CreatureChaseMovementType Chase
uint32 InteractionPauseTimer
void InitializeQueryData()
CreatureModel const * GetRandomValidModel() const
CreatureModel const * GetModelByIdx(uint32 idx) const
CreatureDifficulty const * GetDifficulty(Difficulty difficulty) const
CreatureClassifications Classification
CreatureModel const * GetFirstInvisibleModel() const
int32 CreatureImmunitiesId
uint32 spells[MAX_CREATURE_SPELLS]
int32 resistance[MAX_SPELL_SCHOOL]
CreatureModel const * GetFirstValidModel() const
CreatureMovementData Movement
uint32 KillCredit[MAX_KILL_CREDIT]
CreatureModel const * GetModelWithDisplayId(uint32 displayId) const
WorldPacket QueryData[TOTAL_LOCALES]
CreatureModel const * GetFirstVisibleModel() const
std::unordered_map< Difficulty, CreatureDifficulty > difficultyStore
WorldPacket BuildQueryData(LocaleConstant loc, Difficulty difficulty) const
uint8 FallbackDifficultyID
EquipmentItem Items[MAX_EQUIPMENT_ITEMS]
struct MovementInfo::TransportInfo transport
constexpr void SetOrientation(float orientation)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr bool IsInDist2d(float x, float y, float dist) const
std::string ToString() const
constexpr void GetPosition(float &x, float &y) const
bool IsPositionValid() const
constexpr void Relocate(float x, float y)
constexpr Position GetPosition() const
constexpr bool IsInDist(float x, float y, float z, float dist) const
constexpr float GetOrientation() const
constexpr float GetPositionZ() const
ObjectGuid::LowType spawnId
std::vector< Difficulty > spawnDifficulties
UpdateField< int32, 32, 39 > ScalingLevelDelta
UpdateField< int32, 32, 38 > ScalingLevelMax
UpdateField< uint32, 0, 7 > StateAnimID
UpdateField< ObjectGuid, 0, 19 > Target
UpdateField< int32, 32, 37 > ScalingLevelMin
UpdateField< int32, 96, 120 > TaxiNodesID
UpdateField< int32, 32, 36 > ContentTuningID
VendorItemCount(uint32 _item, uint32 _count)
std::vector< VendorItem > m_items
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const
bool RemoveItem(uint32 item_id, uint8 type)
std::vector< CreatureXDisplay > CreatureDisplay
std::array< uint32, 2 > Flags
CreatureDisplayStats Display
std::array< std::string, 4 > Name
std::array< std::string, 4 > NameAlt
std::array< uint32, 2 > ProxyCreatureID