Пример #1
0
        /// <summary>
        /// Does some things to get the World back into sync
        /// </summary>
        public static void Resync()
        {
            using (worldLock.EnterWriteLock())
            {
                s_characterCount = s_staffMemberCount = s_hordePlayerCount = s_allyPlayerCount = 0;
                foreach (var entity in s_namedEntities.Values)
                {
                    if (!(entity is Character))
                    {
                        continue;
                    }

                    var chr = (Character)entity;
                    s_characterCount++;
                    if (chr.Role.IsStaff)
                    {
                        s_staffMemberCount++;
                    }

                    if (chr.Faction.IsHorde)
                    {
                        s_hordePlayerCount++;
                    }
                    else
                    {
                        s_allyPlayerCount++;
                    }
                }
            }
        }
Пример #2
0
        internal void OnCharacterLogin(Character chr)
        {
            GuildMember member;

            using (membersLock.EnterWriteLock())
            {
                if (OfflineMembers.TryGetValue(chr.EntityId.Low, out member))
                {
                    OfflineMembers.Remove(chr.EntityId.Low);
                    member.Character = chr;
                }
            }

            if (member != null)
            {
                chr.GuildMember = member;
                if (member.Guild != null)
                {
                    //Asda2GuildHandler.SendGuildNotificationResponse(member.Guild,GuildNotificationType.LoggedIn, chr.GuildMember);
                    //GuildHandler.SendEventToGuild(member.Guild, GuildEvents.ONLINE, member);
                }
                else
                {
                    // now this is bad
                    LogManager.GetCurrentClassLogger().Warn("Found orphaned GuildMember for character \"{0}\" during logon.");
                }
                foreach (var activeSkill in chr.Guild.ActiveSkills)
                {
                    activeSkill.ApplyToCharacter(chr);
                }
            }
        }
Пример #3
0
        internal void OnCharacterLogin(Character chr)
        {
            GuildMember guildMember;

            using (membersLock.EnterWriteLock())
            {
                if (OfflineMembers.TryGetValue(chr.EntityId.Low, out guildMember))
                {
                    OfflineMembers.Remove(chr.EntityId.Low);
                    guildMember.Character = chr;
                }
            }

            if (guildMember == null)
            {
                return;
            }
            chr.GuildMember = guildMember;
            if (guildMember.Guild == null)
            {
                LogManager.GetCurrentClassLogger()
                .Warn("Found orphaned GuildMember for character \"{0}\" during logon.");
            }
            foreach (GuildSkill activeSkill in chr.Guild.ActiveSkills)
            {
                activeSkill.ApplyToCharacter(chr);
            }
        }
Пример #4
0
        internal void OnCharacterLogin(Character chr)
        {
            GuildMember member;

            using (membersLock.EnterWriteLock())
            {
                if (OfflineMembers.TryGetValue(chr.EntityId.Low, out member))
                {
                    OfflineMembers.Remove(chr.EntityId.Low);
                    member.Character = chr;
                }
            }

            if (member != null)
            {
                chr.GuildMember = member;
                if (member.Guild != null)
                {
                    GuildHandler.SendEventToGuild(member.Guild, GuildEvents.ONLINE, member);
                }
                else
                {
                    // now this is bad
                    LogManager.GetCurrentClassLogger().Warn("Found orphaned GuildMember for character \"{0}\" during logon.");
                }
            }
        }
Пример #5
0
 private void Purge()
 {
     using (m_lock.EnterWriteLock())
     {
         m_cachedAccsById.Clear();
         m_cachedAccsByName.Clear();
     }
 }
Пример #6
0
        /// <summary>
        /// Selects and returns the next online Member whose turn it is in RoundRobin.
        /// </summary>
        /// <returns>null if all members of this Group are offline.</returns>
        public GroupMember GetNextRoundRobinMember()
        {
            using (syncLock.EnterWriteLock())
            {
                m_roundRobinMember =
                    m_roundRobinMember != null ? m_roundRobinMember.Next : m_firstMember;
                while (m_roundRobinMember.Character == null)
                {
                    m_roundRobinMember = m_roundRobinMember.Next;
                    if (m_roundRobinMember == m_firstMember)
                    {
                        return(null);
                    }
                }
            }

            return(m_roundRobinMember);
        }
Пример #7
0
 /// <summary>
 /// New or loaded Guild
 /// </summary>
 /// <param name="guild"></param>
 internal void RegisterGuild(Guild guild)
 {
     using (guildsLock.EnterWriteLock())
     {
         GuildsById.Add(guild.Id, guild);
         GuildsByName.Add(guild.Name, guild);
         using (membersLock.EnterWriteLock())
         {
             foreach (var gm in guild.Members.Values)
             {
                 if (gm.Character == null && !OfflineMembers.ContainsKey(gm.Id))
                 {
                     OfflineMembers.Add(gm.Id, gm);
                 }
             }
         }
     }
 }
Пример #8
0
 internal static void OnCharacterLogout(Character character)
 {
     if (!character.HasInstanceCollection)
     {
         return;
     }
     using (syncLock.EnterWriteLock())
     {
         character.Instances.Character       = null;
         OfflineLogs[character.EntityId.Low] = character.Instances;
     }
 }