Exemplo n.º 1
0
        internal bool IsItemBlacklisted(Item item, out bool isGroup)
        {
            if (this.Filters.ItemBlacklist.Contains(new ItemDefinition(item.type)))
            {
                isGroup = false;
                return(true);
            }

            lock (this.MyLock) {
                IReadOnlySet <string> grpsPerItem;

                if (EntityGroups.TryGetGroupsPerItem(item.type, out grpsPerItem))
                {
                    foreach (string grpName in grpsPerItem)
                    {
                        if (this.Filters.ItemGroupBlacklist.Contains(grpName))
                        {
                            isGroup = true;
                            return(true);
                        }
                    }
                }
            }

            isGroup = false;
            return(false);
        }
Exemplo n.º 2
0
        private bool AutoInitializeElementOfGroupItem(Item item)
        {
            var config = ElementsConfig.Instance;
            IReadOnlySet <string> grpNames;

            if (!EntityGroups.TryGetGroupsPerItem(item.type, out grpNames))
            {
                return(false);
            }

            float autoChance = -1f;

            foreach (string grpName in grpNames)
            {
                if (config.AutoAssignedAnyOfItemGroup.ContainsKey(grpName))
                {
                    autoChance = config.AutoAssignedAnyOfItemGroup[grpName];
                    break;
                }
            }

            if (autoChance == -1f)
            {
                return(false);
            }

            ElementDefinition elemDef = ElementDefinition.PickDefinitionForItem(autoChance);

            if (elemDef != null)
            {
                this.Elements.Add(elemDef);
            }

            return(true);
        }
Exemplo n.º 3
0
        ////////////////

        public IList <string> GetItemWhitelistGroupEntriesForItem(Item item)
        {
            IList <string> groups = new List <string>();

            lock (this.MyLock) {
                IReadOnlySet <string> grpsPerItem;

                if (EntityGroups.TryGetGroupsPerItem(item.type, out grpsPerItem))
                {
                    foreach (string grpName in grpsPerItem)
                    {
                        if (this.Filters.ItemGroupWhitelist.Contains(grpName))
                        {
                            groups.Add(grpName);
                        }
                    }
                }
            }

            return(groups);
        }