aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp84
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h38
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp10
3 files changed, 73 insertions, 59 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 4e7be5f140d..a291aa58f17 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -532,7 +532,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
if (index == UNIT_NPC_FLAGS)
{
// remove custom flag before sending
- uint32 appendValue = m_uint32Values[ index ];
+ uint32 appendValue = m_uint32Values[index];
if (GetTypeId() == TYPEID_UNIT)
{
@@ -557,7 +557,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
{
// convert from float to uint32 and send
- *data << uint32(m_floatValues[ index ] < 0 ? 0 : m_floatValues[ index ]);
+ *data << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
}
// there are some float values which may be negative or can't get negative due to other checks
else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
@@ -565,22 +565,33 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
(index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) ||
(index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
{
- *data << uint32(m_floatValues[ index ]);
+ *data << uint32(m_floatValues[index]);
}
// Gamemasters should be always able to select units - remove not selectable flag
else if (index == UNIT_FIELD_FLAGS)
{
if (target->isGameMaster())
- *data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE);
+ *data << (m_uint32Values[index] & ~UNIT_FLAG_NOT_SELECTABLE);
else
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
// use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
else if (index == UNIT_FIELD_DISPLAYID)
{
if (GetTypeId() == TYPEID_UNIT)
{
- const CreatureTemplate* cinfo = this->ToCreature()->GetCreatureInfo();
+ CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
+
+ // this also applies for transform auras
+ if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(ToUnit()->getTransForm()))
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
+ if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
+ {
+ cinfo = transformInfo;
+ break;
+ }
+
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{
if (target->isGameMaster())
@@ -599,10 +610,10 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
}
else
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
else
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
// hide lootable animation for unallowed players
else if (index == UNIT_DYNAMIC_FLAGS)
@@ -615,7 +626,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
if (creature->isTappedBy(target))
{
- dynamicFlags |= (UNIT_DYNFLAG_TAPPED|UNIT_DYNFLAG_TAPPED_BY_PLAYER);
+ dynamicFlags |= (UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER);
}
else
{
@@ -638,17 +649,17 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
// FG: pretend that OTHER players in own group are friendly ("blue")
else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
{
- if (((Unit*)this)->IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && ((Unit*)this)->IsInRaidWith(target))
+ Unit const* unit = ToUnit();
+ if (unit->IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && unit->IsInRaidWith(target))
{
- FactionTemplateEntry const *ft1, *ft2;
- ft1 = ((Unit*)this)->getFactionTemplateEntry();
- ft2 = target->getFactionTemplateEntry();
+ FactionTemplateEntry const* ft1 = unit->getFactionTemplateEntry();
+ FactionTemplateEntry const* ft2 = target->getFactionTemplateEntry();
if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
{
if (index == UNIT_FIELD_BYTES_2)
{
// Allow targetting opposite faction in party when enabled in config
- *data << (m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !!
+ *data << (m_uint32Values[index] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !!
}
else
{
@@ -658,15 +669,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
}
else
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
else
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
else
{
// send in current format (float as float, uint32 as uint32)
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
}
}
@@ -682,7 +693,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
if (IsActivateToQuest)
{
- switch(((GameObject*)this)->GetGoType())
+ switch (ToGameObject()->GetGoType())
{
case GAMEOBJECT_TYPE_CHEST:
if (target->isGameMaster())
@@ -720,7 +731,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
}
else
- *data << m_uint32Values[ index ]; // other cases
+ *data << m_uint32Values[index]; // other cases
}
}
}
@@ -731,7 +742,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
if (updateMask->GetBit(index))
{
// send in current format (float as float, uint32 as uint32)
- *data << m_uint32Values[ index ];
+ *data << m_uint32Values[index];
}
}
}
@@ -749,7 +760,7 @@ void Object::ClearUpdateMask(bool remove)
}
}
-void Object::BuildFieldsUpdate(Player *pl, UpdateDataMapType &data_map) const
+void Object::BuildFieldsUpdate(Player* pl, UpdateDataMapType& data_map) const
{
UpdateDataMapType::iterator iter = data_map.find(pl);
@@ -777,7 +788,7 @@ void Object::_LoadIntoDataField(const char* data, uint32 startOffset, uint32 cou
m_uint32Values[startOffset + index] = atol(tokens[index]);
}
-void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const
+void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
{
uint32 *value = m_uint32Values;
uint32 *mirror = m_uint32Values_mirror;
@@ -789,9 +800,9 @@ void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const
}
}
-void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const
+void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
{
- uint32 *value = m_uint32Values;
+ uint32* value = m_uint32Values;
for (uint16 index = 0; index < m_valuesCount; ++index, ++value)
{
@@ -845,7 +856,7 @@ void Object::UpdateUInt32Value(uint16 index, uint32 value)
m_uint32Values[ index ] = value;
}
-void Object::SetUInt64Value(uint16 index, const uint64 value)
+void Object::SetUInt64Value(uint16 index, uint64 const value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (*((uint64*)&(m_uint32Values[ index ])) != value)
@@ -864,7 +875,7 @@ void Object::SetUInt64Value(uint16 index, const uint64 value)
}
}
-bool Object::AddUInt64Value(uint16 index, const uint64 value)
+bool Object::AddUInt64Value(uint16 index, uint64 const value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
if (value && !*((uint64*)&(m_uint32Values[index])))
@@ -901,8 +912,10 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 value)
m_objectUpdated = true;
}
}
+
return true;
}
+
return false;
}
@@ -1127,7 +1140,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const
return false;
}
-bool Position::HasInLine(const Unit* const target, float distance, float width) const
+bool Position::HasInLine(Unit const* target, float distance, float width) const
{
if (!HasInArc(M_PI, target) || !target->IsWithinDist3d(m_positionX, m_positionY, m_positionZ, distance))
return false;
@@ -1143,14 +1156,14 @@ std::string Position::ToString() const
return sstr.str();
}
-ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer)
+ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
{
float x, y, z, o;
buf >> x >> y >> z >> o;
streamer.m_pos->Relocate(x, y, z, o);
return buf;
}
-ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer)
+ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
{
float x, y, z;
streamer.m_pos->GetPosition(x, y, z);
@@ -1158,7 +1171,7 @@ ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const & s
return buf;
}
-ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer)
+ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
{
float x, y, z;
buf >> x >> y >> z;
@@ -1166,7 +1179,7 @@ ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const & st
return buf;
}
-ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer)
+ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
{
float x, y, z, o;
streamer.m_pos->GetPosition(x, y, z, o);
@@ -1192,19 +1205,16 @@ void MovementInfo::OutDebug()
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
sLog->outString("time2: %u", t_time2);
}
+
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
- {
sLog->outString("pitch: %f", pitch);
- }
+
sLog->outString("fallTime: %u", fallTime);
if (flags & MOVEMENTFLAG_JUMPING)
- {
sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
- }
+
if (flags & MOVEMENTFLAG_SPLINE_ELEVATION)
- {
sLog->outString("splineElevation: %f", splineElevation);
- }
}
WorldObject::WorldObject(): WorldLocation(),
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index de2184eaaa6..7efa5557c8f 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -172,54 +172,54 @@ class Object
int32 GetInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
- return m_int32Values[ index ];
+ return m_int32Values[index];
}
uint32 GetUInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
- return m_uint32Values[ index ];
+ return m_uint32Values[index];
}
uint64 GetUInt64Value(uint16 index) const
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , false));
- return *((uint64*)&(m_uint32Values[ index ]));
+ return *((uint64*)&(m_uint32Values[index]));
}
float GetFloatValue(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
- return m_floatValues[ index ];
+ return m_floatValues[index];
}
uint8 GetByteValue(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(offset < 4);
- return *(((uint8*)&m_uint32Values[ index ])+offset);
+ return *(((uint8*)&m_uint32Values[index])+offset);
}
uint16 GetUInt16Value(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(offset < 2);
- return *(((uint16*)&m_uint32Values[ index ])+offset);
+ return *(((uint16*)&m_uint32Values[index])+offset);
}
- void SetInt32Value(uint16 index, int32 value);
- void SetUInt32Value(uint16 index, uint32 value);
- void UpdateUInt32Value(uint16 index, uint32 value);
- void SetUInt64Value(uint16 index, const uint64 value);
- void SetFloatValue(uint16 index, float value);
+ void SetInt32Value(uint16 index, int32 value);
+ void SetUInt32Value(uint16 index, uint32 value);
+ void UpdateUInt32Value(uint16 index, uint32 value);
+ void SetUInt64Value(uint16 index, uint64 const value);
+ void SetFloatValue(uint16 index, float value);
void SetByteValue(uint16 index, uint8 offset, uint8 value);
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index, offset, (uint16)value); }
void SetStatFloatValue(uint16 index, float value);
void SetStatInt32Value(uint16 index, int32 value);
- bool AddUInt64Value(uint16 index, const uint64 value);
- bool RemoveUInt64Value(uint16 index, const uint64 value);
+ bool AddUInt64Value(uint16 index, uint64 const value);
+ bool RemoveUInt64Value(uint16 index, uint64 const value);
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
@@ -248,7 +248,7 @@ class Object
bool HasFlag(uint16 index, uint32 flag) const
{
if (index >= m_valuesCount && !PrintIndexError(index , false)) return false;
- return (m_uint32Values[ index ] & flag) != 0;
+ return (m_uint32Values[index] & flag) != 0;
}
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
@@ -471,13 +471,13 @@ struct Position
bool IsInDist(const Position *pos, float dist) const
{ return GetExactDistSq(pos) < dist * dist; }
bool HasInArc(float arcangle, const Position *pos) const;
- bool HasInLine(const Unit* target, float distance, float width) const;
+ bool HasInLine(Unit const* target, float distance, float width) const;
std::string ToString() const;
};
-ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer);
-ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer);
-ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer);
-ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer);
+ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
+ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer);
+ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer);
+ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
struct MovementInfo
{
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index d4a558d12af..4c676241f85 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21157,19 +21157,23 @@ void Player::UpdateTriggerVisibility()
if (m_clientGUIDs.empty())
return;
+ if (!IsInWorld())
+ return;
+
UpdateData udata;
WorldPacket packet;
- for (ClientGUIDs::iterator itr=m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
+ for (ClientGUIDs::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
if (IS_CREATURE_GUID(*itr))
{
- Creature *obj = IsInWorld() ? GetMap()->GetCreature(*itr) : NULL;
- if (!obj || !obj->isTrigger())
+ Creature *obj = GetMap()->GetCreature(*itr);
+ if (!obj || !(obj->isTrigger() || obj->HasAuraType(SPELL_AURA_TRANSFORM))) // can transform into triggers
continue;
obj->BuildCreateUpdateBlockForPlayer(&udata, this);
}
}
+
udata.BuildPacket(&packet);
GetSession()->SendPacket(&packet);
}