diff options
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 16 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 49 |
5 files changed, 24 insertions, 55 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 41c46cf55d2..75845ebdb4f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16677,13 +16677,11 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo return true; } -void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/) +void Player::SetHomebind(WorldLocation const& loc, uint32 areaId) { - m_homebindMapId = GetMapId(); - m_homebindAreaId = GetAreaId(); - m_homebindX = GetPositionX(); - m_homebindY = GetPositionY(); - m_homebindZ = GetPositionZ(); + loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ); + m_homebindMapId = loc.GetMapId(); + m_homebindAreaId = areaId; // update sql homebind PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 7d5b0487f4d..cc08e9c2e18 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2312,7 +2312,7 @@ class Player : public Unit, public GridObject<Player> float m_recallO; void SaveRecallPosition(); - void SetHomebind(WorldLocation const& loc, uint32 area_id); + void SetHomebind(WorldLocation const& loc, uint32 areaId); // Homebind coordinates uint32 m_homebindMapId; diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index f3b26452435..a9cb7e9b806 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -470,22 +470,6 @@ void WorldSession::SendBindPoint(Creature* npc) uint32 bindspell = 3286; - // update sql homebind - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND); - stmt->setUInt16(0, _player->GetMapId()); - stmt->setUInt16(1, _player->GetAreaId()); - stmt->setFloat (2, _player->GetPositionX()); - stmt->setFloat (3, _player->GetPositionY()); - stmt->setFloat (4, _player->GetPositionZ()); - stmt->setUInt32(5, _player->GetGUIDLow()); - CharacterDatabase.Execute(stmt); - - _player->m_homebindMapId = _player->GetMapId(); - _player->m_homebindAreaId = _player->GetAreaId(); - _player->m_homebindX = _player->GetPositionX(); - _player->m_homebindY = _player->GetPositionY(); - _player->m_homebindZ = _player->GetPositionZ(); - // send spell for homebinding (3286) npc->CastSpell(_player, bindspell, true); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 58f9d2856da..bb51d9d0e34 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1392,7 +1392,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id)) { // TODO: fix this check - if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS)) + if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND)) m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId); else if (st->target_mapId == m_caster->GetMapId()) m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation); 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); } |