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());
120 std::ostringstream ss;
121 for (
uint16 index = 0; index < size; ++index)
184 if (unit->GetVictim())
191 buf <<
uint8(updateType);
239 data <<
uint8(onDeath ? 1 : 0);
289 Unit const* unit =
nullptr;
347 *data <<
object->GetOrientation();
390 *data <<
uint32(0x0000000B);
394 *data <<
uint32(0x0000002F);
396 *data <<
uint32(0x00000008);
399 *data <<
uint32(0x00000000);
409 *data << victim->GetPackGUID();
470 data->
append(fieldBuffer);
494 UpdateDataMapType::iterator iter = data_map.try_emplace(player).first;
510 if (((
Item const*)
this)->GetOwnerGUID() == target->
GetGUID())
558 if (tokens.size() != count)
561 for (
uint32 index = 0; index < count; ++index)
731 cur += (apply ? val : -val);
740 cur += (apply ? val : -val);
747 cur += (apply ? val : -val);
754 cur += (apply ? val : -val);
764 uint32 newval = oldval | newFlag;
766 if (oldval != newval)
780 uint32 newval = oldval & ~oldFlag;
782 if (oldval != newval)
861 uint64 newval = oldval | newFlag;
868 uint64 newval = oldval & ~oldFlag;
901 std::stringstream sstr;
937m_movementInfo(), m_name(), m_isActive(false), m_isFarVisible(false), m_isStoredInWorldObjectGridContainer(isWorldObject), m_zoneScript(nullptr),
952 TC_LOG_FATAL(
"misc",
"WorldObject::~WorldObject Corpse Type: {} ({}) deleted but still in map!!",
1037 transport->RemovePassenger(
this);
1053 if (area->ParentAreaID)
1097 float dist = dz - sizefactor;
1098 return (dist > 0 ? dist : 0);
1103 float sizefactor = 0;
1106 float maxdist = dist2compare + sizefactor;
1108 Position const* thisOrTransport =
this;
1109 Position const* objOrObjTransport = obj;
1118 return thisOrTransport->
IsInDist(objOrObjTransport, maxdist);
1120 return thisOrTransport->
IsInDist2d(objOrObjTransport, maxdist);
1126 return d > 0.0f ? d : 0.0f;
1132 return d > 0.0f ? d : 0.0f;
1138 return d > 0.0f ? d : 0.0f;
1144 return d > 0.0f ? d : 0.0f;
1150 return d > 0.0f ? d : 0.0f;
1264 float distsq1 = dx1*dx1 + dy1*dy1;
1273 float distsq2 = dx2*dx2 + dy2*dy2;
1280 return distsq1 < distsq2;
1287 float distsq = dx*dx + dy*dy;
1297 if (minRange > 0.0f)
1299 float mindist = minRange + sizefactor;
1300 if (distsq < mindist * mindist)
1304 float maxdist = maxRange + sizefactor;
1305 return distsq < maxdist * maxdist;
1312 float distsq = dx*dx + dy*dy;
1317 if (minRange > 0.0f)
1319 float mindist = minRange + sizefactor;
1320 if (distsq < mindist * mindist)
1324 float maxdist = maxRange + sizefactor;
1325 return distsq < maxdist * maxdist;
1333 float distsq = dx*dx + dy*dy + dz*dz;
1338 if (minRange > 0.0f)
1340 float mindist = minRange + sizefactor;
1341 if (distsq < mindist * mindist)
1345 float maxdist = maxRange + sizefactor;
1346 return distsq < maxdist * maxdist;
1385 float angle = (float)
rand_norm()*
static_cast<float>(2*
M_PI);
1387 new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist);
1389 rand_x = pos.
m_positionX + new_dist * std::cos(angle);
1390 rand_y = pos.
m_positionY + new_dist * std::sin(angle);
1431 bool canSwim = unit->
CanSwim();
1443 max_z += hoverOffset;
1444 ground_z += hoverOffset;
1448 else if (z < ground_z)
1453 *groundZ = ground_z;
1462 *groundZ = ground_z;
1472 *groundZ = ground_z;
1487 return thisCreature->m_SightDistance;
1512 else if (
ToPlayer()->GetCinematicMgr()->IsOnCinematic())
1561 bool corpseVisibility =
false;
1564 bool corpseCheck =
false;
1567 if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 &&
1570 if (
Corpse* corpse = thisPlayer->GetCorpse())
1573 if (corpse->IsWithinDist(thisPlayer,
GetSightRange(obj),
false))
1575 corpseVisibility =
true;
1583 if (!thisPlayer->HaveAtClient(vehicle))
1590 viewpoint = player->GetViewpoint();
1617 if (thisPlayer->GetTeam() != objPlayer->GetTeam() || !thisPlayer->IsGroupVisibleFor(objPlayer))
1630 if (!
CanDetect(obj, implicitDetect, checkAlert))
1649 if (thisUnit->isPossessing())
1687 if (!(mask & (1 << i)))
1694 if (ownInvisibilityDetectValue < objInvisibilityValue)
1711 float combatReach = 0.0f;
1717 if (distance < combatReach)
1739 int32 detectionValue = 30;
1750 detectionValue -=
int32(owner->GetLevelForTarget(
this) - 1) * 5;
1755 float visibilityRange = float(detectionValue) * 0.3f + combatReach;
1763 visibilityRange += (visibilityRange * 0.08f) + 1.5f;
1770 if (distance > visibilityRange)
1872 switch (properties->
Title)
1891 if (properties->
Flags & 512)
1906 Unit* summonerUnit = summoner ? summoner->
ToUnit() :
nullptr;
1912 summon =
new TempSummon(properties, summoner,
false);
1915 summon =
new Guardian(properties, summonerUnit,
false);
1918 summon =
new Puppet(properties, summonerUnit);
1921 summon =
new Totem(properties, summonerUnit);
1924 summon =
new Minion(properties, summonerUnit,
false);
1928 if (!summon->
Create(GenerateLowGuid<HighGuid::Unit>(),
this, phase, entry, pos,
nullptr, vehId,
true))
1965 for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
1968 list->push_back(summon);
1977 else if (!map->IsBattlegroundOrArena())
1996 if (
TempSummon* summon = map->
SummonCreature(entry, pos,
nullptr, despawnTime.count(),
this, spellId, vehId, privateObjectOwner))
2012 return SummonCreature(
id, { x,y,z,o }, despawnType, despawnTime, 0, 0, privateObjectOwner);
2023 TC_LOG_ERROR(
"sql.sql",
"Gameobject template {} not found in database!", entry);
2093 for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
2096 list->push_back(summon);
2163 Player* target =
nullptr;
2234 return owner->ToPlayer();
2241 return owner->ToPlayer();
2250 return spellEffectInfo.
CalcValue(
this, basePoints);
2304 uint8 comboPoints = 0;
2312 if (comboPoints && minduration != -1 && minduration != maxduration)
2313 duration = minduration +
int32((maxduration - minduration) * comboPoints / 5);
2315 duration = minduration;
2338 auto mechanicCheck = [mechanicMask](
AuraEffect const* aurEff) ->
bool
2340 if (mechanicMask & (1 << aurEff->GetMiscValue()))
2351 int32 durationMod = std::min(durationMod_always, durationMod_not_stack);
2352 if (durationMod != 0)
2353 AddPct(duration, durationMod);
2359 durationMod = std::min(durationMod_always, durationMod_not_stack);
2360 if (durationMod != 0)
2361 AddPct(duration, durationMod);
2382 if (unitTarget ==
this)
2411 return std::max(duration, 0);
2416 if (!spellInfo || castTime < 0)
2438 if (!spellInfo || duration < 0)
2483 thisLevel = std::max<int32>(thisLevel, spellInfo->
SpellLevel);
2489 modHitChance = 96 - leveldif;
2491 modHitChance = 94 - (leveldif - 2) * lchance;
2511 int32 HitChance = modHitChance * 100;
2518 int32 tmp = 10000 - HitChance;
2521 if (tmp > 0 && rand < tmp)
2530 bool hasAura =
false;
2533 if (spellEffectInfo.IsAura())
2549 if (resist_chance > 0 && rand < (tmp += resist_chance))
2556 if (deflect_chance > 0 && rand < (tmp += deflect_chance))
2629 data <<
uint8(missInfo);
2646 TC_LOG_ERROR(
"entities.unit",
"Creature (template id: {}) has invalid faction (faction template Id) #{}",
ToCreature()->GetCreatureTemplate()->
Entry, factionId);
2650 TC_LOG_ERROR(
"entities.faction",
"GameObject (template id: {}) has invalid faction (faction template Id) #{}",
ToGameObject()->GetGOInfo()->entry, factionId);
2676 if (selfPlayerOwner)
2682 else if (targetPlayerOwner)
2689 Unit const* unit = Coalesce<const Unit>(
ToUnit(), selfPlayerOwner);
2690 Unit const* targetUnit = Coalesce<const Unit>(target->
ToUnit(), targetPlayerOwner);
2695 if (selfPlayerOwner && targetPlayerOwner)
2698 if (selfPlayerOwner == targetPlayerOwner)
2716 if (selfPlayerOwner)
2726 if (targetFactionEntry->CanHaveReputation())
2752 if (!factionTemplateEntry)
2756 if (!targetFactionTemplateEntry)
2765 if (
ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
2771 if (factionEntry->CanHaveReputation())
2774 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
2775 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
2784 if (factionTemplateEntry->
IsHostileTo(*targetFactionTemplateEntry))
2786 if (factionTemplateEntry->
IsFriendlyTo(*targetFactionTemplateEntry))
2788 if (targetFactionTemplateEntry->
IsFriendlyTo(*factionTemplateEntry))
2861 bool isPositiveSpell = bySpell && bySpell->
IsPositive();
2864 if (!bySpell &&
this == target)
2906 Unit const* unitOrOwner = unit;
2949 if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget))
2951 Player const* player = playerAffectingAttacker ? playerAffectingAttacker : playerAffectingTarget;
2953 if (
Unit const* creature = playerAffectingAttacker ? unitTarget : unit)
2974 if (playerAffectingAttacker && playerAffectingTarget)
2975 if (playerAffectingAttacker->
duel && playerAffectingAttacker->
duel->Opponent == playerAffectingTarget && playerAffectingAttacker->
duel->State ==
DUEL_STATE_IN_PROGRESS)
2984 if (playerAffectingAttacker && playerAffectingTarget)
2986 if (playerAffectingTarget->
IsPvP())
2989 if (playerAffectingAttacker->
IsFFAPvP() && playerAffectingTarget->
IsFFAPvP())
3005 bool isNegativeSpell = bySpell && !bySpell->
IsPositive();
3022 if (unit && unitTarget && unit->
GetVehicle())
3072 if (selfPlayerOwner && targetPlayerOwner)
3075 if (selfPlayerOwner != targetPlayerOwner && targetPlayerOwner->
duel)
3083 if (unitTarget->
IsPvP())
3093 if (unitTarget && !unitTarget->
IsPvP())
3110 if (
Unit* magnet = aurEff->GetBase()->GetCaster())
3115 if (spellInfo->
Speed > 0.0f)
3132template <
typename Container>
3140template <
typename Container>
3152template <
typename Container>
3160template <
typename Container>
3172template <
typename Container>
3188 if (
this != searcher)
3190 float myHover = 0.0f, searcherHover = 0.0f;
3193 if (
Unit const* searchUnit = searcher->
ToUnit())
3194 searcherHover = searchUnit->GetHoverOffset();
3196 float hoverDelta = myHover - searcherHover;
3197 if (hoverDelta != 0.0f)
3198 effectiveReach = std::sqrt(std::max(effectiveReach * effectiveReach - hoverDelta * hoverDelta, 0.0f));
3202 x =
GetPositionX() + (effectiveReach + distance2d) * std::cos(absAngle);
3203 y =
GetPositionY() + (effectiveReach + distance2d) * std::sin(absAngle);
3229 for (
float angle =
float(
M_PI) / 8; angle < float(
M_PI) * 2; angle += float(
M_PI) / 8)
3280 float destx, desty, destz, ground, floor;
3287 TC_LOG_FATAL(
"misc",
"WorldObject::MovePosition: Object {} has invalid coordinates X: {} and Y: {} were passed!",
3296 float step = dist/10.0f;
3298 for (
uint8 j = 0; j < 10; ++j)
3303 destx -= step * std::cos(angle);
3304 desty -= step * std::sin(angle);
3326 float destx, desty, destz;
3334 TC_LOG_FATAL(
"misc",
"WorldObject::MovePositionToFirstCollision invalid coordinates X: {} and Y: {} were passed!", destx, desty);
3348 G3D::Vector3 result = path.
GetPath().back();
3362 destx, desty, destz + halfHeight,
3363 destx, desty, destz, -0.5f);
3365 destz -= halfHeight;
3379 destx, desty, destz + halfHeight,
3380 destx, desty, destz, -0.5f);
3382 destz -= halfHeight;
3454 std::list<Player*> targets;
3458 for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
3460 Player* player = (*iter);
3497 Player* source =
nullptr;
3500 source = iter->GetSource();
3518 source = iter->GetSource();
3533 source = iter->GetSource();
3595 bool swimming = [&]()
3616 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_FARFROMPOLY_END
@ PATHFIND_NOT_USING_PATH
@ 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 void WriteCreate(MoveSpline const &mov, ByteBuffer &data)
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 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
std::string _ConcatFields(uint16 startIndex, uint16 size) 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
@ 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