示例#1
0
 public GuildMember(Guild Guild, int CharacterID, GuildRank Rank, ushort Corp)
 {
     this.Guild = Guild;
     this.CharacterID = CharacterID;
     this.Rank = Rank;
     this.Corp = Corp;
 }
示例#2
0
        public static bool GetGuildByID(int GuildID, out Guild Guild)
        {
            lock (ThreadLocker)
            {
                if ((Guild = LoadedGuilds.Find(g => g.ID.Equals(GuildID))) == null)
                {
                    //load from db
                    using (var con = Program.CharDBManager.GetClient().GetConnection())
                    {
                        using (var cmd = con.CreateCommand())
                        {
                            cmd.CommandText = "SELECT * FROM Guilds WHERE ID = @pID";

                            cmd.Parameters.Add(new MySqlParameter("@pID", GuildID));

                            using (var reader = cmd.ExecuteReader())
                            {
                                if (!reader.Read())
                                    return false;

                                //create new guild
                                Guild = new Guild(reader, con);

                                //add to cache
                                LoadedGuilds.Add(Guild);
                                reader.Close();
                            }

                        }
                    }
                }
            }

            return (Guild != null);
        }
示例#3
0
        public GuildMember(Guild Guild, MySqlDataReader reader)
        {
            this.Guild = Guild;

            CharacterID = reader.GetInt32(1);
            Rank = (GuildRank)reader.GetByte(2);
            Corp = (ushort)reader.GetInt16(3);
        }