55#include <G3D/g3dmath.h>
62 char const*
const GroundStates[] = {
"None",
"Run",
"Hover" };
63 char const*
const FlightStates[] = {
"None",
"DisableGravity",
"CanFly" };
64 char const*
const ChaseStates[] = {
"Run",
"CanWalk",
"AlwaysWalk" };
65 char const*
const RandomStates[] = {
"Walk",
"CanRun",
"AlwaysRun" };
67 std::ostringstream str;
82 : itemId(_item), count(_count), lastIncrementTime(
GameTime::GetGameTime()) { }
93 return vendorItem.item == item_id;
96 bool found = (newEnd !=
m_items.end());
104 if (vendorItem.item == item_id && vendorItem.ExtendedCost == extendedCost)
119 return ((c>0) ? modelIDs[
urand(0, c-1)] : 0);
183 std::string locName =
Name, locTitle =
Title;
191 queryTemp.
Allow =
true;
212 if (std::vector<uint32>
const* items =
sObjectMgr->GetCreatureQuestItemList(
Entry))
214 if (i < items->size())
220 return queryTemp.
Move();
244 return sObjectMgr->GetCreatureBaseStats(level, unitClass);
254 m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_ignoreCorpseDecayRatio(false), m_wanderDistance(0.0f),
255 m_boundaryCheckTime(2500), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(
REACT_AGGRESSIVE),
256 m_defaultMovementType(
IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0),
257 m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_cannotReachTarget(false), m_cannotReachTimer(0),
259 m_creatureInfo(nullptr), m_creatureData(nullptr), m_stringIds(), _waypointPathId(0), _currentWaypointNodeInfo(0, 0),
260 m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), _lastDamagedTime(0),
261 _regenerateHealth(true), _regenerateHealthLock(false), _isMissingCanSwimFlagOutOfCombat(false)
338 sFormationMgr->AddCreatureToGroup(formationInfo->LeaderSpawnId,
this);
381 ai->CorpseRemoved(respawnDelay);
383 if (destroyForNearbyPlayers)
407 transport->CalculatePassengerPosition(x, y, z, &o);
445 TC_LOG_ERROR(
"sql.sql",
"Creature::InitEntry creature entry {} does not exist.", entry);
487 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", entry);
495 TC_LOG_ERROR(
"sql.sql",
"Creature (Entry: {}) has invalid model {} defined in table `creature_template`, can't load.", entry, displayID);
555 uint32 npcFlags, unitFlags, dynamicFlags;
564 unitFlags &= ~UNIT_FLAG_IN_COMBAT;
587 if (previousHealth > 0)
612 owner->VehicleSpellInitialize();
661 for (
auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); seat++)
663 passenger->SetPhaseMask(newPhaseMask, update);
711 if (!linkedRespawnTime)
716 if (targetGuid == dbtableHighGuid)
721 time_t baseRespawnTime = std::max(linkedRespawnTime, now);
726 if (baseRespawnTime <= std::numeric_limits<time_t>::max() - offset)
809 if (
Player* player = it->GetSource())
811 if (player->IsGameMaster())
852 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}",
GetDebugInfo());
855 TC_LOG_DEBUG(
"entities.unit.chase",
"RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}",
GetDebugInfo());
889 if (curValue >= maxValue)
892 float addvalue = 0.0f;
918 addvalue =
uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
922 addvalue = maxValue / 3;
946 if (curValue >= maxValue)
958 addvalue =
uint32(Spirit * 0.25 * HealthIncreaseRate);
960 addvalue =
uint32(Spirit * 0.80 * HealthIncreaseRate);
963 addvalue = maxValue/3;
1055 TC_LOG_ERROR(
"sql.sql",
"Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1067 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());
1130 Unit* target =
nullptr;
1142 if (owner->IsInCombat())
1146 for (ControlList::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
1148 if ((*itr)->IsInCombat())
1174 if (!iAuras.empty())
1176 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
1178 if ((*itr)->GetBase()->IsPermanent())
1317 TC_LOG_ERROR(
"entities.unit",
"Creature::SaveToDB failed, cannot get creature data!");
1346 if (npcflag == cinfo->
npcflag)
1395 trans->Append(stmt);
1403 stmt->
setUInt8(index++, spawnMask);
1420 trans->Append(stmt);
1432 uint8 level = minlevel == maxlevel ? minlevel :
urand(minlevel, maxlevel);
1473 float weaponBaseMinDamage = basedamage;
1474 float weaponBaseMaxDamage = basedamage * 1.5f;
1568 TC_LOG_ERROR(
"sql.sql",
"Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, entry);
1575 Object::_Create(ObjectGuid::Create<HighGuid::Vehicle>(entry, guidlow));
1602 if (!allowDuplicate)
1607 std::vector <Creature*> despawnList;
1609 if (creatureBounds.first != creatureBounds.second)
1611 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1613 if (itr->second->IsAlive())
1615 TC_LOG_DEBUG(
"maps",
"Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1620 despawnList.push_back(itr->second);
1621 TC_LOG_DEBUG(
"maps",
"Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1625 for (
Creature* despawnCreature : despawnList)
1627 despawnCreature->AddObjectToRemoveList();
1636 TC_LOG_ERROR(
"sql.sql",
"Creature (SpawnID {}) not found in table `creature`, can't load. ", spawnId);
1679 TC_LOG_ERROR(
"entities.unit",
"Creature (SpawnID {}) trying to load despite a respawn timer in progress:\n{}", spawnId,
GetDebugInfo());
1704 if (addToMap && !
GetMap()->AddToMap(
this))
1789 [spawnId, charTrans](
Map* map) ->
void
1792 std::vector<Creature*> toUnload;
1793 for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetCreatureBySpawnIdStore(), spawnId))
1794 toUnload.push_back(pair.second);
1795 for (Creature* creature : toUnload)
1796 map->AddObjectToRemoveList(creature);
1797 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, spawnId, charTrans);
1811 trans->Append(stmt);
1816 trans->Append(stmt);
1820 trans->Append(stmt);
1824 trans->Append(stmt);
1828 trans->Append(stmt);
1833 trans->Append(stmt);
1838 trans->Append(stmt);
1843 trans->Append(stmt);
1848 trans->Append(stmt);
1920 if (notAbove == 0 && notBelow == 0)
1923 if (playerLevel <= notBelow || (playerLevel >= notAbove && notAbove > 0))
1946 float aggroRadius = baseAggroDistance + float(levelDifference);
1958 if (
GetLevel() > expansionMaxLevel)
1959 aggroRadius = baseAggroDistance + float(expansionMaxLevel - player->
GetLevel());
1962 if (aggroRadius > maxRadius)
1963 aggroRadius = maxRadius;
1964 else if (aggroRadius < minRadius)
1965 aggroRadius = minRadius;
1967 return (aggroRadius * aggroRate);
2045 uint32 npcflag, unit_flags, dynamicflags;
2096 if (
sObjectMgr->GetCreatureModelRandomGender(&displayID))
2124 TC_LOG_DEBUG(
"entities.unit",
"Respawning creature {} ({})",
2131 if (timeMSToDespawn)
2145 bool overrideRespawnTime =
false;
2148 if (forceRespawnTimer > Seconds::zero())
2152 overrideRespawnTime =
true;
2166 if (forceRespawnTimer > Seconds::zero())
2184 summon->UnSummon(timeToDespawn.count());
2193 static uint32 const placeholderSpellId = std::numeric_limits<uint32>::max();
2210 if (mask & (1 << (i - 1)))
2219 if (mask & (1 << i))
2230 bool immunedToAllEffects =
true;
2233 if (spellEffectInfo.IsEffect() && !
IsImmunedToSpellEffect(spellInfo, spellEffectInfo, caster, requireImmunityPurgesEffectAttribute))
2235 immunedToAllEffects =
false;
2240 if (immunedToAllEffects)
2247 bool requireImmunityPurgesEffectAttribute )
const
2278 Unit* target =
nullptr;
2290 TC_LOG_ERROR(
"entities.unit",
"Creature {} SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.",
GetGUID().
ToString());
2294 Unit* target =
nullptr;
2306 data <<
uint32(reactionType);
2308 ((
WorldObject*)
this)->SendMessageToSet(&data,
true);
2310 TC_LOG_DEBUG(
"network",
"WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2323 std::list<Creature*> assistList;
2328 if (!assistList.empty())
2331 while (!assistList.empty())
2335 assistList.pop_front();
2478 if (!ai->CanAIAttack(victim))
2491 if (
GetMap()->IsDungeon())
2536 if (creatureAddon->
mount != 0)
2552 if (creatureAddon->
emote != 0)
2560 if (creatureAddon->
path_id != 0)
2563 if (!creatureAddon->
auras.empty())
2565 for (std::vector<uint32>::const_iterator itr = creatureAddon->
auras.begin(); itr != creatureAddon->
auras.end(); ++itr)
2568 if (!AdditionalSpellInfo)
2693 return *movementOverride;
2761 return uint8(level);
2794 return std::ranges::any_of(
m_stringIds, [
id](std::string
const* stringId) {
return stringId && *stringId == id; });
2823 if (itr->itemId == vItem->
item)
2837 if ((vCount->
count + diff * pProto->BuyCount) >= vItem->
maxcount)
2843 vCount->
count += diff * pProto->BuyCount;
2847 return vCount->
count;
2857 if (itr->itemId == vItem->
item)
2875 if ((vCount->
count + diff * pProto->BuyCount) < vItem->
maxcount)
2876 vCount->
count += diff * pProto->BuyCount;
2881 vCount->
count = vCount->
count > used_count ? vCount->
count-used_count : 0;
2883 return vCount->
count;
2895 if (cl->
Name.size() > uloc_idx && !cl->
Name[uloc_idx].empty())
2896 return cl->
Name[uloc_idx];
2923 if (spellInfo->GetRecoveryTime() == 0 && spellInfo->RangeEntry->ID != 1 && spellInfo->RangeEntry->ID != 2 && spellInfo->GetMaxRange() > range)
2924 range = spellInfo->GetMaxRange();
2939 TC_LOG_DEBUG(
"entities.unit.chase",
"Creature::SetCannotReachTarget() called with true. Details: {}",
GetDebugInfo());
2947 if (target &&
IsPet())
2960 if (levelDiff < -25)
2964 float aggroRadius = 20;
2967 aggroRadius -= (float)levelDiff;
2981 if (aggroRadius < 10)
2984 return (aggroRadius);
2996 Unit* target =
nullptr;
3088 if (!turnDisabled && noTurnDuringCast && target)
3091 if (noTurnDuringCast)
3101 TC_LOG_WARN(
"entities.unit",
"Creature '{}' (entry {}) has spell focus (spell id {}, delay {}ms) despite being dead.",
3140 TC_LOG_ERROR(
"entities.unit",
"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {}",
GetDebugInfo());
3186 if (std::find(repeats.begin(), repeats.end(),
id) == repeats.end())
3187 repeats.push_back(
id);
3196 CreatureTextRepeatGroup::const_iterator groupItr =
m_textRepeat.find(textGroup);
3198 ids = groupItr->second;
3205 CreatureTextRepeatGroup::iterator groupItr =
m_textRepeat.find(textGroup);
3207 groupItr->second.clear();
3221 return ai->IsEngaged();
3250 for (
auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); ++seat)
3258 ai->JustEngagedWith(target);
3260 formation->MemberEngagingTarget(
this, target);
3282 return ai->IsEscorted();
3288 std::stringstream sstr;
static const uint32 MAX_CREATURE_QUEST_ITEMS
static 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_NO_MOVE_FLAGS_UPDATE
@ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK
@ CREATURE_FLAG_EXTRA_NO_TAUNT
@ CREATURE_FLAG_EXTRA_GHOST_VISIBILITY
@ CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK
@ CREATURE_FLAG_EXTRA_WORLDEVENT
CreatureFlightMovementType
CreatureChaseMovementType
CreatureGroundMovementType
static const uint8 MAX_KILL_CREDIT
CreatureRandomMovementType
static const uint32 CREATURE_NOPATH_EVADE_TIME
static const uint32 MAX_CREATURE_SPELLS
static const uint32 PET_FOCUS_REGEN_INTERVAL
std::vector< uint8 > CreatureTextRepeatIds
#define CREATURE_Z_ATTACK_RANGE
@ RAID_DIFFICULTY_10MAN_HEROIC
@ FACTION_TEMPLATE_FLAG_PVP
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
#define SIZE_OF_GRID_CELL
@ ITEM_FLAG2_DONT_IGNORE_BUY_PRICE
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
#define MAX_FALL_DISTANCE
#define MAX_VISIBILITY_DISTANCE
#define DEFAULT_PLAYER_COMBAT_REACH
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
@ SPELL_ATTR5_DONT_TURN_DURING_CAST
@ SPELL_SCHOOL_MASK_NORMAL
@ CREATURE_TYPE_NON_COMBAT_PET
@ CREATURE_TYPE_MECHANICAL
float const GROUND_HEIGHT_TOLERANCE
@ CREATURE_ELITE_WORLDBOSS
@ CREATURE_ELITE_RAREELITE
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
@ CREATURE_TYPE_FLAG_BOSS_MOB
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
uint32 GetMaxLevelForExpansion(uint32 expansion)
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
@ LINKED_RESPAWN_CREATURE_TO_GO
@ LINKED_RESPAWN_CREATURE_TO_CREATURE
@ LINKED_RESPAWN_GO_TO_CREATURE
@ SPELL_AURA_MOD_POWER_REGEN
@ SPELL_AURA_PREVENTS_FLEEING
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
@ SPELL_AURA_MOD_DETECTED_RANGE
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ SPELL_AURA_MOD_DETECT_RANGE
@ UNIT_FLAG2_REGENERATE_POWER
NPCFlags
Non Player Character flags.
#define MAX_EQUIPMENT_ITEMS
@ UNIT_BYTE2_FLAG_FFA_PVP
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_UNINTERACTIBLE
@ 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
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
@ WORLD_DEL_SPAWNGROUP_MEMBER
@ WORLD_DEL_GAME_EVENT_MODEL_EQUIP
@ WORLD_DEL_CREATURE_ADDON
@ WORLD_DEL_LINKED_RESPAWN
@ WORLD_DEL_GAME_EVENT_CREATURE
@ WORLD_DEL_LINKED_RESPAWN_MASTER
bool Execute(uint64 e_time, uint32 p_time) override
void AddAssistant(ObjectGuid guid)
Unit * GetAnyTarget() const
@ EVADE_REASON_NO_HOSTILES
virtual void JustAppeared()
virtual bool CheckInRoom()
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Creature * GetLeader() const
void FormationReset(bool dismiss)
void LeaderStartedMoving()
bool IsLeader(Creature const *creature) const
bool CanLeaderStartMoving() const
float GetSpellDamageMod(int32 Rank) const
bool LoadCreaturesAddon()
time_t _pickpocketLootRestore
Timers.
bool HasSpell(uint32 spellID) const override
void SetPhaseMask(uint32 newPhaseMask, bool update) override
VendorItemCounts m_vendorItemCounts
virtual uint8 GetPetAutoSpellSize() const
void SetHomePosition(float x, float y, float z, float o)
void SetNoSearchAssistance(bool val)
void ReleaseSpellFocus(Spell const *focusSpell=nullptr, bool withDelay=true)
ObjectGuid lootingGroupLowGUID
void Respawn(bool force=false)
std::array< std::string const *, 3 > m_stringIds
bool IsImmunedToSpell(SpellInfo const *spellInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const override
bool CanSwim() const override
CreatureTextRepeatGroup m_textRepeat
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
VendorItemData const * GetVendorItems() const
void InitializeMovementFlags()
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const *data=nullptr, uint32 vehId=0)
bool IsDungeonBoss() const
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
bool IsReturningHome() const
void UpdateLevelDependantStats()
int8 m_originalEquipmentId
void setDeathState(DeathState s) override
bool UpdateAllStats() override
void CallForHelp(float fRadius)
float GetAttackDistance(Unit const *player) const
uint32 GetShieldBlockValue() const override
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
void SetDisplayId(uint32 modelId) override
void Update(uint32 time) override
bool _IsTargetAcceptable(Unit const *target) const
void SetRespawnTime(uint32 respawn)
void SetObjectScale(float scale) override
Optional< std::string > m_scriptStringId
uint32 m_spells[MAX_CREATURE_SPELLS]
void SetLootRecipient(Unit *unit, bool withGroup=true)
bool m_respawnCompatibilityMode
CreatureTemplate const * m_creatureInfo
bool IsSpawnedOnTransport() const
bool CanFly() const override
Position const & GetHomePosition() const
bool CanGiveExperience() const
CreatureTextRepeatIds GetTextRepeatGroup(uint8 textGroup)
bool CanResetTalents(Player *player, bool pet) const
uint32 GetWaypointPath() const
void LoadEquipment(int8 id=1, bool force=false)
uint8 GetLevelForTarget(WorldObject const *target) const override
bool HasReactState(ReactStates state) const
bool AIM_Initialize(CreatureAI *ai=nullptr)
void DoNotReacquireSpellFocusTarget()
void RemoveCorpse(bool setSpawnTime=true, bool destroyForNearbyPlayers=true)
void SendZoneUnderAttackMessage(Player *attacker)
Send a message to LocalDefense channel for players opposition team in the zone.
bool m_triggerJustAppeared
void StartPickPocketRefillTimer()
void AllLootRemovedFromCorpse()
float GetAggroRange(Unit const *target) const
void LoadTemplateImmunities()
void SignalFormationMovement()
bool IsEngaged() const override
MovementGeneratorType m_defaultMovementType
Unit * SelectNearestHostileUnitInAggroRange(bool useLOS=false, bool ignoreCivilians=false) const
void SetReactState(ReactStates st)
void RemoveFromWorld() override
void SetTextRepeatId(uint8 textGroup, uint8 id)
void ResetPlayerDamageReq()
bool hasLootRecipient() const
void SetRespawnCompatibilityMode(bool mode=true)
void SetCannotReachTarget(bool cannotReach)
void ClearTextRepeatGroup(uint8 textGroup)
void SetRespawnDelay(uint32 delay)
void AddToWorld() override
uint32 m_cannotReachTimer
void SetScriptStringId(std::string id)
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const override
time_t m_corpseRemoveTime
void ForcedDespawn(uint32 timeMSToDespawn=0, Seconds forceRespawnTimer=0s)
uint32 m_combatPulseDelay
float GetPetChaseDistance() const
bool IsFormationLeaderMoveAllowed() const
bool IsImmuneToNPC() const
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
void SetTarget(ObjectGuid guid) override
bool HasStringId(std::string_view id) const
void DoFleeToGetAssistance()
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
ObjectGuid m_lootRecipient
Player * GetLootRecipient() const
static float _GetHealthMod(int32 Rank)
CreatureData const * GetCreatureData() const
bool IsInvisibleDueToDespawn() const override
bool CanGeneratePickPocketLoot() const
bool CanIgnoreFeignDeath() const
ObjectGuid::LowType GetSpawnId() const
bool CanNotReachTarget() const
bool m_AlreadyCallAssistance
CreatureTemplate const * GetCreatureTemplate() const
uint32 GetRespawnDelay() const
bool IsFormationLeader() const
bool CanCreatureAttack(Unit const *victim, bool force=true) const
bool CanRegenerateHealth() const
void RefreshCanSwimFlag(bool recheck=false)
bool DisableReputationGain
CreatureGroup * m_formation
static bool DeleteFromDB(ObjectGuid::LowType spawnId)
void InitializeReactState()
bool AIM_Create(CreatureAI *ai=nullptr)
bool _regenerateHealthLock
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const override
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
void UpdateMovementFlags()
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
std::string_view GetStringId(StringIdType type) const
bool CanEnterWater() const override
float GetNativeObjectScale() const override
void ExitVehicle(Position const *exitPosition=nullptr) override
uint32 GetVendorItemCurrentCount(VendorItem const *vItem)
Group * GetLootRecipientGroup() const
struct Creature::@185 _spellFocusInfo
std::string GetScriptName() const
time_t GetLastDamagedTime() const
ObjectGuid m_lootRecipientGroup
MovementGeneratorType GetDefaultMovementType() const override
void SetSpellFocus(Spell const *focusSpell, WorldObject const *target)
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)
Unit * SelectNearestTargetInAttackDistance(float dist=0) const
CreatureMovementData const & GetMovementTemplate() const
void SendAIReaction(AiReaction reactionType)
static float _GetDamageMod(int32 Rank)
void ResetPickPocketRefillTimer()
void SetNoCallAssistance(bool val)
bool m_ignoreCorpseDecayRatio
bool CanAlwaysSee(WorldObject const *obj) const override
bool hasQuest(uint32 quest_id) const override
void Regenerate(Powers power)
time_t GetRespawnTimeEx() const
CreatureAddon const * GetCreatureAddon() const
std::string const & GetAIName() const
void InheritStringIds(Creature const *parent)
bool IsImmuneToPC() const
void SetCanDualWield(bool value) override
bool IsInEvadeMode() const
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 entry, Position const &pos, CreatureData const *data=nullptr, uint32 vehId=0, bool dynamic=false)
void ReacquireSpellFocusTarget()
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
std::string GetDebugInfo() const override
bool CanStartAttack(Unit const *u, bool force) const
void LowerPlayerDamageReq(uint32 unDamage)
bool IsMovementPreventedByCasting() const override
void SetOriginalEntry(uint32 entry)
bool _isMissingCanSwimFlagOutOfCombat
bool HasSpellFocus(Spell const *focusSpell=nullptr) const override
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
GameObjectTemplate const * GetGOInfo() const
bool HaveLootFor(uint32 loot_id) const
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
MapStoredObjectTypesContainer & GetObjectsStore()
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
time_t GetLinkedRespawnTime(ObjectGuid guid) const
void ApplyDynamicModeRespawnScaling(WorldObject const *obj, ObjectGuid::LowType spawnId, uint32 &respawnDelay, uint32 mode) const
ObjectGuid::LowType GenerateLowGuid()
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
void SaveRespawnInfoDB(RespawnInfo const &info, CharacterDatabaseTransaction dbTrans=nullptr)
bool IsSpawnGroupActive(uint32 groupId) const
void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, PositionFullTerrainStatus &data, Optional< uint8 > reqLiquidType={}, float collisionHeight=2.03128f) const
void SaveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 entry, time_t respawnTime, uint32 gridId, CharacterDatabaseTransaction dbTrans=nullptr, bool startup=false)
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
PlayerList const & GetPlayers() const
void Respawn(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
MovementGeneratorType GetCurrentMovementGeneratorType() const
void MoveSeekAssistance(float x, float y, float z)
void MoveFall(uint32 id=0)
static ObjectGuid const Empty
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint32 *npcflag, uint32 *unit_flags, uint32 *dynamicflags, CreatureData const *data=nullptr)
static std::string_view GetLocaleString(std::vector< std::string > const &data, size_t locale)
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
virtual void RemoveDynamicFlag(uint32 flag)
static Creature * ToCreature(Object *o)
float GetObjectScale() const
static Unit * ToUnit(Object *o)
bool HasDynamicFlag(uint32 flag) const
virtual void SetDynamicFlag(uint32 flag)
float GetFloatValue(uint16 index) const
void SetGuidValue(uint16 index, ObjectGuid value)
void _Create(ObjectGuid const &guid)
static ObjectGuid GetGUID(Object const *o)
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
ObjectGuid GetGUID() const
ObjectGuid GetGuidValue(uint16 index) const
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setFloat(uint8 index, float value)
void setInt32(uint8 index, int32 value)
void setUInt8(uint8 index, uint8 value)
bool HasAttribute(SpellAttr0 attribute) const
bool HasAura(AuraType aura) const
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > const & GetEffects() const
SpellInfo const * GetSpellInfo() const
bool IsFocusDisabled() const
int32 GetCastTime() const
Spell(WorldObject *caster, SpellInfo const *info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID=ObjectGuid::Empty)
void EvaluateSuppressed(bool canExpire=false)
Unit * GetCurrentVictim()
Unit * GetAnyTarget() const
void Update(uint32 tdiff)
bool IsTrainerValidForPlayer(Player const *player) const
Type GetTrainerType() const
bool Remove(KEY_TYPE const &handle)
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
virtual void InitializeAI()
int32 ModifyHealth(int32 val)
void ClearUnitState(uint32 f)
void ReplaceAllDynamicFlags(uint32 flag) override
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
bool IsUnderLastManaUseEffect() const
Vehicle * GetVehicle() const
virtual bool IsMovementPreventedByCasting() const
bool IsBattleMaster() const
bool isTargetableForAttack(bool checkFakeDeath=true) const
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
void SetAnimTier(AnimTier animTier)
void AIUpdateTick(uint32 diff)
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
bool SetFall(bool enable)
void UpdateObjectVisibility(bool forced=true) override
void SetHoverHeight(float hoverHeight)
ThreatManager & GetThreatManager()
void ReplaceAllPvpFlags(UnitPVPStateFlags flags)
void AddToWorld() override
virtual void SetCanDualWield(bool value)
void SetControlled(bool apply, UnitState state)
void SetCreateHealth(uint32 val)
void UpdateDisplayPower()
NPCFlags GetNpcFlags() const
void UpdateSpeed(UnitMoveType mtype)
bool IsMovedByClient() const
bool IsPolymorphed() const
void SetFaction(uint32 faction) override
virtual void SetPvP(bool state)
ObjectGuid GetOwnerGUID() const override
void StopMoving(bool force=false)
Unit * getAttackerForHelper() const
Trinity::unique_trackable_ptr< Vehicle > m_vehicleKit
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
void ReplaceAllUnitFlags(UnitFlags flags)
MotionMaster * GetMotionMaster()
Powers GetPowerType() const
bool HasUnitFlag(UnitFlags flags) const
bool SetHover(bool enable, bool updateAnimTier=true)
uint32 GetMaxHealth() const
Aura * AddAura(uint32 spellId, Unit *target)
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)
void SetHealth(uint32 val)
UnitFlags GetUnitFlags() const
TempSummon * ToTempSummon()
void SetMaxPower(Powers power, uint32 val)
ObjectGuid GetCharmerOrOwnerGUID() const override
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
void SetNativeDisplayId(uint32 displayId)
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
void SetVirtualItem(uint32 slot, uint32 itemId)
void AddUnitState(uint32 f)
float GetTotalAuraMultiplier(AuraType auraType) const
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
bool IsOnVehicle(Unit const *vehicle) const
void SetBoundingRadius(float boundingRadius)
void SetCreateMana(uint32 val)
bool isInAccessiblePlaceFor(Creature const *c) const
Unit * EnsureVictim() const
virtual void SetSheath(SheathState sheathed)
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)
void SetPvpFlag(UnitPVPStateFlags flags)
bool SetCanFly(bool enable, bool packetOnly=false)
float GetTotalAuraMultiplierByMiscValue(AuraType auraType, int32 misc_value) const
uint32 GetDisplayId() const
uint32 GetNativeDisplayId() const
uint32 GetMaxPower(Powers power) const
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
uint32 GetFaction() const override
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool force=false)
void SetAI(UnitAI *newAI)
bool HasAuraType(AuraType auraType) const
void EngageWithTarget(Unit *who)
void SetPhaseMask(uint32 newPhaseMask, bool update) override
uint8 GetLevelForTarget(WorldObject const *) const override
int32 GetTotalAuraModifier(AuraType auraType) const
void SetFullPower(Powers power)
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
virtual void SetDisplayId(uint32 modelId)
bool IsUnderWater() const
void SetSpeedRate(UnitMoveType mtype, float rate)
DeathState getDeathState() const
bool IsEngagedBy(Unit const *who) const
bool HasUnitState(const uint32 f) const
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
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
void SetStandState(UnitStandStateType state)
float GetStat(Stats stat) const
int32 GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
void ReplaceAllUnitFlags2(UnitFlags2 flags)
virtual void setDeathState(DeathState s)
void SetMaxHealth(uint32 val)
virtual void AtEngage(Unit *target)
uint32 GetPower(Powers power) const
CombatManager & GetCombatManager()
void SetUnitFlag(UnitFlags flags)
std::list< AuraEffect * > AuraEffectList
void SetAttackTime(WeaponAttackType att, uint32 val)
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 SetMountDisplayId(uint32 mountDisplayId)
void SetIsCombatDisallowed(bool apply)
uint32 GetDynamicFlags() const override
bool IsSpiritGuide() const
virtual void ExitVehicle(Position const *exitPosition=nullptr)
Unit * GetBase() const
May be called from scripts.
void Reset(bool evading=false)
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
void Install()
Initializes power type for vehicle. Nothing more.
uint32 GetPhaseMask() const
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
virtual bool IsInvisibleDueToDespawn() const
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
bool IsHostileTo(WorldObject const *target) const
float GetTransOffsetX() const
ZoneScript * GetZoneScript() 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
void DestroyForNearbyPlayers()
Transport * GetTransport() 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)
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
MovementInfo m_movementInfo
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
float GetDistanceZ(WorldObject const *obj) const
bool IsFriendlyTo(WorldObject const *target) const
bool IsInMap(WorldObject const *obj) const
WorldPacket const * Write() override
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
virtual void OnCreatureRemove(Creature *)
virtual void OnCreatureCreate(Creature *)
@ CONFIG_CORPSE_DECAY_ELITE
@ CONFIG_NO_GRAY_AGGRO_BELOW
@ CONFIG_CREATURE_PICKPOCKET_REFILL
@ CONFIG_RESPAWN_DYNAMICMODE
@ CONFIG_MAX_PLAYER_LEVEL
@ CONFIG_CORPSE_DECAY_NORMAL
@ CONFIG_CORPSE_DECAY_WORLDBOSS
@ CONFIG_NO_GRAY_AGGRO_ABOVE
@ CONFIG_CREATURE_STOP_FOR_PLAYER
@ CONFIG_CORPSE_DECAY_RARE
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
@ CONFIG_CORPSE_DECAY_RAREELITE
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
@ RATE_CREATURE_NORMAL_HP
@ RATE_CREATURE_NORMAL_DAMAGE
@ RATE_CREATURE_ELITE_RARE_DAMAGE
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
@ RATE_CREATURE_ELITE_ELITE_HP
@ RATE_CREATURE_ELITE_RARE_HP
@ RATE_CORPSE_DECAY_LOOTED
@ RATE_CREATURE_ELITE_RAREELITE_HP
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
ObjectData const 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)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level)
bool IsValidMapCoord(float c)
GridCoord ComputeGridCoord(float x, float y)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
CharmSpellInfo * GetCharmSpell(uint8 index)
std::vector< uint32 > auras
VisibilityDistanceType visibilityDistanceType
static CreatureBaseStats const * GetBaseStats(uint8 level, uint8 unitClass)
float GenerateBaseDamage(CreatureTemplate const *info) const
uint32 GenerateMana(CreatureTemplate const *info) const
uint32 GenerateHealth(CreatureTemplate const *info) const
uint32 GenerateArmor(CreatureTemplate const *info) const
std::vector< std::string > Name
CreatureRandomMovementType Random
bool IsSwimAllowed() const
CreatureFlightMovementType Flight
bool IsFlightAllowed() const
std::string ToString() const
CreatureChaseMovementType Chase
CreatureGroundMovementType Ground
uint32 InteractionPauseTimer
void InitializeQueryData()
uint32 GetFirstValidModelId() const
uint32 spells[MAX_CREATURE_SPELLS]
int32 resistance[MAX_SPELL_SCHOOL]
uint32 GetFirstVisibleModel() const
CreatureMovementData Movement
uint32 KillCredit[MAX_KILL_CREDIT]
uint32 GetFirstInvisibleModel() const
WorldPacket QueryData[TOTAL_LOCALES]
WorldPacket BuildQueryData(LocaleConstant loc) const
uint32 DifficultyEntry[MAX_DIFFICULTY - 1]
uint32 GetRandomValidModelId() const
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
struct GameObjectTemplate::@191::@206 moTransport
bool HasFlag(ItemFlags flag) const
struct MovementInfo::TransportInfo transport
std::string ToString() const
float GetPositionZ() const
bool IsInDist2d(float x, float y, float dist) const
float GetOrientation() const
bool IsInDist(float x, float y, float z, float dist) const
bool IsPositionValid() const
void SetOrientation(float orientation)
Position GetPosition() const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const
void Relocate(float x, float y)
ObjectGuid::LowType spawnId
ActiveStates GetType() const
VendorItemCount(uint32 _item, uint32 _count)
std::vector< VendorItem > m_items
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost) const
bool RemoveItem(uint32 item_id)
bool IsGoldRequired(ItemTemplate const *pProto) const
uint32 QuestItems[MAX_CREATURE_QUEST_ITEMS]
uint32 CreatureMovementInfoID
uint32 ProxyCreatureID[MAX_KILL_CREDIT]
uint32 CreatureDisplayID[MAX_CREATURE_MODELS]