56#include <G3D/g3dmath.h>
64 char const*
const ChaseStates[] = {
"Run",
"CanWalk",
"AlwaysWalk" };
65 char const*
const RandomStates[] = {
"Walk",
"CanRun",
"AlwaysRun" };
67 std::ostringstream str;
78 : itemId(_item), count(_count), lastIncrementTime(
GameTime::GetGameTime()) { }
84 return vendorItem.item == item_id && vendorItem.Type == type;
87 bool found = newEnd !=
m_items.end();
95 if (vendorItem.item == item_id && vendorItem.ExtendedCost == extendedCost && vendorItem.Type == type)
127 return &(*selectedItr);
133 if (model.CreatureDisplayID)
142 if (displayId == model.CreatureDisplayID)
152 if (modelInfo && modelInfo->is_trigger)
162 if (modelInfo && !modelInfo->is_trigger)
189 queryTemp.
Allow =
true;
212 stats.Display.TotalProbability += model.Probability;
213 return { model.CreatureDisplayID, model.DisplayScale, model.Probability };
216 stats.HpMulti = creatureDifficulty->HealthModifier;
217 stats.EnergyMulti = creatureDifficulty->ManaModifier;
219 stats.CreatureMovementInfoID = movementId;
220 stats.RequiredExpansion = RequiredExpansion;
221 stats.HealthScalingExpansion = creatureDifficulty->HealthScalingExpansion;
222 stats.VignetteID = VignetteID;
223 stats.Class = unit_class;
224 stats.CreatureDifficultyID = creatureDifficulty->CreatureDifficultyID;
225 stats.WidgetSetID = WidgetSetID;
226 stats.WidgetSetUnitConditionID = WidgetSetUnitConditionID;
228 stats.Title = SubName;
229 stats.TitleAlt = TitleAlt;
230 stats.CursorName = IconName;
232 if (std::vector<uint32>
const* items =
sObjectMgr->GetCreatureQuestItemList(
Entry, difficulty))
233 stats.QuestItems.assign(items->begin(), items->end());
235 if (std::vector<int32>
const* currencies =
sObjectMgr->GetCreatureQuestCurrencyList(
Entry))
236 stats.QuestCurrencies.assign(currencies->begin(), currencies->end());
248 queryTemp.ShrinkToFit();
249 return queryTemp.Move();
268 .ContentTuningID = 0,
269 .HealthScalingExpansion = 0,
270 .HealthModifier = 1.f,
272 .ArmorModifier = 1.f,
273 .DamageModifier = 1.f,
274 .CreatureDifficultyID = 0,
279 .PickPocketLootID = 0,
285 return &DefDifficulty;
309 return sObjectMgr->GetCreatureBaseStats(level, unitClass);
319 m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_ignoreCorpseDecayRatio(false), m_wanderDistance(0.0f),
322 m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_cannotReachTarget(false), m_cannotReachTimer(0),
323 m_meleeDamageSchoolMask(
SPELL_SCHOOL_MASK_NORMAL), m_baseAttackPower(0), m_baseRangedAttackPower(0), m_originalEntry(0),
324 m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_creatureDifficulty(nullptr), m_stringIds(),
325 _waypointPathId(0), _currentWaypointNodeInfo(0, 0), m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false),
326 _aggroGracePeriodExpired(false), _lastDamagedTime(0), _regenerateHealth(true), _creatureImmunitiesId(0), _gossipMenuId(0), _sparringHealthPct(0)
443 ai->CorpseRemoved(respawnDelay);
445 if (destroyForNearbyPlayers)
502 TC_LOG_ERROR(
"sql.sql",
"Creature::InitEntry creature entry {} does not exist.", entry);
519 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", entry);
527 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has invalid model {} defined in table `creature_template_model`, can't load.", entry, model.
CreatureDisplayID);
607 uint32 unitFlags, unitFlags2, unitFlags3;
625 unitFlags &= ~UNIT_FLAG_IN_COMBAT;
651 if (previousHealth > 0)
688 owner->VehicleSpellInitialize();
728 if (!staticFlagsOverride)
796 if (!linkedRespawnTime)
801 if (targetGuid == dbtableHighGuid)
806 time_t baseRespawnTime = std::max(linkedRespawnTime, now);
811 if (baseRespawnTime <= std::numeric_limits<time_t>::max() - offset)
903 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}",
GetDebugInfo());
906 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}",
GetDebugInfo());
958 if (curValue >= maxValue)
961 float addvalue = 0.0f;
984 addvalue =
uint32((27.0f / 5.0f + 17.0f) * ManaIncreaseRate);
987 addvalue = maxValue / 3;
1011 if (curValue >= maxValue)
1021 addvalue = 0.015f * ((float)
GetMaxHealth()) * HealthIncreaseRate;
1024 addvalue = maxValue/3;
1121 TC_LOG_ERROR(
"sql.sql",
"Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1135 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());
1219 if (!creature->Create(lowGuid, map, entry, pos,
nullptr, vehId))
1231 if (!creature->
LoadFromDB(spawnId, map, addToMap, allowDuplicate))
1242 Unit* target =
nullptr;
1254 if (owner->IsInCombat())
1258 for (ControlList::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
1260 if ((*itr)->IsInCombat())
1286 if (!iAuras.empty())
1288 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
1290 if ((*itr)->GetBase()->IsPermanent())
1395 if (
GetMap()->
IsRaid() || group->SameSubGroup(player, itr.GetSource()))
1396 m_tapList.insert(itr.GetSource()->GetGUID());
1432 if (!loot->isLooted())
1453 TC_LOG_ERROR(
"entities.unit",
"Creature::SaveToDB failed, cannot get creature data!");
1459 if (transport->GetMapIdForSpawning() >= 0)
1460 mapId = transport->GetMapIdForSpawning();
1483 if (displayId && displayId == model.CreatureDisplayID)
1486 if (spawnNpcFlags != cinfo->
npcflag)
1487 npcflag = spawnNpcFlags;
1543 trans->Append(stmt);
1551 stmt->
setString(index++, [&data]() -> std::string
1553 std::ostringstream os;
1556 auto itr = data.spawnDifficulties.begin();
1557 os << int32(*itr++);
1559 for (; itr != data.spawnDifficulties.end(); ++itr)
1560 os <<
',' << int32(*itr);
1563 return std::move(os).str();
1580 if (npcflag.has_value())
1585 if (unitFlags.has_value())
1590 if (unitFlags2.has_value())
1595 if (unitFlags3.has_value())
1606 trans->Append(stmt);
1651 float weaponBaseMinDamage = basedamage;
1652 float weaponBaseMaxDamage = basedamage * 1.5f;
1677 if (areaTable->WildBattlePetLevelMin > 0)
1678 wildBattlePetLevel =
urand(areaTable->WildBattlePetLevelMin, areaTable->WildBattlePetLevelMax);
1686 switch (classification)
1715 switch (classification)
1738 switch (classification)
1779 if (
GetHealth() - damage <= sparringHealth)
1821 TC_LOG_ERROR(
"sql.sql",
"Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1828 _Create(ObjectGuid::Create<HighGuid::Vehicle>(
GetMapId(), entry, guidlow));
1830 _Create(ObjectGuid::Create<HighGuid::Creature>(
GetMapId(), entry, guidlow));
1859 if (!allowDuplicate)
1864 std::vector <Creature*> despawnList;
1866 if (creatureBounds.first != creatureBounds.second)
1868 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1870 if (itr->second->IsAlive())
1872 TC_LOG_DEBUG(
"maps",
"Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1877 despawnList.push_back(itr->second);
1878 TC_LOG_DEBUG(
"maps",
"Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1882 for (
Creature* despawnCreature : despawnList)
1884 despawnCreature->AddObjectToRemoveList();
1892 TC_LOG_ERROR(
"sql.sql",
"Creature (SpawnID {}) not found in table `creature`, can't load. ", spawnId);
1935 TC_LOG_ERROR(
"entities.unit",
"Creature (SpawnID {}) trying to load despite a respawn timer in progress:\n{}", spawnId,
GetDebugInfo());
1962 if (addToMap && !
GetMap()->AddToMap(
this))
2027 [spawnId, charTrans](
Map* map) ->
void
2030 std::vector<Creature*> toUnload;
2031 for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetCreatureBySpawnIdStore(), spawnId))
2032 toUnload.push_back(pair.second);
2033 for (Creature* creature : toUnload)
2034 map->AddObjectToRemoveList(creature);
2035 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, spawnId, charTrans);
2049 trans->Append(stmt);
2054 trans->Append(stmt);
2058 trans->Append(stmt);
2062 trans->Append(stmt);
2066 trans->Append(stmt);
2071 trans->Append(stmt);
2076 trans->Append(stmt);
2081 trans->Append(stmt);
2086 trans->Append(stmt);
2158 if (notAbove == 0 && notBelow == 0)
2161 if (playerLevel <= notBelow || (playerLevel >= notAbove && notAbove > 0))
2173 float maxRadius = 45.0f * aggroRate;
2174 float minRadius = 5.0f * aggroRate;
2183 float aggroRadius = baseAggroDistance;
2195 if (creatureLevel > expansionMaxLevel)
2196 aggroRadius = baseAggroDistance + float(expansionMaxLevel - playerLevel);
2198 aggroRadius += float(creatureLevel - playerLevel);
2201 if (aggroRadius > maxRadius)
2202 aggroRadius = maxRadius;
2203 else if (aggroRadius < minRadius)
2204 aggroRadius = minRadius;
2206 return (aggroRadius * aggroRate);
2293 uint32 unitFlags, unitFlags2, unitFlags3;
2381 TC_LOG_DEBUG(
"entities.unit",
"Respawning creature {} ({})",
2388 if (timeMSToDespawn)
2402 bool overrideRespawnTime =
false;
2405 if (forceRespawnTimer > Seconds::zero())
2409 overrideRespawnTime =
true;
2423 if (forceRespawnTimer > Seconds::zero())
2441 summon->UnSummon(timeToDespawn.count());
2450 static uint32 constexpr placeholderSpellId = std::numeric_limits<uint32>::max();
2452 auto applyCreatureImmunities = [
this](
CreatureImmunities const* immunities,
bool apply)
2454 for (std::size_t i = 0; i < immunities->
School.size(); ++i)
2455 if (immunities->
School[i])
2458 for (std::size_t i = 0; i < immunities->
DispelType.size(); ++i)
2462 for (std::size_t i = 0; i < immunities->
Mechanic.size(); ++i)
2478 applyCreatureImmunities(immunities,
false);
2484 applyCreatureImmunities(immunities,
true);
2491 bool requireImmunityPurgesEffectAttribute )
const
2521 Unit* target =
nullptr;
2533 TC_LOG_ERROR(
"entities.unit",
"Creature {} SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.",
GetGUID().
ToString());
2537 Unit* target =
nullptr;
2553 TC_LOG_DEBUG(
"network",
"WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2566 std::list<Creature*> assistList;
2571 if (!assistList.empty())
2574 while (!assistList.empty())
2578 assistList.pop_front();
2721 if (!ai->CanAIAttack(victim))
2734 if (
GetMap()->IsDungeon())
2779 Mount(mountDisplayId);
2792 if (creatureAddon->
emote != 0)
2804 if (creatureAddon->
PathId != 0)
2807 if (!creatureAddon->
auras.empty())
2809 for (std::vector<uint32>::const_iterator itr = creatureAddon->
auras.begin(); itr != creatureAddon->
auras.end(); ++itr)
2812 if (!AdditionalSpellInfo)
2832 if (force || std::find(templateValues->begin(), templateValues->end(),
_sparringHealthPct) != templateValues->end())
2846 if (enemyTeam !=
HORDE)
2865 if (!currentMovement)
2868 bool canChangeMovement = [&]
2870 if (wasFleeingFromMelee)
2876 if (!canChangeMovement)
3026 return *movementOverride;
3061 bool isFullySkinned = [&]() ->
bool
3066 bool hasSkinningLoot =
false;
3071 if (!loot->isLooted())
3074 hasSkinningLoot =
true;
3078 return hasSkinningLoot;
3109 auto sender = [&](
Player const* receiver)
3111 receiver->PlayerTalkClass->SendQuestGiverStatus(receiver->GetQuestDialogStatus(
this),
GetGUID());
3132 if (mapDifficulty->ContentTuningID)
3133 contentTuningId = mapDifficulty->ContentTuningID;
3135 if (!contentTuningId)
3151 int32 scalingLevelDelta = 0;
3152 if (contentTuningId)
3156 scalingLevelDelta = mindelta == maxdelta ? mindelta :
irand(mindelta, maxdelta);
3179 return std::ceil(baseHealth * creatureDifficulty->
HealthModifier);
3229 if (
Unit const* unitTarget = target->
ToUnit())
3239 int32 targetLevel = unitTarget->GetEffectiveLevel();
3241 int32 targetLevelDelta = 0;
3246 scalingLevelMin = scalingLevelMax;
3248 int32 maxCreatureScalingLevel = playerTarget->m_activePlayerData->MaxCreatureScalingLevel;
3249 targetLevelDelta = std::min(maxCreatureScalingLevel > 0 ? maxCreatureScalingLevel - targetLevel : 0, *playerTarget->m_activePlayerData->ScalingPlayerLevelDelta);
3252 int32 levelWithDelta = targetLevel + targetLevelDelta;
3253 int32 level =
RoundToInterval(levelWithDelta, scalingLevelMin, scalingLevelMax) + scalingLevelDelta;
3291 return std::ranges::any_of(
m_stringIds, [
id](std::string
const* stringId) {
return stringId && *stringId == id; });
3315 if (data->spawnTrackingData && !data->spawnTrackingQuestObjectives.empty())
3337 if (itr->itemId == vItem->
item)
3351 if ((vCount->
count + diff * pProto->GetBuyCount()) >= vItem->
maxcount)
3357 vCount->
count += diff * pProto->GetBuyCount();
3361 return vCount->
count;
3371 if (itr->itemId == vItem->
item)
3389 if ((vCount->
count + diff * pProto->GetBuyCount()) < vItem->
maxcount)
3390 vCount->
count += diff * pProto->GetBuyCount();
3395 vCount->
count = vCount->
count > used_count ? vCount->
count-used_count : 0;
3397 return vCount->
count;
3455 if (cl->Name.size() > locale && !cl->Name[locale].empty())
3456 return cl->Name[locale];
3481 return m_charmInfo->GetCharmSpell(pos)->GetAction();
3496 if (spellInfo->GetRecoveryTime() == 0 && spellInfo->RangeEntry && spellInfo->RangeEntry->ID != 1 && spellInfo->RangeEntry->ID != 2 && spellInfo->GetMaxRange() > range)
3497 range = spellInfo->GetMaxRange();
3512 TC_LOG_DEBUG(
"entities.unit.chase",
"Creature::SetCannotReachTarget() called with true. Details: {}",
GetDebugInfo());
3518 mountCreatureDisplayId.reset();
3528 if (target &&
IsPet())
3541 if (levelDiff < -25)
3545 float aggroRadius = 20;
3548 aggroRadius -= (float)levelDiff;
3562 if (aggroRadius < 10)
3565 return (aggroRadius);
3577 Unit* target =
nullptr;
3675 if (!turnDisabled && noTurnDuringCast && target)
3678 if (noTurnDuringCast)
3688 TC_LOG_WARN(
"entities.unit",
"Creature '{}' (entry {}) has spell focus (spell id {}, delay {}ms) despite being dead.",
3727 TC_LOG_ERROR(
"entities.unit",
"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {}",
GetDebugInfo());
3773 if (std::find(repeats.begin(), repeats.end(),
id) == repeats.end())
3774 repeats.push_back(
id);
3783 CreatureTextRepeatGroup::const_iterator groupItr =
m_textRepeat.find(textGroup);
3785 ids = groupItr->second;
3792 CreatureTextRepeatGroup::iterator groupItr =
m_textRepeat.find(textGroup);
3794 groupItr->second.clear();
3805 return ai->IsEngaged();
3836 for (
auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); ++seat)
3844 ai->JustEngagedWith(target);
3846 formation->MemberEngagingTarget(
this, target);
3876 if (combatReference->IsSuppressedFor(
this))
3884 partiesToForceIntoCombat.
insert(group);
3887 for (
Group const* partyToForceIntoCombat : partiesToForceIntoCombat)
3889 for (
GroupReference const& ref : partyToForceIntoCombat->GetMembers())
3891 Player* player = ref.GetSource();
3903 return ai->IsEscorted();
3909 std::stringstream sstr;
3972 auto itr = clickBounds.begin();
3974 if (itr != clickBounds.end() && ++itr == clickBounds.end())
4006 m_unitData->WriteUpdate(mask, data, target,
this,
true);
4014 if (requestedObjectMask.IsAnySet())
4019 if (unitMask.IsAnySet())
4023 std::size_t sizePos = buffer.
wpos();
4029 m_objectData->WriteUpdate(requestedObjectMask, buffer, target,
this, ignoreNestedChangesMask);
4032 m_unitData->WriteUpdate(unitMask, buffer, target,
this, ignoreNestedChangesMask);
@ 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
CreatureChaseMovementType
const uint8 MAX_KILL_CREDIT
@ CREATURE_STATIC_FLAG_5_INTERACT_WHILE_HOSTILE
@ CREATURE_STATIC_FLAG_IGNORE_COMBAT
@ CREATURE_STATIC_FLAG_NO_XP
@ CREATURE_STATIC_FLAG_NO_MELEE_FLEE
@ CREATURE_STATIC_FLAG_SESSILE
@ CREATURE_STATIC_FLAG_FLOATING
@ CREATURE_STATIC_FLAG_3_ALLOW_INTERACTION_WHILE_IN_COMBAT
@ CREATURE_STATIC_FLAG_4_NO_BIRTH_ANIM
@ CREATURE_STATIC_FLAG_4_NO_MELEE_APPROACH
@ CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT
@ CREATURE_STATIC_FLAG_2_FORCE_RAID_COMBAT
CreatureRandomMovementType
const uint32 CREATURE_NOPATH_EVADE_TIME
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)
@ 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::milliseconds Milliseconds
Milliseconds shorthand typedef.
std::chrono::seconds Seconds
Seconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
#define MAX_FALL_DISTANCE
#define SIZE_OF_GRID_CELL
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_WARN(filterType__, message__,...)
#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
@ SPELL_EFFECT_KNOCK_BACK_DEST
@ SPELL_EFFECT_KNOCK_BACK
constexpr uint32 GetMaxLevelForExpansion(uint32 expansion)
@ SPELL_ATTR5_AI_DOESNT_FACE_TARGET
@ SPELL_SCHOOL_MASK_NORMAL
@ CREATURE_TYPE_NON_COMBAT_PET
@ CREATURE_TYPE_MECHANICAL
float const GROUND_HEIGHT_TOLERANCE
@ FACTION_ALLIANCE_GENERIC
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
@ CREATURE_TYPE_FLAG_BOSS_MOB
@ 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_DISABLE_GRAVITY
@ SPELL_AURA_MOD_STUN_DISABLE_GRAVITY
@ SPELL_AURA_MOD_DETECTED_RANGE
@ SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ SPELL_AURA_MOD_DETECT_RANGE
@ UNIT_FLAG2_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS
@ UNIT_FLAG2_REGENERATE_POWER
constexpr NPCFlags UNIT_NPC_FLAG_VENDOR_MASK
NPCFlags
Non Player Character flags.
@ UNIT_NPC_FLAG_SPELLCLICK
@ UNIT_NPC_FLAG_PETITIONER
#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_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)
ObjectGuid const & GetGUID() const
void SetUpdateFieldValue(UF::UpdateFieldPrivateSetter< T > setter, typename UF::UpdateFieldPrivateSetter< T >::value_type value)
WowCS::EntityFragmentsHolder m_entityFragments
void RemoveOptionalUpdateFieldValue(UF::OptionalUpdateFieldSetter< T > setter)
UF::UpdateFieldHolder m_values
void _Create(ObjectGuid const &guid)
CreateObjectBits m_updateFlag
void SetUpdateFieldFlagValue(UF::UpdateFieldPrivateSetter< T > setter, typename UF::UpdateFieldPrivateSetter< T >::value_type flag)
void RemoveUpdateFieldFlagValue(UF::UpdateFieldPrivateSetter< T > setter, typename UF::UpdateFieldPrivateSetter< T >::value_type flag)
ByteBuffer & PrepareValuesUpdateBuffer(UpdateData *data) const
void put(std::size_t pos, T value)
Unit * GetAnyTarget() const
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
virtual void JustAppeared()
virtual bool CheckInRoom()
Creature * GetLeader() const
void FormationReset(bool dismiss)
bool HasAliveMembers() const
void LeaderStartedMoving()
bool IsLeader(Creature const *creature) const
bool CanLeaderStartMoving() const
bool HasFlag(CreatureStaticFlags flag) const
EnumFlag< CreatureStaticFlags8 > GetFlags8() const
void ApplyFlag(CreatureStaticFlags flag, bool apply)
EnumFlag< CreatureStaticFlags2 > GetFlags2() const
EnumFlag< CreatureStaticFlags > GetFlags() const
EnumFlag< CreatureStaticFlags7 > GetFlags7() const
EnumFlag< CreatureStaticFlags5 > GetFlags5() const
EnumFlag< CreatureStaticFlags6 > GetFlags6() const
EnumFlag< CreatureStaticFlags4 > GetFlags4() const
EnumFlag< CreatureStaticFlags3 > GetFlags3() 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)
std::array< std::string const *, 3 > m_stringIds
void SetInteractionAllowedInCombat(bool interactionAllowed) override
bool CanSwim() const override
CreatureTextRepeatGroup m_textRepeat
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)
std::span< int32 const > GetLabels() const
bool HasLabel(int32 cretureLabel) const
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
void BuildValuesUpdate(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const override
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
bool _aggroGracePeriodExpired
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 SetVendor(NPCFlags flags, bool apply)
void BuildValuesCreate(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const override
void SignalFormationMovement()
void SetDisplayFromModel(uint32 modelIdx)
bool IsEngaged() const override
void Heartbeat() override
MovementGeneratorType m_defaultMovementType
void BuildValuesUpdateForPlayerWithMask(UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::UnitData::Mask const &requestedUnitMask, Player const *target, bool ignoreNestedChangesMask) const
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
UF::OptionalUpdateField< UF::VendorData, int32(WowCS::EntityFragment::FVendor_C), 0 > m_vendorData
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)
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
CreatureStaticFlagsHolder GenerateStaticFlags(CreatureDifficulty const *creatureDifficulty, ObjectGuid::LowType spawnId, Difficulty difficultyId) const
float GetSpellDamageMod(CreatureClassifications classification) const
void UpdateFloatingMovementFlags()
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
void UpdateSessileMovementFlags()
struct Creature::@193 _spellFocusInfo
void SetFloating(bool floating)
ObjectGuid::LowType GetSpawnId() const
Position GetRespawnPosition(float *dist=nullptr) 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
void SetSessile(bool sessile)
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
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
SpawnTrackingStateData const * GetSpawnTrackingStateDataForPlayer(Player const *player) const override
void OverrideSparringHealthPct(float healthPct)
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
std::string_view GetStringId(StringIdType type) 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
void SetPetitioner(bool apply)
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)
void ForcePartyMembersIntoCombat()
static float GetHealthMod(CreatureClassifications classification)
Unit * SelectNearestTargetInAttackDistance(float dist=0) const
CreatureMovementData const & GetMovementTemplate() const
void SendAIReaction(AiReaction reactionType)
void SetGossipMenuId(uint32 gossipMenuId)
void ResetPickPocketRefillTimer()
void SetNoCallAssistance(bool val)
void SetTreatAsRaidUnit(bool treatAsRaidUnit)
void UpdateMovementCapabilities()
bool m_ignoreCorpseDecayRatio
bool CanOnlySwimIfTargetSwims() const
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 InheritStringIds(Creature const *parent)
void SetLootId(Optional< uint32 > lootId)
bool IsImmuneToPC() const
void SetCanDualWield(bool value) override
bool IsInEvadeMode() const
void ReacquireSpellFocusTarget()
uint32 m_baseRangedAttackPower
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
void BuildValuesUpdateWithFlag(UF::UpdateFieldFlag flags, ByteBuffer &data, Player const *target) const override
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
Difficulty GetDifficultyID() 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()
SpawnedPoolData & GetPoolData()
void Respawn(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
void MoveFall(uint32 id=0, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
MovementGeneratorType GetCurrentMovementGeneratorType() const
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MoveSeekAssistance(float x, float y, float z)
void MoveFleeing(Unit *enemy, Milliseconds time=0ms, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
MovementGenerator * GetCurrentMovementGenerator() const
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)
float GetObjectScale() const
bool HasDynamicFlag(uint32 flag) const
void ReplaceAllDynamicFlags(uint32 flag)
void RemoveDynamicFlag(uint32 flag)
void BuildEntityFragmentsForValuesUpdateForPlayerWithMask(ByteBuffer &data, EnumFlag< UF::UpdateFieldFlag > flags) const
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
UF::UpdateField< UF::ObjectData, int32(WowCS::EntityFragment::CGObject), TYPEID_OBJECT > m_objectData
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
void SendDirectMessage(WorldPacket const *data) const
bool IsGameMaster() const
Group * GetGroup(Optional< uint8 > partyIndex)
SpawnTrackingState GetSpawnTrackingStateByObjectives(uint32 spawnTrackingId, std::vector< uint32 > const &questObjectives) const
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
void setUInt16(uint8 index, uint16 value)
void setString(uint8 index, std::string &&value)
void setUInt32(uint8 index, uint32 value)
void setFloat(uint8 index, float value)
void setUInt64(uint8 index, uint64 value)
void setInt32(uint8 index, int32 value)
void setUInt8(uint8 index, uint8 value)
void setNull(uint8 index)
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
Spell(WorldObject *caster, SpellInfo const *info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID=ObjectGuid::Empty, ObjectGuid originalCastId=ObjectGuid::Empty)
void EvaluateSuppressed(bool canExpire=false)
Unit * GetCurrentVictim()
Unit * GetAnyTarget() const
void Update(uint32 tdiff)
std::pair< iterator, bool > insert(Key const &key)
Mask const & GetChangesMask() const
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
bool HasChanged(uint32 index) const
uint32 GetChangedObjectTypeMask() const
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 RemoveUnitMovementFlag(MovementFlags f)
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
uint64 CountPctFromMaxHealth(float pct) const
void Heartbeat() override
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
void UpdateObjectVisibility(bool forced=true) override
int64 ModifyHealth(int64 val)
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
void SetInitialPowerValue(Powers powerType)
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)
void SetCreateHealth(uint32 val)
std::unique_ptr< CharmInfo > m_charmInfo
void UpdateDisplayPower()
NPCFlags GetNpcFlags() const
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)
void StopMoving(bool force=false)
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Unit * getAttackerForHelper() const
std::forward_list< AuraEffect * > AuraEffectList
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)
NPCFlags2 GetNpcFlags2() const
Aura * AddAura(uint32 spellId, Unit *target)
void SetModHaste(float haste)
virtual void AtDisengage()
void SetUnitFlag2(UnitFlags2 flags)
bool HasUnitFlag2(UnitFlags2 flags) const
std::string GetDebugInfo() const override
void ReplaceAllPetFlags(UnitPetFlag flags)
float GetCombatReach() const override
void ReplaceAllVisFlags(UnitVisFlags flags)
void SetModCastingSpeedNeg(float castingSpeedNeg)
int32 GetMaxPower(Powers power) const
void RemoveNpcFlag(NPCFlags flags)
TempSummon * ToTempSummon()
bool IsQuestGiver() const
ObjectGuid GetCharmerOrOwnerGUID() const override
void SetModHasteRegen(float hasteRegen)
virtual void SetInteractionAllowedWhileHostile(bool interactionAllowed)
float GetNativeDisplayScale() const
Player * GetPlayerMovingMe() const
void SetUninteractible(bool apply)
void SetBaseAttackTime(WeaponAttackType att, uint32 val)
void AddUnitState(uint32 f)
float GetTotalAuraMultiplier(AuraType auraType) const
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)
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
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 RemoveUnitFlag2(UnitFlags2 flags)
void SetAI(UnitAI *newAI)
void SetSpellEmpowerStage(int8 stage)
float GetTotalAuraModifier(AuraType auraType) const
void SetNpcFlag(NPCFlags flags)
bool HasAuraType(AuraType auraType) const
void EngageWithTarget(Unit *who)
void UpdateCreatureType()
bool HasNpcFlag(NPCFlags flags) const
uint8 GetLevelForTarget(WorldObject const *) const override
void SetMovementAnimKitId(uint16 animKitId)
void SetMaxHealth(uint64 val)
float GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
int32 GetPower(Powers power) const
void SetModTimeRate(float timeRate)
bool IsUnderWater() const
void SetSpeedRate(UnitMoveType mtype, float rate)
DeathState getDeathState() const
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 SetClass(uint8 classId)
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
virtual bool CanSwim() const
void RemoveFromWorld() override
bool IsOnOceanFloor() const
Powers CalculateDisplayPowerType() const
void DoMeleeAttackIfReady()
void ReplaceAllUnitFlags2(UnitFlags2 flags)
bool IsWildBattlePet() const
virtual void setDeathState(DeathState s)
virtual void AtEngage(Unit *target)
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
CombatManager & GetCombatManager()
void SetVignette(uint32 vignetteId)
bool IsUninteractible() const
bool IsSpiritHealer() const
void SetInFront(WorldObject const *target)
void SetModCastingSpeed(float castingSpeed)
Vehicle * GetVehicleKit() const
bool SetDisableGravity(bool disable, bool updateAnimTier=true, bool updatePlayHoverAnim=true)
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 SetPowerType(Powers power, bool sendUpdate=true, bool onInit=false)
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)
bool BuildPacket(WorldPacket *packet)
constexpr uint32 GetBlock(uint32 index) const
constexpr void Set(uint32 index)
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()
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
WorldPacket const * GetRawPacket() const
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_CORPSE_DECAY_RAREELITE
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
@ 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
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
static constexpr ObjectData creatureData[]
static constexpr uint32 Entry[5]
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::ranges::begin(container))
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
auto MapGetValuePtr(M &map, typename M::key_type const &key)
void MultimapErasePair(M &multimap, typename M::key_type const &key, typename M::mapped_type const &value)
XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level)
bool IsValidMapCoord(float c)
constexpr GridCoord ComputeGridCoord(float x, float y)
void const * GetRawFragmentData(T const &fragmentData)
struct advstd::ranges::Contains contains
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius)
std::vector< uint32 > auras
VisibilityDistanceType visibilityDistanceType
static CreatureBaseStats const * GetBaseStats(uint8 level, uint8 unitClass)
Optional< uint32 > curHealthPct
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
EnumFlag< SpellOtherImmunity > Other
std::bitset< MAX_SPELL_SCHOOL > School
std::vector< SpellEffects > Effect
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
Optional< CreatureStaticFlags > StaticFlags1
Optional< CreatureStaticFlags5 > StaticFlags5
Optional< CreatureStaticFlags7 > StaticFlags7
Optional< CreatureStaticFlags3 > StaticFlags3
Optional< CreatureStaticFlags2 > StaticFlags2
Optional< CreatureStaticFlags6 > StaticFlags6
Optional< CreatureStaticFlags8 > StaticFlags8
Optional< CreatureStaticFlags4 > StaticFlags4
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
CreatureTemplate & operator=(CreatureTemplate const &other)=delete
CreatureMovementData Movement
std::unique_ptr< WorldPacket[]> QueryData
uint32 KillCredit[MAX_KILL_CREDIT]
CreatureModel const * GetModelWithDisplayId(uint32 displayId) const
CreatureModel const * GetFirstVisibleModel() const
std::vector< CreatureModel > Models
std::unordered_map< Difficulty, CreatureDifficulty > difficultyStore
WorldPacket BuildQueryData(LocaleConstant loc, Difficulty difficulty) const
UF::ObjectData::Base ObjectMask
bool IgnoreNestedChangesMask
void operator()(Player const *player) const
UF::UnitData::Base UnitMask
int16 FallbackDifficultyID
EquipmentItem Items[MAX_EQUIPMENT_ITEMS]
struct MovementInfo::TransportInfo transport
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr bool IsInDist2d(float x, float y, float dist) const
std::string ToString() const
Position GetPositionWithOffset(Position const &offset) 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
bool Insert(ValueType< ObjectType > object)
bool Remove(ValueType< ObjectType > object)
static void AppendAllowedFieldsMaskForFlag(Mask &allowedMaskForTarget, EnumFlag< UpdateFieldFlag > fieldVisibilityFlags)
UpdateField< uint32, 0, 12 > StateWorldEffectsQuestObjectiveID
UpdateField< int32, 32, 44 > ScalingLevelMax
UpdateField< int32, 32, 42 > ContentTuningID
UpdateField< int32, 32, 45 > ScalingLevelDelta
UpdateField< int32, 96, 125 > TaxiNodesID
UpdateField< int32, 32, 43 > ScalingLevelMin
static void FilterDisallowedFieldsMaskForFlag(Mask &changesMask, EnumFlag< UpdateFieldFlag > fieldVisibilityFlags)
UpdateField< ObjectGuid, 0, 22 > Target
UpdateField< int32, 0, 1 > Flags
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, 3 > Flags
CreatureDisplayStats Display
std::array< std::string, 4 > Name
std::array< std::string, 4 > NameAlt
std::array< uint32, 2 > ProxyCreatureID
void Remove(EntityFragment fragment)
void Add(EntityFragment fragment, bool update, void const *data=nullptr)