public void MoveUser(int mapId, int triggerId, int boxId) { List <Character> players = Field.State.Players.Values.ToList(); if (boxId != 0) { MapTriggerBox box = MapEntityMetadataStorage.GetTriggerBox(Field.MapId, boxId); if (box is null) { return; } players = players.Where(player => FieldManager.IsPlayerInBox(box, player)).ToList(); } // move player back to return map if (mapId == 0 && triggerId == 0) { foreach (IFieldObject <Player> player in players) { player.Value.Warp(player.Value.ReturnMapId, player.Value.ReturnCoord); } return; } if (mapId == Field.MapId) { IFieldObject <Portal> portal = Field.State.Portals.Values.First(p => p.Value.Id == triggerId); foreach (IFieldObject <Player> player in players) { player.Value.Move(portal.Coord, portal.Rotation, isTrigger: true); } return; } CoordF moveCoord; CoordF moveRotation; MapPortal dstPortal = MapEntityMetadataStorage.GetPortals(mapId).FirstOrDefault(portal => portal.Id == triggerId); if (dstPortal == null) { MapPlayerSpawn spawn = MapEntityMetadataStorage.GetRandomPlayerSpawn(mapId); moveCoord = spawn.Coord.ToFloat(); moveRotation = spawn.Rotation.ToFloat(); } else { moveCoord = dstPortal.Coord.ToFloat(); moveRotation = dstPortal.Rotation.ToFloat(); } foreach (IFieldObject <Player> player in players) { player.Value.Warp(mapId, moveCoord, moveRotation, instanceId: 1); } }
public MushkingRoyaleSession(int mapId) { MapPlayerSpawn spawn = MapEntityMetadataStorage.GetRandomPlayerSpawn(mapId); MapId = mapId; SpawnPosition = spawn.Coord; SpawnRotation = spawn.Rotation; SessionId = GameServer.MushkingRoyaleSessionManager.GetSessionId(); InstanceId = SessionId; GameServer.MushkingRoyaleSessionManager.AddSession(this); }
public static void HandleCreateDungeon(GameSession session, PacketReader packet) { int dungeonId = packet.ReadInt(); bool groupEnter = packet.ReadBool(); Player player = session.Player; if (player.DungeonSessionId != -1) { session.SendNotice("Leave your current dungeon before opening another."); return; } int dungeonLobbyId = DungeonStorage.GetDungeonByDungeonId(dungeonId).LobbyFieldId; MapPlayerSpawn spawn = MapEntityMetadataStorage.GetRandomPlayerSpawn(dungeonLobbyId); DungeonSession dungeonSession = GameServer.DungeonManager.CreateDungeonSession(dungeonId, groupEnter ? DungeonType.Group : DungeonType.Solo); //TODO: Send packet that greys out enter alone / enter as party when already in a dungeon session (sendRoomDungeon packet/s). //the session belongs to the party leader if (groupEnter) { Party party = player.Party; if (party.DungeonSessionId != -1) { session.SendNotice("Need to reset dungeon before entering another instance"); return; } foreach (Player member in party.Members) { if (member.DungeonSessionId != -1) { session.SendNotice($"{member.Name} is still in a Dungeon Instance."); return; } } party.DungeonSessionId = dungeonSession.SessionId; party.BroadcastPacketParty(PartyPacket.PartyHelp(dungeonId)); //TODO: Update Party with dungeon Info via party packets (0d,0e and others are involved). } else // solo join dungeon { player.DungeonSessionId = dungeonSession.SessionId; } session.Player.Warp(dungeonLobbyId, instanceId: dungeonSession.DungeonInstanceId); //TODO: things after map is created here: spawn doctor npc. //This packet sets the banner in the dungeon that displays the dungeonname and the playersize it was created for. //party.BroadcastPacketParty(DungeonWaitPacket.Show(dungeonId, DungeonStorage.GetDungeonByDungeonId(dungeonId).MaxUserCount)); }