GuildLeave() public static method

public static GuildLeave ( ) : byte[]
return byte[]
Esempio n. 1
0
        void GuildLeave()
        {
            //Write our function inside a catcher
            try
            {
                //Send required packets to network
                foreach (int member in Character.Network.Guild.Members)
                {
                    //Make sure member s not null
                    if (member != 0)
                    {
                        //Get information for the guildmember
                        Systems guildmember = GetPlayerMainid(member);
                        //Make sure the guildmember isnt null
                        if (guildmember != null)
                        {
                            //Send update packet
                            guildmember.client.Send(Packet.GuildUpdate(Character, 12, 0, 0, 0));
                        }
                    }
                }

                //Send public packet to in range players (removal guild name).
                Send(Packet.GuildKick(Character.Information.UniqueID));
                //Removal from guild
                client.Send(Packet.GuildLeave());
                //Send normal state packet
                client.Send(Packet.StatePack(Character.Information.UniqueID, 0x04, 0x00, false));
                //Count new members minus 1
                int Membercount = Character.Network.Guild.Members.Count - 1;
                //Update database
                MsSQL.InsertData("UPDATE guild SET guild_members_t='" + Membercount + "' WHERE guild_name='" + Character.Network.Guild.Name + "'");
                //Remove the player from database
                MsSQL.UpdateData("DELETE from guild_members where guild_member_id='" + Character.Information.CharacterID + "'");
                //If the guild has a union
                if (Character.Network.Guild.UniqueUnion != 0)
                {
                    //Set boolean unionactive to false
                    Character.Network.Guild.UnionActive = false;
                    //Remove the member from union member list
                    Character.Network.Guild.UnionMembers.Remove(Character.Information.CharacterID);
                }
                //Cleanup character
                CleanUp(this);
                //Reload information
                LoadPlayerGuildInfo(true);
            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information the the debug log
                Systems.Debugger.Write(ex);
            }
        }