예제 #1
0
        public static void InteractGuild(PlayerSocket socket, Packet packet)
        {
            byte    interaction = packet.ReadByte();
            int     guildID;
            IGuild  guild;
            IMobile player = socket.Mobile;

            switch (interaction)
            {
            case 0:    //ShowGuildList
                player.ShowGuildList();
                break;

            case 1:    //View Guild
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);
                player.ShowGuild(guild);
                break;

            case 2:    //Apply to Guild
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);
                player.ApplyGuild(guild);
                break;

            case 4:    //Guild Applicants
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);

                interaction = packet.ReadByte();
                byte applicantID;
                switch (interaction)
                {
                case 0:        //Accept Applicant
                    applicantID = packet.ReadByte();
                    guild.AcceptApplicant(player, applicantID);
                    break;

                case 1:
                    applicantID = packet.ReadByte();
                    guild.DenyApplicant(player, applicantID);
                    break;

                case 2:        //show guild applicants
                    guild.ShowGuildApplicants(player, guild);
                    break;
                }
                //state.Send(new ShowGuildApplicants(guild));
                break;

            case 5:    //Guild Member Ranking/Kick
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);

                interaction = packet.ReadByte();
                byte memberID;
                switch (interaction)
                {
                case 0:                               //Update member
                    memberID = packet.ReadByte();
                    byte founder = packet.ReadByte(); //Founder/Lord
                    byte memType = packet.ReadByte();
                    guild.UpdateMember(player, memberID, founder, (MemberType)memType);
                    break;

                case 1:
                    memberID = packet.ReadByte();
                    guild.KickMember(player, memberID);
                    break;
                }
                player.ShowGuild(guild);    //refresh the guild screen

                break;

            case 6:    //Guild Decrees
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);

                interaction = packet.ReadByte();
                byte decreeType;
                switch (interaction)
                {
                case 0:        //Add Decree
                    decreeType = packet.ReadByte();
                    guildID    = packet.ReadInt16();
                    guild.AddDecree(player, decreeType, guildID);
                    player.ShowGuild(guild);        //refresh the guild screen
                    break;

                case 1:
                    byte decreeID = packet.ReadByte();
                    guild.RemoveDecree(player, decreeID);
                    player.ShowGuild(guild);        //refresh the guild screen
                    break;

                case 2:        //show guild decrees
                    player.ShowGuildDecrees(guild);
                    break;
                }
                break;

            case 8:    //Found Guild
                string guildName = packet.ReadNullString();
                player.CreateGuild(guildName);
                break;

            case 9:    //Guild Hall
                guildID = packet.ReadInt16();
                guild   = World.GetGuildByID(guildID);

                interaction = packet.ReadByte();
                switch (interaction)
                {
                case 0:        //Purchase Guild Hall
                    World.ShowAvailableGuildHalls(player);
                    break;

                case 1:
                    byte guildHallID = packet.ReadByte();
                    player.BuyGuildHall(guild, guildHallID);
                    break;

                case 2:        //Remove Guild Hall
                    player.SellGuildHall(guild);
                    break;
                }
                break;

            default:
                Console.WriteLine(String.Format("Unknown guild Interaction"));
                break;
            }
        }