public DungeonSession(int sessionId, int dungeonId, int dungeonInstanceId, DungeonType dungeonType)
        {
            DungeonType       = dungeonType;
            SessionId         = sessionId;
            DungeonId         = dungeonId;
            DungeonInstanceId = dungeonInstanceId;
            DungeonMetadata dungeon = DungeonStorage.GetDungeonByDungeonId(dungeonId);

            DungeonMapIds  = dungeon.FieldIds;
            DungeonLobbyId = dungeon.LobbyFieldId;
        }
示例#2
0
    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          = MapEntityStorage.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));
    }