public override void Curate(Package galleryPackage, INupkg nugetPackage, bool commitChanges) { // Make sure the target feed exists CuratedFeed feed = GetService <ICuratedFeedService>().GetFeedByName(CuratedFeedName, includePackages: true); if (feed != null && galleryPackage.Tags != null) { // Break the tags up so we can be sure we don't catch any partial matches (i.e. "foobar" when we're looking for "foo") string[] tags = galleryPackage.Tags.Split(); // Check if this package should be curated if (tags.Any(tag => RequiredTags.Contains(tag, StringComparer.OrdinalIgnoreCase))) { // It should! // But now we need to ensure that the package's dependencies are also curated if (DependenciesAreCurated(galleryPackage, feed)) { GetService <ICuratedFeedService>().CreatedCuratedPackage( feed, galleryPackage.PackageRegistration, automaticallyCurated: true, commitChanges: commitChanges); } } } }
private void LoadRequiredTags() { chkTagChessVariant.Checked = RequiredTags.Contains("Chess Variant"); chkTagDifferentArmies.Checked = RequiredTags.Contains("Different Armies"); chkTagHistoric.Checked = RequiredTags.Contains("Historic"); chkTagMultipleBoards.Checked = RequiredTags.Contains("Multiple Boards"); chkTagPopular.Checked = RequiredTags.Contains("Popular"); chkTagRandomArray.Checked = RequiredTags.Contains("Random Array"); chkTagRegional.Checked = RequiredTags.Contains("Regional"); chkTagMultiMove.Checked = RequiredTags.Contains("Multi-Move"); }
public override void Curate(Package galleryPackage, IPackage nugetPackage) { // Make sure the target feed exists CuratedFeed feed = GetService <ICuratedFeedByNameQuery>().Execute(CuratedFeedName, includePackages: false); if (feed != null && galleryPackage.Tags != null) { // Break the tags up so we can be sure we don't catch any partial matches (i.e. "foobar" when we're looking for "foo") string[] tags = galleryPackage.Tags.Split(); // Check if this package should be curated if (tags.Any(tag => RequiredTags.Contains(tag, StringComparer.OrdinalIgnoreCase))) { // It should! Add it to the curated feed GetService <ICreateCuratedPackageCommand>().Execute( feed.Key, galleryPackage.PackageRegistration.Key, automaticallyCurated: true); } } }
public (bool result, int bracketBonus) IsValidForAppearance(DateTime currentDate, string ownerValueName, Shop.ShopType shopType, List <string> planetTags, ProcGenStoreContentFeatureSettings settings) { // Check tags... if (RequiredTags.Any()) { // Check at least one required tag is present... // Unless we're populating a black market, and they're configured to circumvent required restrictions... if (RequiredTags.Any() && !planetTags.Any(s => RequiredTags.Contains(s)) && !(shopType == Shop.ShopType.BlackMarket && settings.BlackMarketSettings.CircumventRequiredPlanetTags)) { return(false, 0); } } if (RestrictedTags.Any() && planetTags.Any(s => RestrictedTags.Contains(s)) && !(shopType == Shop.ShopType.BlackMarket && settings.BlackMarketSettings.CircumventRestrictedPlanetTags)) { return(false, 0); } if (MinAppearanceDate.HasValue && MinAppearanceDate > currentDate) { return(false, 0); } if (!Purchasable) { return(false, 0); } return(true, 0); }
public static Act CreateEquipmentCheckAct(CreatureAI Agent, String Slot, EquipmentFallback Fallback, params String[] RequiredTags) { if (!Agent.Stats.CurrentClass.RequiresTools) { return(new Condition(() => true)); } if (Agent.Creature.Equipment.HasValue(out var equipment)) { return(new Sequence( new Select( new Condition(() => { // We aren't holding anything! Great. if (!equipment.GetItemInSlot(Slot).HasValue()) { return true; } if (equipment.GetItemInSlot(Slot).HasValue(out var item) && item.ResourceType.HasValue(out var res) && res.Tags.Any(t => RequiredTags.Contains(t))) { return true; } Agent.Blackboard.SetData("item-to-remove", item); return false; // We need to remove this tool! }), new UnequipAct(Agent) { BlackboardEntry = "item-to-remove" }), new Select( new Condition(() => { var equipped = equipment.GetItemInSlot(Slot); // If the equipped tool already matches. We shouldn't get here as the tool should already have been removed. if (equipped.HasValue(out var item) && item.ResourceType.HasValue(out var res)) { if (res.Tags.Any(t => RequiredTags.Contains(t))) { return true; } } // If the default is allowed, we do not already have a tool, and no tool is available - use default. // It is assumed that the enclosing act will see that the equiped item is null and properly use the default. if (Fallback == EquipmentFallback.AllowDefault && !equipment.GetItemInSlot(Slot).HasValue()) { if (!Agent.World.GetFirstStockpileContainingResourceWithMatchingTag(RequiredTags.ToList()).HasValue) { return true; } } return false; }), new Sequence( new GetAnySingleMatchingResourceAct(Agent, RequiredTags.ToList()) { BlackboardEntry = "tool-stashed" }, new EquipAct(Agent) { BlackboardEntry = "tool-stashed" } )))); } else { Debugger.RaiseDebugWarning("Encountered entity that requires tools but does not have an equipment component."); return(new Condition(() => false)); } }