示例#1
0
        private static void HandleCreate(GameSession session, PacketReader packet)
        {
            string guildName = packet.ReadUnicodeString();

            if (session.Player.Guild != null)
            {
                return;
            }

            if (!session.Player.Wallet.Meso.Modify(-2000))
            {
                session.Send(GuildPacket.ErrorNotice((byte)GuildErrorNotice.NotEnoughMesos));
                return;
            }


            Guild newGuild;

            if (DatabaseManager.GuildExists(guildName))
            {
                session.Send(GuildPacket.ErrorNotice((byte)GuildErrorNotice.GuildWithSameNameExists));
                return;
            }
            newGuild = new(guildName);

            if (!DatabaseManager.CreateGuild(newGuild))
            {
                throw new ArgumentException("Could not create guild");
            }

            GameServer.GuildManager.AddGuild(newGuild);
            newGuild.AddLeader(session.Player);

            session.FieldManager.BroadcastPacket(GuildPacket.UpdateGuildTag2(session.Player, guildName));
            session.Send(GuildPacket.Create(guildName));

            string inviter = ""; // nobody because nobody invited the guild leader

            GuildMember member = newGuild.Members.FirstOrDefault(x => x.Player == session.Player);

            session.Send(GuildPacket.UpdateGuild(newGuild));
            session.Send(GuildPacket.MemberBroadcastJoinNotice(member, inviter, false));
            session.Send(GuildPacket.MemberJoin(session.Player));

            // Remove any applications
            foreach (GuildApplication application in session.Player.GuildApplications)
            {
                Guild guild = GameServer.GuildManager.GetGuildById(application.GuildId);
                application.Remove(session.Player, guild);
            }
        }
示例#2
0
        private void HandleCreate(GameSession session, PacketReader packet)
        {
            string guildName = packet.ReadUnicodeString();

            if (!session.Player.Wallet.Meso.Modify(-2000))
            {
                short NoticeCode = 5121;
                session.Send(GuildPacket.ErrorNotice(NoticeCode));
                return;
            }

            session.FieldManager.BroadcastPacket(GuildPacket.UpdateGuildTag(session.Player, guildName));
            session.Send(GuildPacket.Create(guildName));

            string inviter  = ""; // nobody because nobody invited the guild leader
            byte   response = 0;  // 0 to not display invite notification
            byte   rank     = 0;  // set to leader rank

            Guild newGuild = new(guildName, new List <Player> {
                session.Player
            });
示例#3
0
        private void HandleCreate(GameSession session, PacketReader packet)
        {
            string guildName = packet.ReadUnicodeString();

            if (session.Player.Mesos < 2000)
            {
                // TODO: Reject packets
                return;
            }
            else
            {
                session.Player.Mesos -= 2000;

                session.Send(MesosPacket.UpdateMesos(session));
                session.Send(GuildPacket.Invite(session.Player, guildName));
                session.Send(GuildPacket.Create(guildName));
                session.Send(GuildPacket.UpdateGuild(session, guildName));
                session.Send(GuildPacket.Create2(session.Player, guildName));
                session.Send(GuildPacket.Create3(session.Player, guildName));

                Guild newGuild = new(guildName, new List <Player> {
                    session.Player
                });