5482 | | if( m_spellInfo->rangeIndex== 1) //self range |
5483 | | { |
5484 | | uint32 mapid = m_caster->GetMapId(); |
5485 | | float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); |
5486 | | |
5487 | | // before caster |
5488 | | float fx,fy,fz; |
5489 | | unitTarget->GetClosePoint(fx,fy,fz,unitTarget->GetObjectSize(),dis); |
5490 | | float ox,oy,oz; |
5491 | | unitTarget->GetPosition(ox,oy,oz); |
5492 | | |
5493 | | float fx2,fy2,fz2; // getObjectHitPos overwrite last args in any result case |
5494 | | if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid, ox,oy,oz+0.5, fx,fy,oz+0.5,fx2,fy2,fz2, -0.5)) |
5495 | | { |
5496 | | fx = fx2; |
5497 | | fy = fy2; |
5498 | | fz = fz2; |
5499 | | unitTarget->UpdateGroundPositionZ(fx,fy,fz); |
5500 | | } |
5501 | | |
5502 | | if(unitTarget->GetTypeId() == TYPEID_PLAYER) |
5503 | | ((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); |
5504 | | else |
5505 | | MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation()); |
5506 | | } |
| 5482 | if(!m_targets.HasDest()) |
| 5483 | return; |
| 5484 | |
| 5485 | uint32 mapid = unitTarget->GetMapId(); |
| 5486 | float ox,oy,oz; |
| 5487 | unitTarget->GetPosition(ox,oy,oz); |
| 5488 | |
| 5489 | float fx,fy,fz; // getObjectHitPos overwrite last args in any result case |
| 5490 | if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid, ox,oy,oz+0.5, m_targets.m_destX,m_targets.m_destY,oz+0.5,fx,fy,fz, -0.5)) |
| 5491 | unitTarget->UpdateGroundPositionZ(fx,fy,fz); |
| 5492 | |
| 5493 | if(unitTarget->GetTypeId() == TYPEID_PLAYER) |
| 5494 | ((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); |
| 5495 | else |
| 5496 | MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation()); |