예제 #1
0
        private void ItemFilter_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i = ItemFilter.SelectedIndex;

            if (i >= 0)
            {
                PropertyFilter filter  = m_Filter.PropertyFilter[i];
                StringBuilder  builder = new StringBuilder();

                foreach (object o in filter.Values)
                {
                    builder.Append(o.ToString());
                    builder.Append('|');
                }

                RadioExclude.Enabled   = true;
                RadioInclude.Enabled   = true;
                PropertyFilter.Enabled = true;
                PropertyFilter.Text    = builder.ToString();
            }
            else
            {
                RadioExclude.Enabled   = false;
                RadioInclude.Enabled   = false;
                PropertyFilter.Enabled = false;
            }
        }
예제 #2
0
        private void PropertyFilter_Leave(object sender, EventArgs e)
        {
            int i = ItemFilter.SelectedIndex;

            if (i >= 0)
            {
                PropertyFilter filter = m_Filter.PropertyFilter[i];
                string[]       split  = PropertyFilter.Text.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                int            iValue;
                double         dValue;

                filter.Values.Clear();

                foreach (string s in split)
                {
                    if (s.StartsWith("0x") && Int32.TryParse(s.Substring(2, s.Length - 2), NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out iValue))
                    {
                        filter.Values.Add(iValue);
                    }
                    else if (Int32.TryParse(s, out iValue))
                    {
                        filter.Values.Add(iValue);
                    }
                    else if (Double.TryParse(s, out dValue))
                    {
                        filter.Values.Add(dValue);
                    }
                    else
                    {
                        filter.Values.Add(s);
                    }
                }
            }
        }
예제 #3
0
        private void RadioExclude_CheckedChanged(object sender, EventArgs e)
        {
            int i = ItemFilter.SelectedIndex;

            if (i >= 0)
            {
                PropertyFilter filter = m_Filter.PropertyFilter[i];

                filter.Exclude = RadioExclude.Checked;
            }
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the SpyUO.LootFilter class.
        /// </summary>
        public LootFilter()
        {
            Array array = Enum.GetValues(typeof(ItemProperty));

            m_ItemFilter     = new bool[7 + array.Length];
            m_PropertyFilter = new PropertyFilter[7 + array.Length];

            for (int i = 0; i < m_ItemFilter.Length; i++)
            {
                m_ItemFilter[i]     = true;
                m_PropertyFilter[i] = new PropertyFilter();
            }

            m_MobileFilter = new Dictionary <string, bool>();
            m_Wearable     = true;
            m_Other        = true;
        }
예제 #5
0
        public bool Filters(Item item)
        {
            if (item != null)
            {
                Array array = Enum.GetValues(typeof(ItemProperty));

                for (int i = 0; i < m_ItemFilter.Length; i++)
                {
                    bool           on     = m_ItemFilter[i];
                    PropertyFilter filter = m_PropertyFilter[i];

                    if (on)
                    {
                        if (i >= array.Length)
                        {
                            switch (i - array.Length)
                            {
                            case 0: if (filter.Filters(item.Serial))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 1: if (filter.Filters(item.NameCliloc))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 2: if (filter.Filters(item.Name))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 3: if (filter.Filters(item.ItemID))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 4: if (filter.Filters(item.Hue))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 5: if (filter.Filters(item.Amount))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }

                            case 6: if (filter.Filters(item.Weight))
                                {
                                    return(true);
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            ItemProperty prop = (ItemProperty)i;

                            if (item.Properties.ContainsKey(prop) && filter.Filters(item.Properties[prop]))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }