bool WorldLocation::IsValidMapCoord(WorldLocation const& loc) { if (loc.HasMap()) return MapManager::IsValidMapCoord(loc); else return MaNGOS::IsValidMapCoord(loc.getX(), loc.getY(), loc.getZ(), loc.getO()); }
void WorldSession::SendSpiritResurrect() { _player->ResurrectPlayer(0.5f, true); _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard WorldSafeLocsEntry const* corpseGrave = NULL; WorldLocation corpseLocation = _player->GetCorpseLocation(); if (_player->HasCorpse()) { corpseGrave = sObjectMgr->GetClosestGraveYard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(), corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam()); } // now can spawn bones _player->SpawnCorpseBones(); // teleport to nearest from corpse graveyard, if different from nearest to player ghost if (corpseGrave) { WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveYard( _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam()); if (corpseGrave != ghostGrave) _player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation()); // or update at original position else _player->UpdateObjectVisibility(); } // or update at original position else _player->UpdateObjectVisibility(); }
bool WorldLocation::operator == (WorldLocation const& loc) const { return ( (realmid == 0 || realmid == loc.realmid) && (!HasMap() || GetMapId() == loc.GetMapId()) && (GetInstanceId() == 0 || GetInstanceId() == loc.GetInstanceId()) && ((Position)*this) == ((Position)loc)); }
void SpellValanarKineticBombSpellScript::ChangeSummonPos(SpellEffIndex /*effIndex*/) { WorldLocation summonPos = *GetExplTargetDest(); Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; summonPos.RelocateOffset(offset); SetExplTargetDest(summonPos); GetHitDest()->RelocateOffset(offset); }
void ChangeSummonPos(SpellEffIndex /*effIndex*/) { WorldLocation summonPos = *GetExplTargetDest(); Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; summonPos.RelocateOffset(offset); SetExplTargetDest(summonPos); GetHitDest()->RelocateOffset(offset); }
void HandleSummon(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); uint32 entry = uint32(GetSpellInfo()->EffectMiscValue[effIndex]); WorldLocation* summonLocation = GetTargetDest(); if (!caster || !summonLocation) return; caster->SummonCreature(entry, summonLocation->GetPositionX(), summonLocation->GetPositionY(), GROUND_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000); }
void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recv_data) { DEBUG_LOG("WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); ObjectGuid guid; uint32 spellId; float elevation, speed; WorldLocation src = GetPlayer()->GetPosition(); WorldLocation dst = GetPlayer()->GetPosition(); uint8 moveFlag; recv_data >> guid; // if (!guid.IsPlayer()) // return; recv_data >> spellId; recv_data >> elevation; recv_data >> speed; recv_data >> src.x >> src.y >> src.z; recv_data >> dst.x >> dst.y >> dst.z; recv_data >> moveFlag; Unit* unit = ObjectAccessor::GetUnit(*GetPlayer(), guid); if (!unit) return; Spell* spell = unit ? unit->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL; if (!spell || spell->m_spellInfo->Id != spellId || !(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) { return; } DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WorldSession::HandleUpdateMissileTrajectory spell %u ajusted coords: src %f/%f %f/%f %f/%f dst %f/%f %f/%f %f/%f speed %f/%f elevation %f/%f", spellId, spell->m_targets.getSource().getX(), src.getX(), spell->m_targets.getSource().getY(), src.getY(), spell->m_targets.getSource().getZ(), src.getZ(), spell->m_targets.getDestination().getX(), dst.getX(), spell->m_targets.getDestination().getY(), dst.getY(), spell->m_targets.getDestination().getZ(), dst.getZ(), spell->m_targets.GetSpeed(), speed, spell->m_targets.GetElevation(), elevation); spell->m_targets.setSource(src); spell->m_targets.setDestination(dst); spell->m_targets.SetElevation(elevation); spell->m_targets.SetSpeed(speed); if (moveFlag) { ObjectGuid guid2; // unk guid (possible - active mover) - unused MovementInfo movementInfo; // MovementInfo recv_data >> Unused<uint32>(); // >> MSG_MOVE_STOP recv_data >> guid.ReadAsPacked(); recv_data >> movementInfo; } }
// Return true, only if transport has correct position! bool MOTransport::SetPosition(WorldLocation const& loc, bool teleport) { // prevent crash when a bad coord is sent by the client if (!MaNGOS::IsValidMapCoord(loc.getX(), loc.getY(), loc.getZ(), loc.getO())) { DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES, "Transport::SetPosition(%f, %f, %f, %f, %d) bad coordinates for transport %s!", loc.getX(), loc.getY(), loc.getZ(), loc.getO(), teleport, GetName()); return false; } if (teleport || GetMapId() != loc.GetMapId()) { Map* oldMap = GetMap(); Map* newMap = sMapMgr.CreateMap(loc.GetMapId(), this); if (!newMap) { sLog.outError("Transport::SetPosition cannot create map %u for transport %s!", loc.GetMapId(), GetName()); return false; } if (oldMap != newMap) { // Transport inserted in current map ActiveObjects list if (!GetTransportKit()->GetPassengers().empty()) { DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES,"Transport::SetPosition %s notify passengers (count " SIZEFMTD ") for change map from %u to %u",GetObjectGuid().GetString().c_str(), GetTransportKit()->GetPassengers().size(), GetPosition().GetMapId(), loc.GetMapId()); GetTransportKit()->CallForAllPassengers(NotifyMapChangeBegin(oldMap, GetPosition(), loc)); } oldMap->Remove((GameObject*)this, false); SkipUpdate(true); SetMap(newMap); Relocate(loc); SetLocationMapId(loc.GetMapId()); SetLocationInstanceId(loc.GetInstanceId()); newMap->Add((GameObject*)this); // Transport inserted in current map ActiveObjects list if (!GetTransportKit()->GetPassengers().empty()) { DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES,"Transport::SetPosition %s notify passengers (count " SIZEFMTD ") for finished change map to %u",GetObjectGuid().GetString().c_str(), GetTransportKit()->GetPassengers().size(), loc.GetMapId()); GetTransportKit()->CallForAllPassengers(NotifyMapChangeEnd(newMap,loc)); } DEBUG_FILTER_LOG(LOG_FILTER_TRANSPORT_MOVES, "Transport::SetPosition %s teleported to (%f, %f, %f, %f)", GetObjectGuid().GetString().c_str(), loc.x, loc.y, loc.z, loc.orientation); return true; } else if (!(GetPosition() == loc)) GetMap()->Relocation((GameObject*)this, loc); } else if (!(GetPosition() == loc)) GetMap()->Relocation((GameObject*)this, loc); return false; }
void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector<WorldLocation> &locs) { if (bot->IsBeingTeleported()) return; if (locs.empty()) { sLog->outMessage("playerbot", LOG_LEVEL_ERROR, "Cannot teleport bot %s - no locations available", bot->GetName().c_str()); return; } for (int attemtps = 0; attemtps < 10; ++attemtps) { int index = urand(0, locs.size() - 1); WorldLocation loc = locs[index]; float x = loc.m_positionX + urand(0, sPlayerbotAIConfig.grindDistance) - sPlayerbotAIConfig.grindDistance / 2; float y = loc.m_positionY + urand(0, sPlayerbotAIConfig.grindDistance) - sPlayerbotAIConfig.grindDistance / 2; float z = loc.m_positionZ; Map* map = sMapMgr->FindMap(loc.GetMapId(), 0); if (!map) continue; if (!map->IsOutdoors(x, y, z) || map->IsInWater(x, y, z)) continue; uint32 areaId = map->GetAreaId(x, y, z); if (!areaId) continue; AreaTableEntry const* area = sAreaStore.LookupEntry(areaId); if (!area) continue; float ground = map->GetHeight(x, y, z + 0.5f); if (ground <= INVALID_HEIGHT) continue; z = 0.05f + ground; sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Random teleporting bot %s to %s %f,%f,%f", bot->GetName().c_str(), area->area_name[0], x, y, z); bot->GetMotionMaster()->Clear(); bot->TeleportTo(loc.GetMapId(), x, y, z, 0); return; } sLog->outMessage("playerbot", LOG_LEVEL_ERROR, "Cannot teleport bot %s - no locations available", bot->GetName().c_str()); }
SpellCastResult CheckElevation() { Unit* caster = GetCaster(); WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); if (!dest) return SPELL_FAILED_DONT_REPORT; if (dest->GetPositionZ() > caster->GetPositionZ() + 5.0f) return SPELL_FAILED_NOPATH; else if (caster->HasAuraType(SPELL_AURA_MOD_ROOT)) return SPELL_FAILED_ROOTED; return SPELL_CAST_OK; }
bool WorldLocation::IsValidMapCoord(WorldLocation const& loc) { if (loc.HasMap()) return MapManager::IsValidMapCoord(loc); else return MaNGOS::IsValidMapCoord(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation); }
// Update the global position of a passenger void TransportBase::UpdateGlobalPositionOf(ObjectGuid const& passengerGuid, Position const& pos) const { WorldObject* passenger = GetOwner()->GetMap()->GetWorldObject(passengerGuid); if (!passenger) return; //Position g = CalculateGlobalPositionOf(pos); WorldLocation globalPos = GetOwner()->GetPosition(); globalPos.SetTransportPosition(pos); if (globalPos == passenger->GetPosition()) return; switch(passenger->GetTypeId()) { case TYPEID_GAMEOBJECT: case TYPEID_DYNAMICOBJECT: m_owner->GetMap()->Relocation((GameObject*)passenger, globalPos); break; case TYPEID_UNIT: m_owner->GetMap()->Relocation((Creature*)passenger, globalPos); // If passenger is vehicle if (((Unit*)passenger)->IsVehicle()) ((Unit*)passenger)->GetVehicleKit()->UpdateGlobalPositions(true); break; case TYPEID_PLAYER: m_owner->GetMap()->Relocation((Player*)passenger, globalPos); // If passenger is vehicle if (((Unit*)passenger)->IsVehicle()) ((Unit*)passenger)->GetVehicleKit()->UpdateGlobalPositions(true); break; case TYPEID_CORPSE: // TODO - add corpse relocation default: break; } }
void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) { if (!_player->HasCorpse()) { WorldPacket data(MSG_CORPSE_QUERY, 1); data << uint8(0); // corpse not found SendPacket(&data); return; } WorldLocation corpseLocation = _player->GetCorpseLocation(); uint32 corpseMapID = corpseLocation.GetMapId(); uint32 mapID = corpseLocation.GetMapId(); float x = corpseLocation.GetPositionX(); float y = corpseLocation.GetPositionY(); float z = corpseLocation.GetPositionZ(); // if corpse at different map if (mapID != _player->GetMapId()) { // search entrance map for proper show entrance if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID)) { if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) { // if corpse map have entrance if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map)) { mapID = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; y = corpseMapEntry->entrance_y; z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT); } } } } WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4)); data << uint8(1); // corpse found data << int32(mapID); data << float(x); data << float(y); data << float(z); data << int32(corpseMapID); data << uint32(0); // unknown SendPacket(&data); }
float WorldLocation::GetDistance(WorldLocation const& loc) const { return (!HasMap() || !loc.HasMap() || ((GetMapId() == loc.GetMapId()) && (GetInstanceId() == loc.GetInstanceId()))) ? ((Position)*this).GetDistance((Position)loc) : MAX_VISIBILITY_DISTANCE + 1.0f; };
void WorldSession::HandleMoveWorldportAckOpcode() { // ignore unexpected far teleports if (!GetPlayer()->IsBeingTeleportedFar()) return; GetPlayer()->SetSemaphoreTeleportFar(false); GetPlayer()->SetIgnoreMovementCount(5); // get the teleport destination WorldLocation const loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) { LogoutPlayer(false); return; } // get the destination map entry, not the current one, this will fix homebind and reset greeting MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId()); InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId()); // reset instance validity, except if going to an instance inside an instance if (GetPlayer()->m_InstanceValid == false && !mInstance) GetPlayer()->m_InstanceValid = true; Map* oldMap = GetPlayer()->GetMap(); if (GetPlayer()->IsInWorld()) { sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } // relocate the player to the teleport destination Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer()); // the CanEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) { sLog->outError(LOG_FILTER_NETWORKIO, "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } else GetPlayer()->Relocate(&loc); GetPlayer()->ResetMap(); GetPlayer()->SetMap(newMap); GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d (%s) because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown"); GetPlayer()->ResetMap(); GetPlayer()->SetMap(oldMap); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } // battleground state prepare (in case join to BG), at relogin/tele player not invited // only add to bg group and object, if the player was invited (else he entered through command) if (_player->InBattleground()) { // cleanup setting if outdated if (!mEntry->IsBattlegroundOrArena()) { // We're not in BG _player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE); // reset destination bg team _player->SetBGTeam(0); _player->SetByteValue(PLAYER_BYTES_3, 3, 0); } // join to bg case else if (Battleground* bg = _player->GetBattleground()) if (_player->IsInvitedForBattlegroundInstance(_player->GetBattlegroundId())) bg->AddPlayer(_player); } GetPlayer()->SendInitialPacketsAfterAddToMap(); // Update position client-side to avoid undermap /*WorldPacket data(SMSG_MOVE_UPDATE); _player->m_movementInfo.pos.m_positionX = loc.m_positionX; _player->m_movementInfo.pos.m_positionY = loc.m_positionY; _player->m_movementInfo.pos.m_positionZ = loc.m_positionZ; uint32 mstime = getMSTime(); if (m_clientTimeDelay == 0) m_clientTimeDelay = mstime - _player->m_movementInfo.time; _player->m_movementInfo.time = _player->m_movementInfo.time + m_clientTimeDelay + MOVEMENT_PACKET_TIME_DELAY; _player->WriteMovementInfo(data); _player->GetSession()->SendPacket(&data);*/ // flight fast teleport case if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) { if (!_player->InBattleground()) { // short preparations to continue flight FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); flight->Initialize(GetPlayer()); return; } // battleground state prepare, stop flight GetPlayer()->GetMotionMaster()->MovementExpired(); GetPlayer()->CleanupAfterTaxiFlight(); } // resurrect character at enter into instance where his corpse exist after add to map Corpse* corpse = GetPlayer()->GetCorpse(); if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId()) { if (mEntry->IsDungeon()) { GetPlayer()->ResurrectPlayer(0.5f, false); GetPlayer()->SpawnCorpseBones(); } } bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena(); if (mInstance) { Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid()); if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID, diff)) { if (mapDiff->resetTime) { if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff)) { uint32 timeleft = uint32(timeReset - time(NULL)); GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft); } } } allowMount = mInstance->AllowMount; } // mount allow check if (!allowMount) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); // update zone immediately, otherwise leave channel will cause crash in mtmap uint32 newzone, newarea; GetPlayer()->GetZoneAndAreaId(newzone, newarea); GetPlayer()->UpdateZone(newzone, newarea); for (uint8 i = 0; i < 9; ++i) GetPlayer()->UpdateSpeed(UnitMoveType(i), true); // honorless target if (GetPlayer()->pvpInfo.inHostileArea) GetPlayer()->CastSpell(GetPlayer(), 2479, true); // in friendly area else if (GetPlayer()->IsPvP() && !GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) GetPlayer()->UpdatePvP(false, false); // resummon pet GetPlayer()->ResummonPetTemporaryUnSummonedIfAny(); //lets process all delayed operations on successful teleport GetPlayer()->ProcessDelayedOperations(); }
void LfgGroup::TeleportPlayer(Player *plr, DungeonInfo *dungeonInfo, uint32 originalDungeonId, bool newPlr) { if(newPlr) { plr->m_lookingForGroup.queuedDungeons.clear(); // must be before remove grom group if (Group *group = plr->GetGroup()) { if (!group->isLfgGroup()) { group->RemoveMember(plr->GetGUID(), 0); if (group->GetMembersCount() == 0) group->Disband(true); } plr->SetGroup(NULL); } plr->UnbindInstance(dungeonInfo->start_map, m_dungeonInfo->isHeroic() ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL); plr->ResetInstances(INSTANCE_RESET_GROUP_JOIN,false); plr->ResetInstances(INSTANCE_RESET_GROUP_JOIN,true); plr->ResetInstances(INSTANCE_RESET_ALL, true); plr->ResetInstances(INSTANCE_RESET_ALL, false); if (plr->getLevel() >= LEVELREQUIREMENT_HEROIC) { if (plr->GetDungeonDifficulty() != GetDungeonDifficulty()) plr->SetDungeonDifficulty(GetDungeonDifficulty()); if (plr->GetRaidDifficulty() != GetRaidDifficulty()) plr->SetRaidDifficulty(GetRaidDifficulty()); } plr->SetGroup(this, 0); plr->SetGroupInvite(NULL); uint32 taxi_start = 0; uint32 taxi_end = 0; uint32 mount_spell = 0; WorldLocation joinLoc; if (!plr->m_taxi.empty()) { taxi_start = plr->m_taxi.GetTaxiSource(); taxi_end = plr->m_taxi.GetTaxiDestination(); joinLoc = WorldLocation(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetOrientation()); } else { // Mount spell id storing if (plr->IsMounted()) { Unit::AuraList const& auras = plr->GetAurasByType(SPELL_AURA_MOUNTED); if (!auras.empty()) mount_spell = (*auras.begin())->GetId(); } if(!mount_spell && plr->getClass() == CLASS_DRUID) { Unit::AuraList const& auras = plr->GetAurasByType(SPELL_AURA_MOD_SHAPESHIFT); if (!auras.empty()) mount_spell = (*auras.begin())->GetId(); } //Nearest graveyard if in dungeon if (plr->GetMap()->IsDungeon()) { if (const WorldSafeLocsEntry* entry = sObjectMgr.GetClosestGraveYard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId(), plr->GetTeam())) joinLoc = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.f); else joinLoc = plr->GetLocation(); } else joinLoc = plr->GetLocation(); } CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(plr->GetGUID())); CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup,lfg_join_x,lfg_join_y,lfg_join_z,lfg_join_o,lfg_join_map,taxi_start,taxi_end,mount_spell) " "VALUES('%u','%u','%u','%u','%f','%f','%f','%f','%u','%u','%u','%u')", m_Id, GUID_LOPART(plr->GetGUID()), 0, 1, joinLoc.x(), joinLoc.y(), joinLoc.z(), joinLoc.orientation, joinLoc.mapid, taxi_start, taxi_end, mount_spell); //Set info to player plr->m_lookingForGroup.joinLoc = joinLoc; plr->m_lookingForGroup.taxi_start = taxi_start; plr->m_lookingForGroup.taxi_end = taxi_end; plr->m_lookingForGroup.mount_spell = mount_spell; plr->m_lookingForGroup.roles = GetPlayerRole(plr->GetGUID()); if (IsRandom()) plr->CastSpell(plr, LFG_RANDOM_COOLDOWN, true); } // resurrect the player if (!plr->isAlive()) { plr->ResurrectPlayer(1.0f); plr->SpawnCorpseBones(); } // stop taxi flight at port if (plr->isInFlight()) { plr->GetMotionMaster()->MovementExpired(false); plr->GetMotionMaster()->Clear(false, true); plr->GetMotionMaster()->MoveIdle(); plr->m_taxi.ClearTaxiDestinations(); } plr->ScheduleDelayedOperation(DELAYED_LFG_ENTER_DUNGEON); plr->ScheduleDelayedOperation(DELAYED_SAVE_PLAYER); plr->ScheduleDelayedOperation(DELAYED_LFG_CLEAR_LOCKS); if(IsMixed()) { plr->m_lookingForGroup.SetMixedDungeon(dungeonInfo->start_map); if(newPlr) plr->setFaction(sWorld.getConfig(CONFIG_UINT32_TEAM_BG_FACTION_BLUE)); } if (IsInDungeon()) { if(newPlr) { for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *player = itr->getSource(); if (!player || player->GetMapId() != GetDungeonInfo()->map) continue; plr->TeleportTo(player->GetLocation()); return; } } plr->TeleportTo(dungeonInfo->start_map, dungeonInfo->start_x, dungeonInfo->start_y, dungeonInfo->start_z, dungeonInfo->start_o); return; } //Must re-add player to reset id... Map *map = plr->GetMap(); if(map->GetId() == dungeonInfo->start_map) { map->Remove(plr, false); map->Add(plr); } plr->TeleportTo(dungeonInfo->start_map, dungeonInfo->start_x, dungeonInfo->start_y, dungeonInfo->start_z, dungeonInfo->start_o); }