DarkEmu_GameServer.Systems.LoadUnions C# (CSharp) Метод

LoadUnions() публичный Метод

public LoadUnions ( ) : void
Результат void
        public void LoadUnions()
        {
            try
            {
                //First clear out the guild union info (will clean this later).
                if (Character.Network.Guild.Unions != null)
                {
                    Character.Network.Guild.Unions = null;
                    Character.Network.Guild.UnionMembers = null;
                    Character.Network.Guild.UnionLeader = 0;
                    Character.Network.Guild.UniqueUnion = 0;
                }
                //Then we query the row guildid
                int my_union = MsSQL.GetDataInt("SELECT union_unique_id FROM guild_unions WHERE union_guildid='" + Character.Network.Guild.Guildid + "'", "union_unique_id");
                //If 0 means we check if we are the union leaders
                if (my_union == 0)
                {
                    //Check for union leader
                    my_union = MsSQL.GetDataInt("SELECT union_unique_id FROM guild_unions WHERE union_leader='" + Character.Network.Guild.Guildid + "'", "union_unique_id");
                    //If we are the union leader
                    if (my_union > 0)
                        Character.Network.Guild.UnionLeader = Character.Network.Guild.Guildid;
                }

                //If union is active so count higher then 0
                if (my_union > 0)
                {
                    MsSQL unions = new MsSQL("SELECT * FROM guild_unions WHERE union_unique_id='" + my_union + "'");
                    //Open new sql data reader
                    using (SqlDataReader reader = unions.Read())
                    {
                        //While our reader is reading the information
                        while (reader.Read())
                        {
                            //Check if we allready have main info loaded
                            //If the union leader isnt the loading guild
                            if (Character.Network.Guild.UnionLeader == 0)
                                Character.Network.Guild.UnionLeader = reader.GetInt32(1);
                            //Add union to the listening
                            Character.Network.Guild.Unions.Add(reader.GetInt32(2));
                            //Set union active
                            Character.Network.Guild.UnionActive = true;
                        }
                        // Repeat for each guild in our union
                        foreach (int guild in Character.Network.Guild.Unions)
                        {
                            //Make sure the guild isnt 0
                            if (guild != 0)
                            {
                                //Get guildplayer details
                                Systems unionmember = GetGuildPlayer(guild);
                                //Make sure the player isnt null
                                if (unionmember != null)
                                {
                                    //Then add our character id to the member list.
                                    Character.Network.Guild.UnionMembers.Add(Character.Information.CharacterID);
                                }
                            }
                        }
                        //Close our sql reader.
                        reader.Close();
                    }
                    //Finally send packet for union listening
                    client.Send(Packet.UnionInfo(this));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Union Load Error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Systems