1974 | | switch (m_spellInfo->EffectImplicitTargetB[i]) |
1975 | | { |
1976 | | case TARGET_INNKEEPER_COORDINATES: |
1977 | | { |
1978 | | // Only players can teleport to innkeeper |
1979 | | if (unitTarget->GetTypeId() != TYPEID_PLAYER) |
1980 | | return; |
1981 | | |
1982 | | ((Player*)unitTarget)->TeleportTo(((Player*)unitTarget)->m_homebindMapId,((Player*)unitTarget)->m_homebindX,((Player*)unitTarget)->m_homebindY,((Player*)unitTarget)->m_homebindZ,unitTarget->GetOrientation(),unitTarget==m_caster ? TELE_TO_SPELL : 0); |
1983 | | return; |
1984 | | } |
1985 | | default: |
1986 | | { |
1987 | | // If not exist data for dest location - return |
1988 | | if(!m_targets.HasDest()) |
1989 | | { |
1990 | | sLog.outError( "Spell::EffectTeleportUnits - unknown EffectImplicitTargetB[%u] = %u for spell ID %u\n", i, m_spellInfo->EffectImplicitTargetB[i], m_spellInfo->Id ); |
1991 | | return; |
1992 | | } |
1993 | | // Init dest coordinates |
1994 | | uint32 mapid = m_caster->GetMapId(); |
1995 | | float x = m_targets.m_destX; |
1996 | | float y = m_targets.m_destY; |
1997 | | float z = m_targets.m_destZ; |
1998 | | float orientation = unitTarget->GetOrientation(); |
1999 | | // Teleport |
2000 | | if(unitTarget->GetTypeId() == TYPEID_PLAYER) |
2001 | | ((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)); |
2002 | | else |
2003 | | { |
2004 | | MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); |
2005 | | WorldPacket data; |
2006 | | unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); |
2007 | | unitTarget->SendMessageToSet(&data, false); |
2008 | | } |
2009 | | return; |
2010 | | } |
| 1974 | // If not exist data for dest location - return |
| 1975 | if(!m_targets.HasDest()) |
| 1976 | { |
| 1977 | sLog.outError( "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id ); |
| 1978 | return; |
| 1979 | } |
| 1980 | // Init dest coordinates |
| 1981 | uint32 mapid = m_targets.m_mapId; |
| 1982 | float x = m_targets.m_destX; |
| 1983 | float y = m_targets.m_destY; |
| 1984 | float z = m_targets.m_destZ; |
| 1985 | float orientation = unitTarget->GetOrientation(); |
| 1986 | sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f\n", mapid, x, y, z); |
| 1987 | // Teleport |
| 1988 | if(unitTarget->GetTypeId() == TYPEID_PLAYER) |
| 1989 | ((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)); |
| 1990 | else |
| 1991 | { |
| 1992 | MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); |
| 1993 | WorldPacket data; |
| 1994 | unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); |
| 1995 | unitTarget->SendMessageToSet(&data, false); |