Beispiel #1
0
        public override void Process(Level level)
        {
            var alliances = ObjectManager.GetInMemoryAlliances();

            if (ResourcesManager.GetInMemoryAlliances().Count == 0)
            {
                alliances = DatabaseManager.Single().GetAllAlliances();
            }

            var joinableAlliances = new List <Alliance>();
            var i = 0;
            var j = 0;

            while (j < m_vAllianceLimit && i < alliances.Count)
            {
                if (alliances[i].GetAllianceMembers().Count != 0)
                {
                    if (alliances[i].GetAllianceName().Contains(m_vSearchString, StringComparison.OrdinalIgnoreCase))
                    {
                        joinableAlliances.Add(alliances[i]);
                        j++;
                    }
                    i++;
                }
            }
            joinableAlliances = joinableAlliances.ToList();

            var p = new AllianceListMessage(Client);

            p.SetAlliances(joinableAlliances);
            p.SetSearchString(m_vSearchString);
            p.Send();
        }
        public override void Process(Level level)
        {
            var alliances = ObjectManager.GetInMemoryAlliances();

            if (ResourcesManager.GetInMemoryAlliances().Count == 0)
            {
                alliances = DatabaseManager.Instance.GetAllAlliances();
            }

            var joinableAlliances = new List <Alliance>();

            for (int i = 0; i < alliances.Count; i++)
            {
                if (joinableAlliances.Count >= m_vAllianceLimit)
                {
                    break;
                }

                var alliance = alliances[i];
                if (m_vSearchString == null)
                {
                    joinableAlliances.Add(alliance);
                }
                else
                {
                    if (alliance.GetAllianceName().Contains(m_vSearchString, StringComparison.OrdinalIgnoreCase))
                    {
                        joinableAlliances.Add(alliance);
                    }
                }
            }

            joinableAlliances = joinableAlliances.ToList();

            var message = new AllianceListMessage(Client);

            message.SetAlliances(joinableAlliances);
            message.SetSearchString(m_vSearchString);
            message.Send();
        }
Beispiel #3
0
        internal override void Process()
        {
            if (m_vSearchString.Length < 15)
            {
                ResourcesManager.DisconnectClient(Device);
            }
            else
            {
                List <Alliance> joinableAlliances = new List <Alliance>();

                foreach (Alliance _Alliance in ResourcesManager.m_vInMemoryAlliances.Values)
                {
                    if (_Alliance.m_vAllianceName.Contains(m_vSearchString, StringComparison.OrdinalIgnoreCase))
                    {
                        joinableAlliances.Add(_Alliance);
                    }
                }

                AllianceListMessage p = new AllianceListMessage(Device);
                p.m_vAlliances    = joinableAlliances;
                p.m_vSearchString = m_vSearchString;
                p.Send();
            }
        }