mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[12127] Add wrapper to access spell locations
* Add SpellCastTargets::getSource to get the source position (for TARGET_FLAG_SOURCE_LOCATION) * Add SpellCastTargets::getDestination to get the destination position (for TARGET_FLAG_DEST_LOCATION)
This commit is contained in:
parent
147a1b04fe
commit
1707edbcfd
4 changed files with 26 additions and 60 deletions
|
|
@ -2324,20 +2324,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
if (targetMode == TARGET_AREAEFFECT_GO_AROUND_SOURCE)
|
||||
{
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
|
||||
{
|
||||
x = m_targets.m_srcX;
|
||||
y = m_targets.m_srcY;
|
||||
z = m_targets.m_srcZ;
|
||||
}
|
||||
m_targets.getSource(x, y, z);
|
||||
else
|
||||
m_caster->GetPosition(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
}
|
||||
m_targets.getDestination(x, y, z);
|
||||
|
||||
// It may be possible to fill targets for some spell effects
|
||||
// automatically (SPELL_EFFECT_WMO_REPAIR(88) for example) but
|
||||
|
|
|
|||
|
|
@ -151,24 +151,29 @@ class SpellCastTargets
|
|||
return *this;
|
||||
}
|
||||
|
||||
void setUnitTarget(Unit* target);
|
||||
ObjectGuid getUnitTargetGuid() const { return m_unitTargetGUID; }
|
||||
Unit* getUnitTarget() const { return m_unitTarget; }
|
||||
void setUnitTarget(Unit* target);
|
||||
|
||||
void setDestination(float x, float y, float z);
|
||||
void setSource(float x, float y, float z);
|
||||
void getDestination(float& x, float& y, float& z) const { x = m_destX; y = m_destY; z = m_destZ; }
|
||||
void getSource(float& x, float& y, float& z) const { x = m_srcX; y = m_srcY, z = m_srcZ; }
|
||||
|
||||
void setGOTarget(GameObject* target);
|
||||
ObjectGuid getGOTargetGuid() const { return m_GOTargetGUID; }
|
||||
GameObject* getGOTarget() const { return m_GOTarget; }
|
||||
void setGOTarget(GameObject* target);
|
||||
|
||||
ObjectGuid getCorpseTargetGuid() const { return m_CorpseTargetGUID; }
|
||||
void setCorpseTarget(Corpse* corpse);
|
||||
ObjectGuid getCorpseTargetGuid() const { return m_CorpseTargetGUID; }
|
||||
|
||||
void setItemTarget(Item* item);
|
||||
ObjectGuid getItemTargetGuid() const { return m_itemTargetGUID; }
|
||||
Item* getItemTarget() const { return m_itemTarget; }
|
||||
uint32 getItemTargetEntry() const { return m_itemTargetEntry; }
|
||||
void setItemTarget(Item* item);
|
||||
|
||||
void setTradeItemTarget(Player* caster);
|
||||
|
||||
void updateTradeSlotItem()
|
||||
{
|
||||
if (m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM))
|
||||
|
|
@ -190,6 +195,7 @@ class SpellCastTargets
|
|||
float GetSpeed() const { return m_speed; }
|
||||
|
||||
uint32 m_targetMask;
|
||||
|
||||
private:
|
||||
// objects (can be used at spell creating and after Update at casting
|
||||
Unit* m_unitTarget;
|
||||
|
|
@ -771,17 +777,9 @@ namespace MaNGOS
|
|||
break;
|
||||
case PUSH_DEST_CENTER:
|
||||
if (i_spell.m_targets.m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
|
||||
{
|
||||
i_centerX = i_spell.m_targets.m_srcX;
|
||||
i_centerY = i_spell.m_targets.m_srcY;
|
||||
i_centerZ = i_spell.m_targets.m_srcZ;
|
||||
}
|
||||
i_spell.m_targets.getSource(i_centerX, i_centerY, i_centerZ);
|
||||
else
|
||||
{
|
||||
i_centerX = i_spell.m_targets.m_destX;
|
||||
i_centerY = i_spell.m_targets.m_destY;
|
||||
i_centerZ = i_spell.m_targets.m_destZ;
|
||||
}
|
||||
i_spell.m_targets.getDestination(i_centerX, i_centerY, i_centerZ);
|
||||
break;
|
||||
case PUSH_TARGET_CENTER:
|
||||
if (Unit* target = i_spell.m_targets.getUnitTarget())
|
||||
|
|
|
|||
|
|
@ -3781,9 +3781,7 @@ void Spell::EffectJump(SpellEffectEntry const* effect)
|
|||
float x, y, z, o;
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
m_targets.getDestination(x, y, z);
|
||||
|
||||
if(effect->EffectImplicitTargetA == TARGET_BEHIND_VICTIM)
|
||||
{
|
||||
|
|
@ -3818,10 +3816,10 @@ void Spell::EffectJump(SpellEffectEntry const* effect)
|
|||
return;
|
||||
}
|
||||
|
||||
m_caster->NearTeleportTo(x, y, z, o, true);
|
||||
m_caster->NearTeleportTo(x, y, z, o, true); // TODO Implement this as jump movement?
|
||||
}
|
||||
|
||||
void Spell::EffectTeleportUnits(SpellEffectEntry const* effect)
|
||||
void Spell::EffectTeleportUnits(SpellEffectEntry const* effect) // TODO - Use target settings for this effect!
|
||||
{
|
||||
if (!unitTarget || unitTarget->IsTaxiFlying())
|
||||
return;
|
||||
|
|
@ -4860,11 +4858,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect)
|
|||
|
||||
// Set middle position
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
summonPositions[0].x = m_targets.m_destX;
|
||||
summonPositions[0].y = m_targets.m_destY;
|
||||
summonPositions[0].z = m_targets.m_destZ;
|
||||
}
|
||||
m_targets.getDestination(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z);
|
||||
else
|
||||
{
|
||||
m_caster->GetPosition(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z);
|
||||
|
|
@ -6604,11 +6598,7 @@ void Spell::EffectSummonObjectWild(SpellEffectEntry const* effect)
|
|||
|
||||
float x, y, z;
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
}
|
||||
m_targets.getDestination(x, y, z);
|
||||
else
|
||||
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
|
||||
|
|
@ -8955,11 +8945,7 @@ void Spell::EffectSummonObject(SpellEffectEntry const* effect)
|
|||
float x, y, z;
|
||||
// If dest location if present
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
}
|
||||
m_targets.getDestination(x, y, z);
|
||||
// Summon in random point all other units if location present
|
||||
else
|
||||
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
|
|
@ -9223,9 +9209,7 @@ void Spell::EffectCharge2(SpellEffectEntry const* /*effect*/)
|
|||
float x, y, z;
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
m_targets.getDestination(x, y, z);
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
((Creature*)unitTarget)->StopMoving();
|
||||
|
|
@ -9441,13 +9425,9 @@ void Spell::EffectTransmitted(SpellEffectEntry const* effect)
|
|||
float fx, fy, fz;
|
||||
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
fx = m_targets.m_destX;
|
||||
fy = m_targets.m_destY;
|
||||
fz = m_targets.m_destZ;
|
||||
}
|
||||
//FIXME: this can be better check for most objects but still hack
|
||||
else if(effect->EffectRadiusIndex && m_spellInfo->speed==0)
|
||||
m_targets.getDestination(fx, fy, fz);
|
||||
// FIXME: this can be better check for most objects but still hack
|
||||
else if (effect->EffectRadiusIndex && m_spellInfo->speed == 0)
|
||||
{
|
||||
float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(effect->EffectRadiusIndex));
|
||||
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
|
||||
|
|
@ -9966,11 +9946,7 @@ void Spell::EffectKnockBackFromPosition(SpellEffectIndex eff_idx)
|
|||
|
||||
float x, y, z;
|
||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
x = m_targets.m_destX;
|
||||
y = m_targets.m_destY;
|
||||
z = m_targets.m_destZ;
|
||||
}
|
||||
m_targets.getDestination(x, y, z);
|
||||
else
|
||||
m_caster->GetPosition(x, y, z);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12126"
|
||||
#define REVISION_NR "12127"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue