Ejemplo n.º 1
0
        private bool IsNpcLootBlacklisted(NPC npc, out bool isGroup)
        {
            if (this.Filters.NpcLootBlacklist.Contains(new NPCDefinition(npc.type)))
            {
                isGroup = false;
                return(true);
            }

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

                if (EntityGroups.TryGetGroupsPerNPC(npc.type, out grpsPerNPC))
                {
                    foreach (string grpName in grpsPerNPC)
                    {
                        if (this.Filters.NpcLootGroupBlacklist.Contains(grpName))
                        {
                            isGroup = true;
                            return(true);
                        }
                    }
                }
            }

            isGroup = false;
            return(false);
        }
Ejemplo n.º 2
0
        private bool AutoInitiailizeElementOfGroupNPC(NPC npc)
        {
            var config = ElementsConfig.Instance;
            IReadOnlySet <string> grpNames;

            if (!EntityGroups.TryGetGroupsPerNPC(npc.type, out grpNames))
            {
                return(false);
            }

            float autoChance = -1f;

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

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

            ElementDefinition elemDef = ElementDefinition.PickDefinitionForNPC(autoChance);

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

            return(true);
        }
Ejemplo n.º 3
0
        public IList <string> GetNpcLootBlacklistGroupEntriesForNpc(NPC npc)
        {
            IList <string> groups = new List <string>();

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

                if (EntityGroups.TryGetGroupsPerNPC(npc.type, out grpsPerNPC))
                {
                    foreach (string grpName in grpsPerNPC)
                    {
                        if (this.Filters.NpcLootGroupBlacklist.Contains(grpName))
                        {
                            groups.Add(grpName);
                        }
                    }
                }
            }

            return(groups);
        }