Skip to content

Commit

Permalink
Core/Spells: Fixed visuals of area spells that use a dynamic object
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Oct 19, 2012
1 parent 77a8d6f commit c40e9e2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
16 changes: 5 additions & 11 deletions src/server/game/Entities/DynamicObject/DynamicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,23 @@ void DynamicObject::RemoveFromWorld()
}
}

bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type)
{
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell, GetPositionX(), GetPositionY());

This comment has been minimized.

Copy link
@zorix

zorix Oct 19, 2012

Contributor

Instead of "spell" should be "spell->Id"

return false;
}

WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());

SetEntry(spellId);
SetEntry(spell->Id);
SetObjectScale(1);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());

// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
// If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
// precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
// I saw sniffed...
SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetUInt32Value(DYNAMICOBJECT_BYTES, spell->SpellVisual[0] | (type << 28));
SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());

Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/DynamicObject/DynamicObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>
void AddToWorld();
void RemoveFromWorld();

bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
bool CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
void Update(uint32 p_time);
void Remove();
void SetDuration(int32 newDuration);
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4162,12 +4162,12 @@ void Spell::ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 s
*m_effectExecuteData[effIndex] << uint32(spellId);
}

void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 /*itemslot*/, uint32 damage)
void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << uint32(m_spellInfo->Id);
*m_effectExecuteData[effIndex] << uint32(damage);
*m_effectExecuteData[effIndex] << int32(itemId);
*m_effectExecuteData[effIndex] << int32(slot);
}

void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class Spell
void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier);
void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount);
void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId);
void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 itemslot, uint32 damage);
void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot);
void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj);
void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry);
void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry);
Expand Down
10 changes: 6 additions & 4 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (!caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject(false);
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
{
delete dynObj;
return;
Expand Down Expand Up @@ -2507,7 +2507,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
return;

DynamicObject* dynObj = new DynamicObject(true);
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
Expand Down Expand Up @@ -5142,6 +5142,7 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1); // -1 -1 pair triggers SPELL_DURABILITY_DAMAGE_ALL event
return;
}

Expand All @@ -5150,9 +5151,10 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
return;

if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);

ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, slot, damage);
ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, item->GetEntry(), slot);
}
}

void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex)
Expand Down

6 comments on commit c40e9e2

@Shauren
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #8115

@cocolino
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@CrYser
Copy link
Contributor

@CrYser CrYser commented on c40e9e2 Oct 20, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has nothing to do with blessings from pala doing nothing? (i mean not even the animation appears)

@OneB1t
Copy link

@OneB1t OneB1t commented on c40e9e2 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this somehow bugged fan of knives

@Subv
Copy link
Contributor

@Subv Subv commented on c40e9e2 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have anything to do with Fan Of Knives

@OneB1t
Copy link

@OneB1t OneB1t commented on c40e9e2 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then why when you cast fan of knives/deadly throw your throw weapon get damaged by 1 and target casts killing spree on you :D (and its not caused by database i tryed to remove all spell_ tables (also no occurence of killing spree id in whole code)

#9681

Please sign in to comment.