Exemplo n.º 1
0
        public static void On_InterClient_GuildMemberAdd(WorldConnector pConnector, InterPacket pPacket)
        {
            int guildID, characterID;
            byte rank;
            ushort corp;
            if (!pPacket.TryReadInt(out guildID)
                || !pPacket.TryReadInt(out characterID)
                || !pPacket.TryReadByte(out rank)
                || !pPacket.TryReadUShort(out corp))
            {
                return;
            }

            Guild guild;
            if (GetGuildByID(guildID, out guild))
            {
                lock (guild.ThreadLocker)
                {
                    //create member
                    var member = new GuildMember(guild, characterID, (GuildRank)rank, corp)
                    {
                        IsOnline = true,
                    };

                    guild.Members.Add(member);

                    //check if member is on this zone, if so assign guild to him
                    ZoneCharacter character;
                    if (CharacterManager.GetLoggedInCharacter(characterID, out character))
                    {
                        character.Guild = guild;
                        character.GuildAcademy = guild.Academy;
                        character.GuildMember = member;

                        member.Character = character;

                        SetGuildBuff(character);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool GetMember(int CharacterID, out GuildMember Member)
        {
            lock (ThreadLocker)
            {
                Member = Members.Find(m => m.CharacterID.Equals(CharacterID));
            }

            return (Member != null);
        }
Exemplo n.º 3
0
        private void Load()
        {
            //members
            using (var cmd = Program.CharDBManager.GetClient().GetConnection().CreateCommand())
            {
                cmd.CommandText = "SELECT * FROM GuildMembers WHERE GuildID = @pGuildID";

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

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

                        Members.Add(member);
                    }
                }
            }

            //academy
            Academy = new GuildAcademy(this);
        }
Exemplo n.º 4
0
        public void Broadcast(Packet Packet, GuildMember Exclude = null)
        {
            lock (ThreadLocker)
            {
                foreach (var member in Members)
                {
                    if (Exclude != null
                        && member == Exclude)
                        continue;

                    if (member.IsOnline)
                    {
                        try
                        {
                            member.Character.Client.SendPacket(Packet);
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
            }
        }