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();
266 DefaultCreatureDifficulty()
271 HealthScalingExpansion = 0;
272 HealthModifier = 1.f;
275 DamageModifier = 1.f;
276 CreatureDifficultyID = 0;
281 PickPocketLootID = 0;
287 static const DefaultCreatureDifficulty defDifficulty;
288 return &defDifficulty;
312 return sObjectMgr->GetCreatureBaseStats(level, unitClass);
322 m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_ignoreCorpseDecayRatio(false), m_wanderDistance(0.0f),
325 m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_cannotReachTarget(false), m_cannotReachTimer(0),
327 m_creatureInfo(nullptr), m_creatureData(nullptr), m_creatureDifficulty(nullptr), m_stringIds(), _waypointPathId(0), _currentWaypointNodeInfo(0, 0),
328 m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), _aggroGracePeriodExpired(false), _lastDamagedTime(0),
329 _regenerateHealth(true), _creatureImmunitiesId(0), _gossipMenuId(0), _sparringHealthPct(0)
446 ai->CorpseRemoved(respawnDelay);
448 if (destroyForNearbyPlayers)
505 TC_LOG_ERROR(
"sql.sql",
"Creature::InitEntry creature entry {} does not exist.", entry);
522 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", entry);
530 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has invalid model {} defined in table `creature_template_model`, can't load.", entry, model.
CreatureDisplayID);
609 uint32 unitFlags, unitFlags2, unitFlags3;
627 unitFlags &= ~UNIT_FLAG_IN_COMBAT;
653 if (previousHealth > 0)
690 owner->VehicleSpellInitialize();
730 if (!staticFlagsOverride)
798 if (!linkedRespawnTime)
803 if (targetGuid == dbtableHighGuid)
808 time_t baseRespawnTime = std::max(linkedRespawnTime, now);
813 if (baseRespawnTime <= std::numeric_limits<time_t>::max() - offset)
905 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}",
GetDebugInfo());
908 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}",
GetDebugInfo());
960 if (curValue >= maxValue)
963 float addvalue = 0.0f;
986 addvalue =
uint32((27.0f / 5.0f + 17.0f) * ManaIncreaseRate);
989 addvalue = maxValue / 3;
1013 if (curValue >= maxValue)
1023 addvalue = 0.015f * ((float)
GetMaxHealth()) * HealthIncreaseRate;
1026 addvalue = maxValue/3;
1123 TC_LOG_ERROR(
"sql.sql",
"Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1137 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());
1224 if (!creature->Create(lowGuid, map, entry, pos,
nullptr, vehId))
1236 if (!creature->
LoadFromDB(spawnId, map, addToMap, allowDuplicate))
1247 Unit* target =
nullptr;
1259 if (owner->IsInCombat())
1263 for (ControlList::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
1265 if ((*itr)->IsInCombat())
1291 if (!iAuras.empty())
1293 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
1295 if ((*itr)->GetBase()->IsPermanent())
1400 if (
GetMap()->
IsRaid() || group->SameSubGroup(player, itr.GetSource()))
1401 m_tapList.insert(itr.GetSource()->GetGUID());
1437 if (!loot->isLooted())
1458 TC_LOG_ERROR(
"entities.unit",
"Creature::SaveToDB failed, cannot get creature data!");
1464 if (transport->GetMapIdForSpawning() >= 0)
1465 mapId = transport->GetMapIdForSpawning();
1490 if (displayId && displayId == model.CreatureDisplayID)
1493 if (spawnNpcFlags != cinfo->
npcflag)
1494 npcflag = spawnNpcFlags;
1549 trans->Append(stmt);
1557 stmt->
setString(index++, [&data]() -> std::string
1559 std::ostringstream os;
1562 auto itr = data.spawnDifficulties.begin();
1563 os << int32(*itr++);
1565 for (; itr != data.spawnDifficulties.end(); ++itr)
1566 os <<
',' << int32(*itr);
1569 return std::move(os).str();
1586 if (npcflag.has_value())
1591 if (unitFlags.has_value())
1596 if (unitFlags2.has_value())
1601 if (unitFlags3.has_value())
1612 trans->Append(stmt);
1657 float weaponBaseMinDamage = basedamage;
1658 float weaponBaseMaxDamage = basedamage * 1.5f;
1683 if (areaTable->WildBattlePetLevelMin > 0)
1684 wildBattlePetLevel =
urand(areaTable->WildBattlePetLevelMin, areaTable->WildBattlePetLevelMax);
1692 switch (classification)
1721 switch (classification)
1744 switch (classification)
1785 if (
GetHealth() - damage <= sparringHealth)
1827 TC_LOG_ERROR(
"sql.sql",
"Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1834 _Create(ObjectGuid::Create<HighGuid::Vehicle>(
GetMapId(), entry, guidlow));
1836 _Create(ObjectGuid::Create<HighGuid::Creature>(
GetMapId(), entry, guidlow));
1865 if (!allowDuplicate)
1870 std::vector <Creature*> despawnList;
1872 if (creatureBounds.first != creatureBounds.second)
1874 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1876 if (itr->second->IsAlive())
1878 TC_LOG_DEBUG(
"maps",
"Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1883 despawnList.push_back(itr->second);
1884 TC_LOG_DEBUG(
"maps",
"Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1888 for (
Creature* despawnCreature : despawnList)
1890 despawnCreature->AddObjectToRemoveList();
1898 TC_LOG_ERROR(
"sql.sql",
"Creature (SpawnID {}) not found in table `creature`, can't load. ", spawnId);
1941 TC_LOG_ERROR(
"entities.unit",
"Creature (SpawnID {}) trying to load despite a respawn timer in progress:\n{}", spawnId,
GetDebugInfo());
1968 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;
2179 int32 levelDifference = creatureLevel - playerLevel;
2186 float aggroRadius = baseAggroDistance + float(levelDifference);
2198 if (creatureLevel > expansionMaxLevel)
2199 aggroRadius = baseAggroDistance + float(expansionMaxLevel - playerLevel);
2202 if (aggroRadius > maxRadius)
2203 aggroRadius = maxRadius;
2204 else if (aggroRadius < minRadius)
2205 aggroRadius = minRadius;
2207 return (aggroRadius * aggroRate);
2294 uint32 unitFlags, unitFlags2, unitFlags3;
2379 TC_LOG_DEBUG(
"entities.unit",
"Respawning creature {} ({})",
2386 if (timeMSToDespawn)
2400 bool overrideRespawnTime =
false;
2403 if (forceRespawnTimer > Seconds::zero())
2407 overrideRespawnTime =
true;
2421 if (forceRespawnTimer > Seconds::zero())
2439 summon->UnSummon(timeToDespawn.count());
2448 static uint32 constexpr placeholderSpellId = std::numeric_limits<uint32>::max();
2450 auto applyCreatureImmunities = [
this](
CreatureImmunities const* immunities,
bool apply)
2452 for (std::size_t i = 0; i < immunities->
School.size(); ++i)
2453 if (immunities->
School[i])
2456 for (std::size_t i = 0; i < immunities->
DispelType.size(); ++i)
2460 for (std::size_t i = 0; i < immunities->
Mechanic.size(); ++i)
2476 applyCreatureImmunities(immunities,
false);
2482 applyCreatureImmunities(immunities,
true);
2489 bool requireImmunityPurgesEffectAttribute )
const
2519 Unit* target =
nullptr;
2531 TC_LOG_ERROR(
"entities.unit",
"Creature {} SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.",
GetGUID().
ToString());
2535 Unit* target =
nullptr;
2551 TC_LOG_DEBUG(
"network",
"WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2564 std::list<Creature*> assistList;
2569 if (!assistList.empty())
2572 while (!assistList.empty())
2576 assistList.pop_front();
2719 if (!ai->CanAIAttack(victim))
2732 if (
GetMap()->IsDungeon())
2777 Mount(mountDisplayId);
2790 if (creatureAddon->
emote != 0)
2802 if (creatureAddon->
PathId != 0)
2805 if (!creatureAddon->
auras.empty())
2807 for (std::vector<uint32>::const_iterator itr = creatureAddon->
auras.begin(); itr != creatureAddon->
auras.end(); ++itr)
2810 if (!AdditionalSpellInfo)
2830 if (force || std::find(templateValues->begin(), templateValues->end(),
_sparringHealthPct) != templateValues->end())
2844 if (enemyTeam !=
HORDE)
2863 if (!currentMovement)
2866 bool canChangeMovement = [&]
2868 if (wasFleeingFromMelee)
2874 if (!canChangeMovement)
2962 return *movementOverride;
2997 bool isFullySkinned = [&]() ->
bool
3002 bool hasSkinningLoot =
false;
3007 if (!loot->isLooted())
3010 hasSkinningLoot =
true;
3014 return hasSkinningLoot;
3045 auto sender = [&](
Player const* receiver)
3047 receiver->PlayerTalkClass->SendQuestGiverStatus(receiver->GetQuestDialogStatus(
this),
GetGUID());
3071 int32 delta = mindelta == maxdelta ? mindelta :
irand(mindelta, maxdelta);
3082 return std::max(baseHealth * creatureDifficulty->
HealthModifier, 1.0);
3132 if (
Unit const* unitTarget = target->
ToUnit())
3142 int32 targetLevel = unitTarget->GetEffectiveLevel();
3144 int32 targetLevelDelta = 0;
3149 scalingLevelMin = scalingLevelMax;
3151 int32 maxCreatureScalingLevel = playerTarget->m_activePlayerData->MaxCreatureScalingLevel;
3152 targetLevelDelta = std::min(maxCreatureScalingLevel > 0 ? maxCreatureScalingLevel - targetLevel : 0, *playerTarget->m_activePlayerData->ScalingPlayerLevelDelta);
3155 int32 levelWithDelta = targetLevel + targetLevelDelta;
3156 int32 level =
RoundToInterval(levelWithDelta, scalingLevelMin, scalingLevelMax) + scalingLevelDelta;
3194 return std::ranges::any_of(
m_stringIds, [
id](std::string
const* stringId) {
return stringId && *stringId == id; });
3218 if (data->spawnTrackingData && !data->spawnTrackingQuestObjectives.empty())
3240 if (itr->itemId == vItem->
item)
3254 if ((vCount->
count + diff * pProto->GetBuyCount()) >= vItem->
maxcount)
3260 vCount->
count += diff * pProto->GetBuyCount();
3264 return vCount->
count;
3274 if (itr->itemId == vItem->
item)
3292 if ((vCount->
count + diff * pProto->GetBuyCount()) < vItem->
maxcount)
3293 vCount->
count += diff * pProto->GetBuyCount();
3298 vCount->
count = vCount->
count > used_count ? vCount->
count-used_count : 0;
3300 return vCount->
count;
3358 if (cl->Name.size() > locale && !cl->Name[locale].empty())
3359 return cl->Name[locale];
3384 return m_charmInfo->GetCharmSpell(pos)->GetAction();
3399 if (spellInfo->GetRecoveryTime() == 0 && spellInfo->RangeEntry && spellInfo->RangeEntry->ID != 1 && spellInfo->RangeEntry->ID != 2 && spellInfo->GetMaxRange() > range)
3400 range = spellInfo->GetMaxRange();
3415 TC_LOG_DEBUG(
"entities.unit.chase",
"Creature::SetCannotReachTarget() called with true. Details: {}",
GetDebugInfo());
3421 mountCreatureDisplayId.reset();
3431 if (target &&
IsPet())
3444 if (levelDiff < -25)
3448 float aggroRadius = 20;
3451 aggroRadius -= (float)levelDiff;
3465 if (aggroRadius < 10)
3468 return (aggroRadius);
3480 Unit* target =
nullptr;
3578 if (!turnDisabled && noTurnDuringCast && target)
3581 if (noTurnDuringCast)
3591 TC_LOG_WARN(
"entities.unit",
"Creature '{}' (entry {}) has spell focus (spell id {}, delay {}ms) despite being dead.",
3630 TC_LOG_ERROR(
"entities.unit",
"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {}",
GetDebugInfo());
3676 if (std::find(repeats.begin(), repeats.end(),
id) == repeats.end())
3677 repeats.push_back(
id);
3686 CreatureTextRepeatGroup::const_iterator groupItr =
m_textRepeat.find(textGroup);
3688 ids = groupItr->second;
3695 CreatureTextRepeatGroup::iterator groupItr =
m_textRepeat.find(textGroup);
3697 groupItr->second.clear();
3708 return ai->IsEngaged();
3739 for (
auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); ++seat)
3747 ai->JustEngagedWith(target);
3749 formation->MemberEngagingTarget(
this, target);
3779 if (combatReference->IsSuppressedFor(
this))
3787 partiesToForceIntoCombat.
insert(group);
3790 for (
Group const* partyToForceIntoCombat : partiesToForceIntoCombat)
3792 for (
GroupReference const& ref : partyToForceIntoCombat->GetMembers())
3794 Player* player = ref.GetSource();
3806 return ai->IsEscorted();
3812 std::stringstream sstr;
3873 auto itr = clickBounds.begin();
3875 if (itr != clickBounds.end() && ++itr == clickBounds.end())
3907 m_unitData->WriteUpdate(mask, data, target,
this,
true);
3915 if (requestedObjectMask.IsAnySet())
3920 if (unitMask.IsAnySet())
3924 std::size_t sizePos = buffer.
wpos();
3930 m_objectData->WriteUpdate(requestedObjectMask, buffer, target,
this, ignoreNestedChangesMask);
3933 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_CAN_SWIM
@ CREATURE_STATIC_FLAG_NO_XP
@ CREATURE_STATIC_FLAG_NO_MELEE_FLEE
@ 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
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_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
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_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)
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)
struct Creature::@192 _spellFocusInfo
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 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
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
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)
bool IsAmphibious() const
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()
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 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)
virtual void AtEngage(Unit *)
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
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
void RemoveNpcFlag(NPCFlags flags)
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
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)
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)
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
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
Powers CalculateDisplayPowerType() const
void DoMeleeAttackIfReady()
void ReplaceAllUnitFlags2(UnitFlags2 flags)
bool IsWildBattlePet() const
virtual void setDeathState(DeathState s)
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
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 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[]
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)
GridCoord ComputeGridCoord(float x, float y)
void const * GetRawFragmentData(T const &fragmentData)
struct advstd::ranges::Contains contains
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
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, 43 > ScalingLevelDelta
UpdateField< int32, 32, 41 > ScalingLevelMin
UpdateField< int32, 32, 42 > ScalingLevelMax
UpdateField< int32, 32, 40 > ContentTuningID
static void FilterDisallowedFieldsMaskForFlag(Mask &changesMask, EnumFlag< UpdateFieldFlag > fieldVisibilityFlags)
UpdateField< ObjectGuid, 0, 22 > Target
UpdateField< int32, 96, 123 > TaxiNodesID
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)