Beispiel #1
0
        public bool GetMember(int CharacterID, out GuildAcademyMember Member)
        {
            lock (Guild.ThreadLocker)
            {
                Member = Members.Find(m => m.CharacterID.Equals(CharacterID));
            }

            return(Member != null);
        }
Beispiel #2
0
        private void Load()
        {
            //load academy info
            var con = Program.CharDBManager.GetClient().GetConnection();

            using (var cmd = con.CreateCommand())
            {
                cmd.CommandText = "SELECT * FROM GuildAcademy WHERE GuildID = @pGuildID";

                cmd.Parameters.Add(new MySqlParameter("@pGuildID", Guild.ID));


                using (var reader = cmd.ExecuteReader())
                {
                    if (!reader.Read())
                    {
                        throw new InvalidOperationException(
                                  "Error getting guild academy info from database for guild: " + Guild.Name);
                    }

                    Message = reader.GetString(1);
                }
            }


            //members
            using (var cmd = con.CreateCommand())
            {
                cmd.CommandText = "SELECT * FROM GuildAcademyMembers WHERE GuildID = @pGuildID";

                cmd.Parameters.Add(new MySqlParameter("@pGuildID", Guild.ID));


                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var member = new GuildAcademyMember(this, reader);

                        //try to get character
                        ZoneCharacter character;
                        if (CharacterManager.GetLoggedInCharacter(reader.GetInt32(1), out character))
                        {
                            member.Character = character;
                            member.IsOnline  = true;
                        }


                        Members.Add(member);
                    }
                }
            }
        }
Beispiel #3
0
        public static void On_WorldClient_AcademyMemberJoined(WorldConnector pConnector, InterPacket pPacket)
        {
            int      guildID, characterID;
            DateTime registerDate;

            if (!pPacket.TryReadInt(out guildID) ||
                !pPacket.TryReadInt(out characterID) ||
                !pPacket.TryReadDateTime(out registerDate))
            {
                return;
            }


            Guild guild;

            if (GuildManager.GetGuildByID(guildID, out guild))
            {
                var member = new GuildAcademyMember(guild.Academy, characterID, GuildAcademyRank.Member, registerDate)
                {
                    IsOnline = true
                };
                guild.Academy.Members.Add(member);


                ZoneCharacter character;
                if (CharacterManager.GetLoggedInCharacter(characterID, out character))
                {
                    member.Character = character;

                    character.Guild              = guild;
                    character.GuildAcademy       = guild.Academy;
                    character.GuildAcademyMember = member;


                    GuildManager.SetGuildBuff(character);
                }
            }
        }