1922 | | case TARGET_BEHIND_VICTIM: |
1923 | | { |
1924 | | // Get selected target for player (or victim for units) |
1925 | | Unit *pTarget = NULL; |
1926 | | if(m_caster->GetTypeId() == TYPEID_PLAYER) |
1927 | | pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection()); |
1928 | | else |
1929 | | pTarget = m_caster->getVictim(); |
1930 | | // No target present - return |
1931 | | if (!pTarget) |
1932 | | return; |
1933 | | // Init dest coordinates |
1934 | | uint32 mapid = m_caster->GetMapId(); |
1935 | | float x = m_targets.m_destX; |
1936 | | float y = m_targets.m_destY; |
1937 | | float z = m_targets.m_destZ; |
1938 | | float orientation = pTarget->GetOrientation(); |
1939 | | // Teleport |
1940 | | if(unitTarget->GetTypeId() == TYPEID_PLAYER) |
1941 | | ((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); |
1942 | | else |
1943 | | { |
1944 | | MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); |
1945 | | WorldPacket data; |
1946 | | unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); |
1947 | | unitTarget->SendMessageToSet(&data, false); |
1948 | | } |
1949 | | return; |
1950 | | } |