예제 #1
0
 public bool isValid(NPC npc)
 {
     if (IDs.Count > 0 && !IDs.Contains(npc.id))
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
    public bool isValid(string outfitType)
    {
        if (AllowedStyles.Count > 0)
        {
            if (AllowedStyles.Contains(outfitType))
            {
                return(true);
            }
            return(false);
        }

        if (ForbiddenStyles.Count > 0)
        {
            if (ForbiddenStyles.Contains(outfitType))
            {
                return(false);
            }
            return(true);
        }

        return(true);
    }
예제 #3
0
    public IEnumerable <Item> filter(IEnumerable <Item> items)
    {
        var result = new List <Item>();

        foreach (Item item in items)
        {
            if (Genders.Count > 0 && !Genders.Contains(item.Gender))
            {
                continue;
            }

            if (Slots.Count > 0 && !Slots.Contains(item.Slot))
            {
                continue;
            }

            if (Styles.Count > 0)
            {
                bool styleMatched = false;
                foreach (string style in Styles)
                {
                    if (item.Style.Contains(style))
                    {
                        styleMatched = true;
                        break;
                    }
                }
                if (!styleMatched)
                {
                    continue;
                }
            }

            if (Price != null)
            {
                if (Price.Length == 1)
                {
                    if (item.Price != Price[0])
                    {
                        continue;
                    }
                }
                else
                {
                    if (item.Price < Price[0] || item.Price > Price[1])
                    {
                        continue;
                    }
                }
            }

            if (Skimpiness != null)
            {
                if (Skimpiness.Length == 1)
                {
                    if (item.Skimpiness != Skimpiness[0])
                    {
                        continue;
                    }
                }
                else
                {
                    if (item.Skimpiness < Skimpiness[0] || item.Skimpiness > Skimpiness[1])
                    {
                        continue;
                    }
                }
            }

            if (Height != null)
            {
                if (Height.Length == 1)
                {
                    if (item.Height != Height[0])
                    {
                        continue;
                    }
                }
                else
                {
                    if (item.Height < Height[0] || item.Height > Height[1])
                    {
                        continue;
                    }
                }
            }

            result.Add(item);
        }


        return(result);
    }