27#include "G3DPosition.hpp"
52#include <G3D/Vector3.h>
83 TC_LOG_FATAL(
"misc",
"Object::~Object {} deleted but still in world!!",
GetGUID().ToString());
91 TC_LOG_FATAL(
"misc",
"Object::~Object {} deleted but still in update list!!",
GetGUID().ToString());
176 if (unit->GetVictim())
183 buf <<
uint8(updateType);
231 data <<
uint8(onDeath ? 1 : 0);
281 Unit const* unit =
nullptr;
339 *data <<
object->GetOrientation();
382 *data <<
uint32(0x0000000B);
386 *data <<
uint32(0x0000002F);
388 *data <<
uint32(0x00000008);
391 *data <<
uint32(0x00000000);
401 *data << victim->GetPackGUID();
462 data->
append(fieldBuffer);
486 UpdateDataMapType::iterator iter = data_map.try_emplace(player).first;
502 if (((
Item const*)
this)->GetOwnerGUID() == target->
GetGUID())
550 if (tokens.size() != count)
553 for (
uint32 index = 0; index < count; ++index)
723 cur += (apply ? val : -val);
732 cur += (apply ? val : -val);
739 cur += (apply ? val : -val);
748 cur += (apply ? val : -val);
755 cur += (apply ? val : -val);
765 uint32 newval = oldval | newFlag;
767 if (oldval != newval)
781 uint32 newval = oldval & ~oldFlag;
783 if (oldval != newval)
862 uint64 newval = oldval | newFlag;
869 uint64 newval = oldval & ~oldFlag;
902 std::stringstream sstr;
938m_movementInfo(), m_name(), m_isActive(false), m_isFarVisible(false), m_isStoredInWorldObjectGridContainer(isWorldObject), m_zoneScript(nullptr),
953 TC_LOG_FATAL(
"misc",
"WorldObject::~WorldObject Corpse Type: {} ({}) deleted but still in map!!",
1038 transport->RemovePassenger(
this);
1054 if (area->ParentAreaID)
1098 float dist = dz - sizefactor;
1099 return (dist > 0 ? dist : 0);
1104 float sizefactor = 0;
1107 float maxdist = dist2compare + sizefactor;
1109 Position const* thisOrTransport =
this;
1110 Position const* objOrObjTransport = obj;
1119 return thisOrTransport->
IsInDist(objOrObjTransport, maxdist);
1121 return thisOrTransport->
IsInDist2d(objOrObjTransport, maxdist);
1127 return d > 0.0f ? d : 0.0f;
1133 return d > 0.0f ? d : 0.0f;
1139 return d > 0.0f ? d : 0.0f;
1145 return d > 0.0f ? d : 0.0f;
1151 return d > 0.0f ? d : 0.0f;
1265 float distsq1 = dx1*dx1 + dy1*dy1;
1274 float distsq2 = dx2*dx2 + dy2*dy2;
1281 return distsq1 < distsq2;
1288 float distsq = dx*dx + dy*dy;
1298 if (minRange > 0.0f)
1300 float mindist = minRange + sizefactor;
1301 if (distsq < mindist * mindist)
1305 float maxdist = maxRange + sizefactor;
1306 return distsq < maxdist * maxdist;
1313 float distsq = dx*dx + dy*dy;
1318 if (minRange > 0.0f)
1320 float mindist = minRange + sizefactor;
1321 if (distsq < mindist * mindist)
1325 float maxdist = maxRange + sizefactor;
1326 return distsq < maxdist * maxdist;
1334 float distsq = dx*dx + dy*dy + dz*dz;
1339 if (minRange > 0.0f)
1341 float mindist = minRange + sizefactor;
1342 if (distsq < mindist * mindist)
1346 float maxdist = maxRange + sizefactor;
1347 return distsq < maxdist * maxdist;
1386 float angle = (float)
rand_norm()*
static_cast<float>(2*
M_PI);
1388 new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist);
1390 rand_x = pos.
m_positionX + new_dist * std::cos(angle);
1391 rand_y = pos.
m_positionY + new_dist * std::sin(angle);
1432 bool canSwim = unit->
CanSwim();
1444 max_z += hoverOffset;
1445 ground_z += hoverOffset;
1449 else if (z < ground_z)
1454 *groundZ = ground_z;
1463 *groundZ = ground_z;
1473 *groundZ = ground_z;
1488 return thisCreature->m_SightDistance;
1513 else if (
ToPlayer()->GetCinematicMgr()->IsOnCinematic())
1562 bool corpseVisibility =
false;
1565 bool corpseCheck =
false;
1568 if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 &&
1571 if (
Corpse* corpse = thisPlayer->GetCorpse())
1574 if (corpse->IsWithinDist(thisPlayer,
GetSightRange(obj),
false))
1576 corpseVisibility =
true;
1584 if (!thisPlayer->HaveAtClient(vehicle))
1591 viewpoint = player->GetViewpoint();
1618 if (thisPlayer->GetTeam() != objPlayer->GetTeam() || !thisPlayer->IsGroupVisibleFor(objPlayer))
1631 if (!
CanDetect(obj, implicitDetect, checkAlert))
1650 if (thisUnit->isPossessing())
1688 if (!(mask & (1 << i)))
1695 if (ownInvisibilityDetectValue < objInvisibilityValue)
1712 float combatReach = 0.0f;
1718 if (distance < combatReach)
1740 int32 detectionValue = 30;
1751 detectionValue -=
int32(owner->GetLevelForTarget(
this) - 1) * 5;
1756 float visibilityRange = float(detectionValue) * 0.3f + combatReach;
1764 visibilityRange += (visibilityRange * 0.08f) + 1.5f;
1771 if (distance > visibilityRange)
1873 switch (properties->
Title)
1892 if (properties->
Flags & 512)
1907 Unit* summonerUnit = summoner ? summoner->
ToUnit() :
nullptr;
1913 summon =
new TempSummon(properties, summoner,
false);
1916 summon =
new Guardian(properties, summonerUnit,
false);
1919 summon =
new Puppet(properties, summonerUnit);
1922 summon =
new Totem(properties, summonerUnit);
1925 summon =
new Minion(properties, summonerUnit,
false);
1929 if (!summon->
Create(GenerateLowGuid<HighGuid::Unit>(),
this, phase, entry, pos,
nullptr, vehId,
true))
1966 for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
1969 list->push_back(summon);
1978 else if (!map->IsBattlegroundOrArena())
1997 if (
TempSummon* summon = map->
SummonCreature(entry, pos,
nullptr, despawnTime.count(),
this, spellId, vehId, privateObjectOwner))
2013 return SummonCreature(
id, { x,y,z,o }, despawnType, despawnTime, 0, 0, privateObjectOwner);
2024 TC_LOG_ERROR(
"sql.sql",
"Gameobject template {} not found in database!", entry);
2094 for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
2097 list->push_back(summon);
2164 Player* target =
nullptr;
2235 return owner->ToPlayer();
2242 return owner->ToPlayer();
2251 return spellEffectInfo.
CalcValue(
this, basePoints);
2305 uint8 comboPoints = 0;
2313 if (comboPoints && minduration != -1 && minduration != maxduration)
2314 duration = minduration +
int32((maxduration - minduration) * comboPoints / 5);
2316 duration = minduration;
2339 auto mechanicCheck = [mechanicMask](
AuraEffect const* aurEff) ->
bool
2341 if (mechanicMask & (1 << aurEff->GetMiscValue()))
2352 int32 durationMod = std::min(durationMod_always, durationMod_not_stack);
2353 if (durationMod != 0)
2354 AddPct(duration, durationMod);
2360 durationMod = std::min(durationMod_always, durationMod_not_stack);
2361 if (durationMod != 0)
2362 AddPct(duration, durationMod);
2383 if (unitTarget ==
this)
2412 return std::max(duration, 0);
2417 if (!spellInfo || castTime < 0)
2439 if (!spellInfo || duration < 0)
2484 thisLevel = std::max<int32>(thisLevel, spellInfo->
SpellLevel);
2490 modHitChance = 96 - leveldif;
2492 modHitChance = 94 - (leveldif - 2) * lchance;
2512 int32 HitChance = modHitChance * 100;
2519 int32 tmp = 10000 - HitChance;
2522 if (tmp > 0 && rand < tmp)
2531 bool hasAura =
false;
2534 if (spellEffectInfo.IsAura())
2550 if (resist_chance > 0 && rand < (tmp += resist_chance))
2557 if (deflect_chance > 0 && rand < (tmp += deflect_chance))
2630 data <<
uint8(missInfo);
2647 TC_LOG_ERROR(
"entities.unit",
"Creature (template id: {}) has invalid faction (faction template Id) #{}",
ToCreature()->GetCreatureTemplate()->
Entry, factionId);
2651 TC_LOG_ERROR(
"entities.faction",
"GameObject (template id: {}) has invalid faction (faction template Id) #{}",
ToGameObject()->GetGOInfo()->entry, factionId);
2677 if (selfPlayerOwner)
2683 else if (targetPlayerOwner)
2690 Unit const* unit = Coalesce<const Unit>(
ToUnit(), selfPlayerOwner);
2691 Unit const* targetUnit = Coalesce<const Unit>(target->
ToUnit(), targetPlayerOwner);
2696 if (selfPlayerOwner && targetPlayerOwner)
2699 if (selfPlayerOwner == targetPlayerOwner)
2717 if (selfPlayerOwner)
2727 if (targetFactionEntry->CanHaveReputation())
2753 if (!factionTemplateEntry)
2757 if (!targetFactionTemplateEntry)
2766 if (
ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
2772 if (factionEntry->CanHaveReputation())
2775 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
2776 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
2785 if (factionTemplateEntry->
IsHostileTo(*targetFactionTemplateEntry))
2787 if (factionTemplateEntry->
IsFriendlyTo(*targetFactionTemplateEntry))
2789 if (targetFactionTemplateEntry->
IsFriendlyTo(*factionTemplateEntry))
2862 bool isPositiveSpell = bySpell && bySpell->
IsPositive();
2865 if (!bySpell &&
this == target)
2907 Unit const* unitOrOwner = unit;
2950 if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget))
2952 Player const* player = playerAffectingAttacker ? playerAffectingAttacker : playerAffectingTarget;
2954 if (
Unit const* creature = playerAffectingAttacker ? unitTarget : unit)
2975 if (playerAffectingAttacker && playerAffectingTarget)
2976 if (playerAffectingAttacker->
duel && playerAffectingAttacker->
duel->Opponent == playerAffectingTarget && playerAffectingAttacker->
duel->State ==
DUEL_STATE_IN_PROGRESS)
2985 if (playerAffectingAttacker && playerAffectingTarget)
2987 if (playerAffectingTarget->
IsPvP())
2990 if (playerAffectingAttacker->
IsFFAPvP() && playerAffectingTarget->
IsFFAPvP())
3006 bool isNegativeSpell = bySpell && !bySpell->
IsPositive();
3023 if (unit && unitTarget && unit->
GetVehicle())
3073 if (selfPlayerOwner && targetPlayerOwner)
3076 if (selfPlayerOwner != targetPlayerOwner && targetPlayerOwner->
duel)
3084 if (unitTarget->
IsPvP())
3094 if (unitTarget && !unitTarget->
IsPvP())
3111 if (
Unit* magnet = aurEff->GetBase()->GetCaster())
3116 if (spellInfo->
Speed > 0.0f)
3133template <
typename Container>
3141template <
typename Container>
3153template <
typename Container>
3161template <
typename Container>
3173template <
typename Container>
3189 if (
this != searcher)
3191 float myHover = 0.0f, searcherHover = 0.0f;
3194 if (
Unit const* searchUnit = searcher->
ToUnit())
3195 searcherHover = searchUnit->GetHoverOffset();
3197 float hoverDelta = myHover - searcherHover;
3198 if (hoverDelta != 0.0f)
3199 effectiveReach = std::sqrt(std::max(effectiveReach * effectiveReach - hoverDelta * hoverDelta, 0.0f));
3203 x =
GetPositionX() + (effectiveReach + distance2d) * std::cos(absAngle);
3204 y =
GetPositionY() + (effectiveReach + distance2d) * std::sin(absAngle);
3230 for (
float angle =
float(
M_PI) / 8; angle < float(
M_PI) * 2; angle += float(
M_PI) / 8)
3281 float destx, desty, destz, ground, floor;
3288 TC_LOG_FATAL(
"misc",
"WorldObject::MovePosition: Object {} has invalid coordinates X: {} and Y: {} were passed!",
3297 float step = dist/10.0f;
3299 for (
uint8 j = 0; j < 10; ++j)
3304 destx -= step * std::cos(angle);
3305 desty -= step * std::sin(angle);
3327 float cosAngle = std::cos(angle);
3328 float sinAngle = std::sin(angle);
3329 float destx, desty, destz;
3337 TC_LOG_FATAL(
"misc",
"WorldObject::MovePositionToFirstCollision invalid coordinates Src: {}, dist {}, angle {}, destX: {} destY: {} were passed!",
3338 pos.
ToString(), dist, angle, destx, desty);
3353 G3D::Vector3
const& result = path.
GetPath().back();
3364 destx, desty, destz + halfHeight,
3365 destx, desty, destz, -0.5f);
3367 destz -= halfHeight;
3380 destx, desty, destz + halfHeight,
3381 destx, desty, destz, -0.5f);
3383 destz -= halfHeight;
3453 std::list<Player*> targets;
3457 for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
3459 Player* player = (*iter);
3496 Player* source =
nullptr;
3499 source = iter->GetSource();
3517 source = iter->GetSource();
3532 source = iter->GetSource();
3594 bool swimming = [&]()
3615 std::stringstream sstr;
@ FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT
@ FACTION_TEMPLATE_FLAG_CONTESTED_GUARD
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define VMAP_INVALID_HEIGHT_VALUE
#define VMAP_INVALID_HEIGHT
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_FATAL(filterType__,...)
uint32 PAIR64_LOPART(uint64 x)
#define MAX_VISIBILITY_DISTANCE
#define DEFAULT_VISIBILITY_DISTANCE
#define VISIBILITY_DISTANCE_LARGE
@ TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN
#define VISIBILITY_DISTANCE_TINY
@ GO_SUMMON_TIMED_OR_CORPSE_DESPAWN
#define DEFAULT_VISIBILITY_INSTANCE
#define VISIBILITY_DISTANCE_GIGANTIC
uint32 PAIR64_HIPART(uint64 x)
#define VISIBILITY_DISTANCE_SMALL
std::set< ObjectGuid > GuidSet
@ SUMMONER_TYPE_GAMEOBJECT
constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max)]
static constexpr Milliseconds const HEARTBEAT_INTERVAL
std::unordered_map< Player *, UpdateData > UpdateDataMapType
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ PATHFIND_NOT_USING_PATH
@ PATHFIND_FARFROMPOLY_START
@ PLAYER_FLAGS_CONTESTED_PVP
int32 irand(int32 min, int32 max)
bool roll_chance_i(int chance)
@ SERVERSIDE_VISIBILITY_GM
@ SERVERSIDE_VISIBILITY_GHOST
@ SPELL_ATTR7_IGNORE_DURATION_MODS
@ SPELL_ATTR5_HASTE_AFFECT_DURATION
@ SPELL_SCHOOL_MASK_MAGIC
@ SPELL_ATTR2_AUTOREPEAT_FLAG
@ TOTAL_INVISIBILITY_TYPES
@ SPELL_ATTR1_CANT_BE_REDIRECTED
@ UNIT_DYNFLAG_SPECIALINFO
@ SPELL_ATTR3_NO_DONE_BONUS
@ SPELL_ATTR3_IGNORE_HIT_RESULT
@ SPELL_DAMAGE_CLASS_RANGED
@ SPELL_DAMAGE_CLASS_MAGIC
@ SPELL_DAMAGE_CLASS_NONE
@ SPELL_DAMAGE_CLASS_MELEE
@ SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY
constexpr float Z_OFFSET_FIND_HEIGHT
@ SPELL_FAILED_BAD_TARGETS
@ SPELL_FAILED_SPELL_UNAVAILABLE
@ SPELL_ATTR4_IGNORE_RESISTANCES
@ SUMMON_CATEGORY_VEHICLE
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
@ CREATURE_TYPE_FLAG_CAN_ASSIST
@ SPELL_ATTR6_CAN_TARGET_INVISIBLE
@ SPELL_ATTR6_ASSIST_IGNORE_IMMUNE_FLAG
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK
@ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
@ SPELL_AURA_MOD_DEBUFF_RESISTANCE
@ SPELL_AURA_REFLECT_SPELLS
@ SPELL_AURA_IGNORE_HIT_DIRECTION
@ SPELL_AURA_DEFLECT_SPELLS
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
@ SPELL_AURA_MECHANIC_DURATION_MOD
@ SPELL_AURA_DETECT_STEALTH
@ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
@ SPELL_AURA_SPELL_MAGNET
@ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
@ SPELL_AURA_MOD_AOE_AVOIDANCE
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
@ SPELLMOD_RESIST_MISS_CHANCE
@ SPELL_ATTR0_CU_BINARY_SPELL
@ SPELL_GROUP_ELIXIR_BATTLE
@ SPELL_GROUP_ELIXIR_GUARDIAN
@ UNIT_FLAG2_IGNORE_REPUTATION
@ MOVEMENTFLAG_SPLINE_ENABLED
@ MOVEMENTFLAG_ONTRANSPORT
@ MOVEMENTFLAG_SPLINE_ELEVATION
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_NON_ATTACKABLE_2
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_FLAG_NOT_ATTACKABLE_1
@ UNIT_FLAG_PLAYER_CONTROLLED
#define MAX_PLAYER_STEALTH_DETECT_RANGE
@ UNIT_STATE_UNATTACKABLE
@ UPDATETYPE_CREATE_OBJECT
@ UPDATETYPE_CREATE_OBJECT2
@ UPDATEFLAG_STATIONARY_POSITION
uint32 UnitUpdateFieldFlags[PLAYER_END]
uint32 CorpseUpdateFieldFlags[CORPSE_END]
uint32 ItemUpdateFieldFlags[CONTAINER_END]
uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END]
uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END]
T RoundToInterval(T &num, T floor, T ceil)
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
void SetHomePosition(float x, float y, float z, float o)
float GetAttackDistance(Unit const *player) const
bool IsEvadingAttacks() const
bool AIM_Initialize(CreatureAI *ai=nullptr)
CreatureTemplate const * GetCreatureTemplate() 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)
ObjectGuid GetCasterGUID() const
void KillAllEvents(bool force)
void Update(uint32 p_time)
T_VALUES GetValue(FLAG_TYPE flag) const
void SetValue(FLAG_TYPE flag, T_VALUES value)
GameObjectValue const * GetGOValue() const
void SetRespawnTime(int32 respawn)
void SetSpawnedByDefault(bool b)
GameobjectTypes GetGoType() const
Transport * ToTransport()
bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, Position const &pos, QuaternionData const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0, bool dynamic=false, ObjectGuid::LowType spawnid=0)
void AddObjectToRemoveList(WorldObject *obj)
void RemoveFromActive(WorldObject *obj)
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
void RemoveUpdateObject(Object *obj)
void AddWorldObject(WorldObject *obj)
ObjectGuid::LowType GenerateLowGuid()
float GetGridHeight(float x, float y) const
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, PositionFullTerrainStatus &data, Optional< uint8 > reqLiquidType={}, float collisionHeight=2.03128f) const
void RemoveWorldObject(WorldObject *obj)
float GetVisibilityRange() const
void GetZoneAndAreaId(uint32 phaseMask, uint32 &zoneid, uint32 &areaid, float x, float y, float z) const
float GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=2.03128f) const
InstanceMap * ToInstanceMap()
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
uint32 GetInstanceId() const
void AddToActive(WorldObject *obj)
void AddUpdateObject(Object *obj)
void AddObjectToSwitchList(WorldObject *obj, bool on)
static ObjectGuid const Empty
std::string ToString() const
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
void UpdateUInt32Value(uint16 index, uint32 value)
void ToggleFlag64(uint16 index, uint64 flag)
uint8 GetByteValue(uint16 index, uint8 offset) const
void SetByteValue(uint16 index, uint8 offset, uint8 value)
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player const *target) const
static Creature * ToCreature(Object *o)
void BuildMovementUpdateBlock(UpdateData *data, uint32 flags=0) const
int32 GetInt32Value(uint16 index) const
void ApplyModFlag64(uint16 index, uint64 flag, bool apply)
void SetInt32Value(uint16 index, int32 value)
Trinity::unique_trackable_ptr< Object > m_scriptRef
PackedGuid const & GetPackGUID() const
DynamicObject * ToDynObject()
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
static Unit * ToUnit(Object *o)
uint32 GetUInt32Value(uint16 index) const
static GameObject * ToGameObject(Object *o)
uint16 GetUInt16Value(uint16 index, uint8 offset) const
virtual void DestroyForPlayer(Player *target, bool onDeath=false) const
virtual void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, Player const *target) const
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
uint32 GetUpdateFieldData(Player const *target, uint32 *&flags) const
void AddToObjectUpdateIfNeeded()
bool HasDynamicFlag(uint32 flag) const
void ApplyModPositiveFloatValue(uint16 index, float val, bool apply)
bool AddGuidValue(uint16 index, ObjectGuid value)
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
WorldObject * ToWorldObject()
virtual bool AddToObjectUpdate()=0
void ApplyModByteFlag(uint16 index, uint8 offset, uint8 flag, bool apply)
void BuildMovementUpdate(ByteBuffer *data, uint16 flags) const
void SetFlag(uint16 index, uint32 newFlag)
void ApplyModUInt16Value(uint16 index, uint8 offset, int16 val, bool apply)
void RemoveFlag(uint16 index, uint32 oldFlag)
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
float GetFloatValue(uint16 index) const
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
void ClearUpdateMask(bool remove)
void SetGuidValue(uint16 index, ObjectGuid value)
GameObject * ToGameObject()
void SetFlag64(uint16 index, uint64 newFlag)
bool _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
uint64 GetUInt64Value(uint16 index) const
bool PrintIndexError(uint32 index, bool set) const
virtual std::string GetDebugInfo() const
void _Create(ObjectGuid const &guid)
void RemoveFlag64(uint16 index, uint64 oldFlag)
void SetFloatValue(uint16 index, float value)
bool RemoveGuidValue(uint16 index, ObjectGuid value)
void SetStatFloatValue(uint16 index, float value)
virtual void RemoveFromObjectUpdate()=0
virtual void AddToWorld()
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
bool HasFlag(uint16 index, uint32 flag) const
virtual void RemoveFromWorld()
static ObjectGuid GetGUID(Object const *o)
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
void SendUpdateToPlayer(Player *player)
void SetUInt32Value(uint16 index, uint32 value)
ObjectGuid GetGUID() const
void ToggleFlag(uint16 index, uint32 flag)
bool HasFlag64(uint16 index, uint64 flag) const
void SetStatInt32Value(uint16 index, int32 value)
void SetUInt64Value(uint16 index, uint64 value)
static Player * ToPlayer(Object *o)
ObjectGuid GetGuidValue(uint16 index) const
void ToggleByteFlag(uint16 index, uint8 offset, uint8 flag)
void ForceValuesUpdateAtIndex(uint32)
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
void Set(ObjectGuid const &guid)
void SetUseRaycast(bool useRaycast)
Movement::PointsArray const & GetPath() const
PathType GetPathType() const
bool CalculatePath(float destX, float destY, float destZ, bool forceDest=false)
bool HaveAtClient(Object const *u) const
bool IsInSameRaidWith(Player const *p) const
void SendDirectMessage(WorldPacket const *data) const
float GetRatingBonusValue(CombatRating cr) const
GuidUnorderedSet m_clientGUIDs
bool IsGameMaster() const
std::unique_ptr< DuelInfo > duel
ReputationMgr & GetReputationMgr()
FactionState const * GetState(FactionEntry const *factionEntry) const
bool IsAtWar(uint32 faction_id) const
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
SpellRangeEntry const * RangeEntry
bool HasOnlyDamageEffects() const
float GetMinRange(bool positive=false) const
int32 GetMaxDuration() const
std::array< uint32, 2 > SpellVisual
uint32 GetSpellMechanicMaskByEffectMask(uint32 effectMask) const
bool IsAllowingDeadTarget() const
SpellSchoolMask GetSchoolMask() const
bool HasAttribute(SpellAttr0 attribute) const
int32 GetDuration() const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
SpellCastResult CheckExplicitTarget(WorldObject const *caster, WorldObject const *target, Item const *itemTarget=nullptr) const
bool IsAffectingArea() const
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > const & GetEffects() const
void SetSpellValue(SpellValueMod mod, int32 value)
SpellCastResult prepare(SpellCastTargets const &targets, AuraEffect const *triggeredByAura=nullptr)
virtual void InitSummon()
void SetTempSummonType(TempSummonType type)
virtual void InitStats(uint32 lifetime)
Unit * GetCharmed() const
Vehicle * GetVehicle() const
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
bool HasPvpFlag(UnitPVPStateFlags flags) const
Movement::MoveSpline * movespline
float GetSpeed(UnitMoveType mtype) const
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
void SetFaction(uint32 faction) override
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
virtual bool CanFly() const =0
Unit * GetVehicleBase() const
bool HasUnitFlag(UnitFlags flags) const
void SetCreatedBySpell(int32 spellId)
bool CanInstantCast() const
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
int32 GetMaxNegativeAuraModifier(AuraType auraType) const
bool HasUnitFlag2(UnitFlags2 flags) const
bool IsInSanctuary() const
float GetCombatReach() const override
int32 GetMechanicResistChance(SpellInfo const *spellInfo) const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
virtual bool HasSpell(uint32) const
int32 GetTotalAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask) const
bool IsOnVehicle(Unit const *vehicle) const
bool IsImmuneToNPC() const
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
bool IsDuringRemoveFromWorld() const
Unit * GetCharmerOrOwner() const
void AddGameObject(GameObject *gameObj)
static float CalculateAverageResistReduction(WorldObject const *caster, SpellSchoolMask schoolMask, Unit const *victim, SpellInfo const *spellInfo=nullptr)
float GetHoverOffset() const
SharedVisionList const & GetSharedVisionList()
bool HasUnitMovementFlag(uint32 f) const
bool HasAuraType(AuraType auraType) const
uint8 GetLevelForTarget(WorldObject const *) const override
int32 GetTotalAuraModifier(AuraType auraType) const
void BuildMovementPacket(ByteBuffer *data) const
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
bool HasUnitState(const uint32 f) const
bool IsInRaidWith(Unit const *unit) const
void SetLevel(uint8 lvl, bool sendUpdate=true)
virtual bool CanSwim() const
uint8 GetComboPoints(Unit const *who=nullptr) const
--------—Combo point system----------------—
int32 GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
float m_modAttackSpeedPct[MAX_ATTACK]
ObjectGuid GetCharmerGUID() const
std::list< AuraEffect * > AuraEffectList
Vehicle * GetVehicleKit() const
float m_modSpellHitChance
bool IsImmuneToPC() const
void AddOutOfRangeGUID(GuidSet &guids)
bool BuildPacket(WorldPacket *packet)
void AppendToPacket(ByteBuffer *data)
bool GetBit(uint32 index) const
void SetCount(uint32 valuesCount)
void SetBit(uint32 index)
static VMapManager2 * createOrGetVMapManager()
bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist) override
VehicleEntry const * GetVehicleInfo() const
std::string GetDebugInfo() const
Unit * GetMagicHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo)
ZLiquidStatus m_liquidStatus
void GetPlayerListInGrid(Container &playerContainer, float maxSearchRange, bool alive=true) const
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
uint32 GetPhaseMask() const
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const
bool IsWithinDist2d(float x, float y, float dist) const
bool IsWithinDist3d(float x, float y, float z, float dist) const
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
bool CanDetect(WorldObject const *obj, bool ignoreStealth, bool checkAlert=false) const
void GetGameObjectListWithOptionsInGrid(Container &gameObjectContainer, float maxSearchRange, FindGameObjectOptions const &options) const
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
void AddToWorld() override
virtual float GetCollisionHeight() const
Unit * GetCharmerOrOwner() const
void RemoveFromWorld() override
virtual float GetStationaryO() const
Player * SelectNearestPlayer(float distance) const
InstanceScript * GetInstanceScript() const
virtual uint8 GetLevelForTarget(WorldObject const *) const
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Unit * GetCharmerOrOwnerOrSelf() const
bool CheckPrivateObjectOwnerVisibility(WorldObject const *seer) const
bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
bool IsInRange2d(float x, float y, float minRange, float maxRange) const
void BuildUpdate(UpdateDataMapType &) override
virtual SpellMissInfo MeleeSpellHitResult(Unit *victim, SpellInfo const *spellInfo) const
Position GetHitSpherePointFor(Position const &dest) const
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
ObjectGuid GetPrivateObjectOwner() const
virtual bool IsInvisibleDueToDespawn() const
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
float GetGridActivationRange() const
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
void GetGameObjectListWithEntryInGrid(Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
float GetMapWaterOrGroundLevel(float x, float y, float z, float *ground=nullptr) const
std::string GetDebugInfo() const override
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
bool IsHostileToPlayers() const
bool IsHostileTo(WorldObject const *target) const
bool IsVisibilityOverridden() const
virtual ObjectGuid GetCharmerOrOwnerGUID() const
float GetTransOffsetX() const
void MovePositionToFirstCollision(Position &pos, float dist, float angle)
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
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)
bool isActiveObject() const
bool IsSelfOrInSameMap(WorldObject const *obj) const
bool GetDistanceOrder(WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
bool IsPrivateObject() const
bool isInFront(WorldObject const *target, float arc=float(M_PI)) const
void setActive(bool isActiveObject)
void SetPrivateObjectOwner(ObjectGuid const &owner)
bool CanSeeOrDetect(WorldObject const *obj, bool implicitDetect=false, bool distanceCheck=false, bool checkAlert=false) const
Position GetNearPosition(float dist, float angle)
float GetDistance2d(WorldObject const *obj) const
Creature * SummonTrigger(float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI *(*GetAI)(Creature *)=nullptr)
ZoneScript * m_zoneScript
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const
Position GetRandomNearPosition(float radius)
int32 ModSpellDuration(SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
float GetTransOffsetY() const
bool InSamePhase(uint32 phasemask) const
float GetSightRange(WorldObject const *target=nullptr) const
static ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
std::string const & GetName() const
virtual void SetMap(Map *map)
bool IsFarVisible() const
void SetFarVisible(bool on)
virtual float GetStationaryX() const
float GetTransOffsetZ() const
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
bool IsInBetween(Position const &pos1, Position const &pos2, float size=0) const
void AddObjectToRemoveList()
void GetNearPoint2D(WorldObject const *searcher, float &x, float &y, float distance, float absAngle) const
void PlayDirectMusic(uint32 musicId, Player *target=nullptr)
int32 CalcSpellDuration(SpellInfo const *spellInfo) const
virtual bool IsNeverVisible(bool allowServersideObjects) const
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
WorldObject(bool isWorldObject)
bool CanDetectStealthOf(WorldObject const *obj, bool checkAlert=false) const
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
SpellMissInfo MagicSpellHitResult(Unit *victim, SpellInfo const *spellInfo) const
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
bool CanDetectInvisibilityOf(WorldObject const *obj) const
virtual ObjectGuid GetTransGUID() const
GameObject * FindNearestGameObjectWithOptions(float range, FindGameObjectOptions const &options) const
bool const m_isStoredInWorldObjectGridContainer
void DestroyForNearbyPlayers()
Transport * GetTransport() const
float ApplyEffectModifiers(SpellInfo const *spellInfo, uint8 effIndex, float value) const
GameObject * FindNearestUnspawnedGameObject(uint32 entry, float range) const
bool isInBack(WorldObject const *target, float arc=float(M_PI)) const
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
bool IsNeutralToAll() const
void UpdatePositionData()
void UpdateGroundPositionZ(float x, float y, float &z) const
bool IsStoredInWorldObjectGridContainer() const
Player * GetSpellModOwner() const
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
ReputationRank GetReactionTo(WorldObject const *target) const
void SetIsStoredInWorldObjectGridContainer(bool apply)
bool IsInWorldPvpZone() const
void SendObjectDeSpawnAnim(ObjectGuid guid)
bool IsValidAssistTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
bool IsInRange(WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
virtual bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D, bool incOwnRadius=true, bool incTargetRadius=true) const
float GetVisibilityRange() const
virtual float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
float GetSpellMinRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
void PlayDirectSound(uint32 soundId, Player *target=nullptr)
virtual uint32 GetFaction() const =0
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
float GetDistance(WorldObject const *obj) const
Optional< float > m_visibilityDistanceOverride
ObjectGuid _privateObjectOwner
void PlayDistanceSound(uint32 soundId, Player *target=nullptr)
float GetTransOffsetO() const
virtual ObjectGuid GetOwnerGUID() const =0
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
bool CanNeverSee(WorldObject const *obj) const
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
virtual void SendMessageToSetInRange(WorldPacket const *data, float dist, bool self) const
Position GetFirstCollisionPosition(float dist, float angle)
Milliseconds _heartbeatTimer
MovementInfo m_movementInfo
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
float GetDistanceZ(WorldObject const *obj) const
void GetCreatureListWithOptionsInGrid(Container &creatureContainer, float maxSearchRange, FindCreatureOptions const &options) const
float GetSpellMaxRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
virtual float GetStationaryY() const
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
void ModSpellCastTime(SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
bool IsFriendlyTo(WorldObject const *target) const
virtual float GetCombatReach() const
virtual float GetStationaryZ() const
Player * GetAffectingPlayer() const
virtual bool CanAlwaysSee(WorldObject const *) const
bool IsInMap(WorldObject const *obj) const
virtual void Update(uint32 diff)
void MovePosition(Position &pos, float dist, float angle)
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
FactionTemplateEntry const * GetFactionTemplateEntry() const
bool AddToObjectUpdate() override
int32 CalculateSpellDamage(SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr) const
virtual void UpdateObjectVisibility(bool forced=true)
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
void RemoveFromObjectUpdate() override
void ModSpellDurationTime(SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const &moveSpline, ByteBuffer &data)
@ SMSG_GAMEOBJECT_DESPAWN_ANIM
@ CONFIG_DETECT_POS_COLLISION
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
bool IsValidMapCoord(float c)
void NormalizeMapCoord(float &c)
Optional< SpellCastTargets > Targets
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)
bool IsHostileTo(FactionTemplateEntry const &entry) const
bool IsHostileToPlayers() const
bool IsNeutralToAll() const
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
struct MovementInfo::JumpInfo jump
struct MovementInfo::TransportInfo transport
uint32 GetMovementFlags() const
ZLiquidStatus liquidStatus
float GetExactDist2dSq(const float x, const float y) const
float GetExactDist2d(const float x, const float y) const
std::string ToString() const
float GetExactDist(float x, float y, float z) 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 HasInArc(float arcangle, Position const *pos, float border=2.0f) const
float GetAbsoluteAngle(float x, float y) 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)
UpdateDataMapType & i_updateDatas
WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d)
void Visit(GridRefManager< SKIP > &)
void Visit(PlayerMapType &m)
void Visit(DynamicObjectMapType &m)
void BuildPacket(Player *player)
void Visit(CreatureMapType &m)
struct GameObjectValue::@187 Transport