Core/Auras: If the creature whose model is used for SPELL_AURA_TRANSFORM is a trigger, apply trigger model rules to the creature as well
This commit is contained in:
@@ -580,7 +580,18 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
|||||||
{
|
{
|
||||||
if (GetTypeId() == TYPEID_UNIT)
|
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 (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
|
||||||
{
|
{
|
||||||
if (target->isGameMaster())
|
if (target->isGameMaster())
|
||||||
@@ -638,11 +649,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
|||||||
// FG: pretend that OTHER players in own group are friendly ("blue")
|
// FG: pretend that OTHER players in own group are friendly ("blue")
|
||||||
else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
|
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;
|
FactionTemplateEntry const* ft1 = unit->getFactionTemplateEntry();
|
||||||
ft1 = ((Unit*)this)->getFactionTemplateEntry();
|
FactionTemplateEntry const* ft2 = target->getFactionTemplateEntry();
|
||||||
ft2 = target->getFactionTemplateEntry();
|
|
||||||
if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
|
if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
|
||||||
{
|
{
|
||||||
if (index == UNIT_FIELD_BYTES_2)
|
if (index == UNIT_FIELD_BYTES_2)
|
||||||
@@ -682,7 +693,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
|||||||
{
|
{
|
||||||
if (IsActivateToQuest)
|
if (IsActivateToQuest)
|
||||||
{
|
{
|
||||||
switch(((GameObject*)this)->GetGoType())
|
switch (ToGameObject()->GetGoType())
|
||||||
{
|
{
|
||||||
case GAMEOBJECT_TYPE_CHEST:
|
case GAMEOBJECT_TYPE_CHEST:
|
||||||
if (target->isGameMaster())
|
if (target->isGameMaster())
|
||||||
@@ -845,7 +856,7 @@ void Object::UpdateUInt32Value(uint16 index, uint32 value)
|
|||||||
m_uint32Values[ index ] = 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));
|
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
|
||||||
if (*((uint64*)&(m_uint32Values[ index ])) != value)
|
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));
|
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
|
||||||
if (value && !*((uint64*)&(m_uint32Values[index])))
|
if (value && !*((uint64*)&(m_uint32Values[index])))
|
||||||
@@ -901,8 +912,10 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 value)
|
|||||||
m_objectUpdated = true;
|
m_objectUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1140,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const
|
|||||||
return false;
|
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))
|
if (!HasInArc(M_PI, target) || !target->IsWithinDist3d(m_positionX, m_positionY, m_positionZ, distance))
|
||||||
return false;
|
return false;
|
||||||
@@ -1192,20 +1205,17 @@ void MovementInfo::OutDebug()
|
|||||||
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
|
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
|
||||||
sLog->outString("time2: %u", t_time2);
|
sLog->outString("time2: %u", t_time2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
|
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
|
||||||
{
|
|
||||||
sLog->outString("pitch: %f", pitch);
|
sLog->outString("pitch: %f", pitch);
|
||||||
}
|
|
||||||
sLog->outString("fallTime: %u", fallTime);
|
sLog->outString("fallTime: %u", fallTime);
|
||||||
if (flags & MOVEMENTFLAG_JUMPING)
|
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);
|
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)
|
if (flags & MOVEMENTFLAG_SPLINE_ELEVATION)
|
||||||
{
|
|
||||||
sLog->outString("splineElevation: %f", splineElevation);
|
sLog->outString("splineElevation: %f", splineElevation);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
WorldObject::WorldObject(): WorldLocation(),
|
WorldObject::WorldObject(): WorldLocation(),
|
||||||
m_isWorldObject(false), m_name(""), m_isActive(false), m_zoneScript(NULL),
|
m_isWorldObject(false), m_name(""), m_isActive(false), m_zoneScript(NULL),
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ class Object
|
|||||||
void SetInt32Value(uint16 index, int32 value);
|
void SetInt32Value(uint16 index, int32 value);
|
||||||
void SetUInt32Value(uint16 index, uint32 value);
|
void SetUInt32Value(uint16 index, uint32 value);
|
||||||
void UpdateUInt32Value(uint16 index, uint32 value);
|
void UpdateUInt32Value(uint16 index, uint32 value);
|
||||||
void SetUInt64Value(uint16 index, const uint64 value);
|
void SetUInt64Value(uint16 index, uint64 const value);
|
||||||
void SetFloatValue(uint16 index, float value);
|
void SetFloatValue(uint16 index, float value);
|
||||||
void SetByteValue(uint16 index, uint8 offset, uint8 value);
|
void SetByteValue(uint16 index, uint8 offset, uint8 value);
|
||||||
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
|
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
|
||||||
@@ -218,8 +218,8 @@ class Object
|
|||||||
void SetStatFloatValue(uint16 index, float value);
|
void SetStatFloatValue(uint16 index, float value);
|
||||||
void SetStatInt32Value(uint16 index, int32 value);
|
void SetStatInt32Value(uint16 index, int32 value);
|
||||||
|
|
||||||
bool AddUInt64Value(uint16 index, const uint64 value);
|
bool AddUInt64Value(uint16 index, uint64 const value);
|
||||||
bool RemoveUInt64Value(uint16 index, const uint64 value);
|
bool RemoveUInt64Value(uint16 index, uint64 const value);
|
||||||
|
|
||||||
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
|
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
|
||||||
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
|
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
|
||||||
@@ -471,7 +471,7 @@ struct Position
|
|||||||
bool IsInDist(const Position *pos, float dist) const
|
bool IsInDist(const Position *pos, float dist) const
|
||||||
{ return GetExactDistSq(pos) < dist * dist; }
|
{ return GetExactDistSq(pos) < dist * dist; }
|
||||||
bool HasInArc(float arcangle, const Position *pos) const;
|
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;
|
std::string ToString() const;
|
||||||
};
|
};
|
||||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
|
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
|
||||||
|
|||||||
@@ -21157,19 +21157,23 @@ void Player::UpdateTriggerVisibility()
|
|||||||
if (m_clientGUIDs.empty())
|
if (m_clientGUIDs.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!IsInWorld())
|
||||||
|
return;
|
||||||
|
|
||||||
UpdateData udata;
|
UpdateData udata;
|
||||||
WorldPacket packet;
|
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))
|
if (IS_CREATURE_GUID(*itr))
|
||||||
{
|
{
|
||||||
Creature *obj = IsInWorld() ? GetMap()->GetCreature(*itr) : NULL;
|
Creature *obj = GetMap()->GetCreature(*itr);
|
||||||
if (!obj || !obj->isTrigger())
|
if (!obj || !(obj->isTrigger() || obj->HasAuraType(SPELL_AURA_TRANSFORM))) // can transform into triggers
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
obj->BuildCreateUpdateBlockForPlayer(&udata, this);
|
obj->BuildCreateUpdateBlockForPlayer(&udata, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
udata.BuildPacket(&packet);
|
udata.BuildPacket(&packet);
|
||||||
GetSession()->SendPacket(&packet);
|
GetSession()->SendPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user