Example #1
0
    private static void HandleCreate(GameSession session, PacketReader packet)
    {
        Party party = GameServer.PartyManager.GetPartyByLeader(session.Player);

        if (party is null || party.Leader.CharacterId != session.Player.CharacterId)
        {
            return;
        }

        int maxClubCount = int.Parse(ConstantsMetadataStorage.GetConstant("ClubMaxCount"));

        // Fail if a party member is offline or if member has joined max amount of clubs
        if (party.Members.Any(x => !x.Session.Connected()) || party.Members.Any(x => x.Clubs.Count >= maxClubCount))
        {
            session.Send(ClubPacket.ErrorNotice((int)ClubErrorNotice.SomePartyMembersCannotBeInvited));
            return;
        }

        string clubName = packet.ReadUnicodeString();

        if (!ValidClubName(session, clubName))
        {
            return;
        }


        Club club = new(party, clubName);

        GameServer.ClubManager.AddClub(club);

        party.BroadcastPacketParty(ClubPacket.Create(party, club));
    }
        private static void HandleCreate(GameSession session, PacketReader packet)
        {
            // TODO fix creating for a party of more than 2. Currently if a member does not respond, despite atleast one other member accepting, it does not get created.
            Party party = GameServer.PartyManager.GetPartyByLeader(session.Player);
            if (party == null)
            {
                return;
            }

            string clubName = packet.ReadUnicodeString();

            Club club = new Club(party, clubName);
            GameServer.ClubManager.AddClub(club);

            party.BroadcastPacketParty(ClubPacket.Create(party, club));
        }