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); }
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); }
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); }