aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-12-09 02:33:34 -0800
committerShauren <shauren.trinity@gmail.com>2012-12-09 02:33:34 -0800
commitb65a88eeec18a4ba6b1a4cd82c3e6fb0205e3cff (patch)
tree18f01234616853310501402326e3ccedc1062fd3 /src/server/game/Spells/SpellEffects.cpp
parent59f8457bd47266ded2b1a6c84f96f73da773373d (diff)
parent5c33c540543ae7023cd88495cc676a1420c628b3 (diff)
Merge pull request #8590 from joschiwald/homebind
Core/Player: correct SetHomebind and usage of it
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp49
1 files changed, 18 insertions, 31 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 72ef429bed0..a642d40c24d 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -6264,51 +6264,38 @@ void Spell::EffectBind(SpellEffIndex effIndex)
Player* player = unitTarget->ToPlayer();
- uint32 area_id;
- WorldLocation loc;
- if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
- {
- SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id);
- if (!st)
- {
- sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id);
- return;
- }
+ WorldLocation homeLoc;
+ uint32 areaId = player->GetAreaId();
- loc.m_mapId = st->target_mapId;
- loc.m_positionX = st->target_X;
- loc.m_positionY = st->target_Y;
- loc.m_positionZ = st->target_Z;
- loc.m_orientation = st->target_Orientation;
- area_id = player->GetAreaId();
- }
+ if (m_spellInfo->Effects[effIndex].MiscValue)
+ areaId = m_spellInfo->Effects[effIndex].MiscValue;
+
+ if (m_targets.HasDst())
+ homeLoc.WorldRelocate(*destTarget);
else
{
- player->GetPosition(&loc);
- area_id = player->GetAreaId();
+ player->GetPosition(&homeLoc);
+ homeLoc.m_mapId = player->GetMapId();
}
- player->SetHomebind(loc, area_id);
+ player->SetHomebind(homeLoc, areaId);
// binding
WorldPacket data(SMSG_BINDPOINTUPDATE, (4+4+4+4+4));
- data << float(loc.m_positionX);
- data << float(loc.m_positionY);
- data << float(loc.m_positionZ);
- data << uint32(loc.m_mapId);
- data << uint32(area_id);
+ data << float(homeLoc.GetPositionX());
+ data << float(homeLoc.GetPositionY());
+ data << float(homeLoc.GetPositionZ());
+ data << uint32(homeLoc.GetMapId());
+ data << uint32(areaId);
player->SendDirectMessage(&data);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind X : %f", loc.m_positionX);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Y : %f", loc.m_positionY);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Z : %f", loc.m_positionZ);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind MapId : %u", loc.m_mapId);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind AreaId : %u", area_id);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u",
+ homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId);
// zone update
data.Initialize(SMSG_PLAYERBOUND, 8+4);
data << uint64(player->GetGUID());
- data << uint32(area_id);
+ data << uint32(areaId);
player->SendDirectMessage(&data);
}