mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-12 13:10:05 +01:00
Core/Spells: Implement alternative visuals for dynamic objects (#2)
This commit is contained in:
@@ -2393,7 +2393,7 @@ struct SpellVisualEntry
|
||||
//uint32 PersistentAreaKit;
|
||||
//DBCPosition3D MissileCastOffset;
|
||||
//DBCPosition3D MissileImpactOffset;
|
||||
//uint32 unknown
|
||||
uint32 AlternativeVisualID;
|
||||
};
|
||||
|
||||
struct StableSlotPricesEntry
|
||||
|
||||
@@ -174,7 +174,7 @@ char const SpellLevelsEntryfmt[] = "diii";
|
||||
char const SpellRuneCostfmt[] = "niiii";
|
||||
char const SpellShapeshiftEntryfmt[] = "niiiix";
|
||||
char const SpellShapeshiftFormfmt[] = "nxxiixiiixxiiiiiiiiix";
|
||||
char const SpellVisualfmt[] = "dxxxxxxiixxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
char const SpellVisualfmt[] = "dxxxxxxiixxxxxxxxxxxxxxxxxxxxxxxi";
|
||||
char const StableSlotPricesfmt[] = "ni";
|
||||
char const SummonPropertiesfmt[] = "niiiii";
|
||||
char const TalentEntryfmt[] = "niiiiiiiiixxixxxxxx";
|
||||
|
||||
@@ -171,6 +171,55 @@ void DynamicObject::Remove()
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
ByteBuffer fieldBuffer;
|
||||
UpdateMask updateMask;
|
||||
updateMask.SetCount(m_valuesCount);
|
||||
|
||||
uint32* flags = nullptr;
|
||||
uint32 visibleFlag = GetUpdateFieldData(target, flags);
|
||||
ASSERT(flags);
|
||||
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if (_fieldNotifyFlags & flags[index] ||
|
||||
((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)))
|
||||
{
|
||||
updateMask.SetBit(index);
|
||||
|
||||
if (index == DYNAMICOBJECT_BYTES)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (SpellInfo const* spellInfo = GetSpellInfo())
|
||||
{
|
||||
SpellVisualEntry const* rootVisual = sSpellVisualStore.LookupEntry(spellInfo->SpellVisual[0]);
|
||||
if (rootVisual && rootVisual->AlternativeVisualID)
|
||||
{
|
||||
SpellVisualEntry const* alternativeVisual = sSpellVisualStore.LookupEntry(rootVisual->AlternativeVisualID);
|
||||
if (alternativeVisual && !caster->IsFriendlyTo(target))
|
||||
{
|
||||
fieldBuffer << (rootVisual->AlternativeVisualID | (DYNAMIC_OBJECT_AREA_SPELL << 28));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fieldBuffer << m_uint32Values[index];
|
||||
}
|
||||
}
|
||||
|
||||
*data << uint8(updateMask.GetBlockCount());
|
||||
updateMask.AppendToPacket(data);
|
||||
data->append(fieldBuffer);
|
||||
}
|
||||
|
||||
int32 DynamicObject::GetDuration() const
|
||||
{
|
||||
if (!_aura)
|
||||
|
||||
@@ -43,6 +43,8 @@ class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicO
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
void BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const override;
|
||||
|
||||
bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
|
||||
void Update(uint32 p_time) override;
|
||||
void Remove();
|
||||
|
||||
Reference in New Issue
Block a user