public override IEnumerable <StatDrawEntry> SpecialDisplayStats()
        {
            foreach (Faction allFaction in Find.FactionManager.AllFactions)
            {
                RoyalTitleDef minTitleToUse = ThingRequiringRoyalPermissionUtility.GetMinTitleToUse(parent.def, allFaction);
                if (minTitleToUse != null)
                {
                    yield return(new StatDrawEntry(StatCategoryDefOf.BasicsNonPawnImportant, "Stat_Thing_MinimumRoyalTitle_Name".Translate(allFaction.Named("FACTION")).Resolve(), minTitleToUse.GetLabelCapForBothGenders(), "Stat_Thing_Weapon_MinimumRoyalTitle_Desc".Translate(allFaction.Named("FACTION")).Resolve(), 2100));
                }
            }
            if (traits.NullOrEmpty())
            {
                yield break;
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("Stat_Thing_PersonaWeaponTrait_Desc".Translate());
            stringBuilder.AppendLine();
            for (int i = 0; i < traits.Count; i++)
            {
                stringBuilder.AppendLine(traits[i].LabelCap + ": " + traits[i].description);
                if (i < traits.Count - 1)
                {
                    stringBuilder.AppendLine();
                }
            }
            yield return(new StatDrawEntry(StatCategoryDefOf.Weapon, "Stat_Thing_PersonaWeaponTrait_Label".Translate(), traits.Select((WeaponTraitDef x) => x.label).ToCommaList().CapitalizeFirst(), stringBuilder.ToString(), 5404));
        }
예제 #2
0
 public void Notify_RoyalThingUseViolation(Def implantOrWeapon, Pawn pawn, string violationSourceName, float detectionChance, int violationSourceLevel = 0)
 {
     if (!this.HostileTo(OfPlayer))
     {
         RoyalTitleDef minTitleToUse = ThingRequiringRoyalPermissionUtility.GetMinTitleToUse(implantOrWeapon, this, violationSourceLevel);
         string        arg           = (minTitleToUse == null) ? ((string)"None".Translate()) : minTitleToUse.GetLabelCapFor(pawn);
         TryAffectGoodwillWith(pawn.Faction, -4, canSendMessage: true, canSendHostilityLetter: true, "GoodwillChangedReason_UsedForbiddenThing".Translate(pawn.Named("PAWN"), violationSourceName.Named("CULPRIT")), pawn);
         Find.LetterStack.ReceiveLetter("LetterLawViolationDetectedLabel".Translate(pawn.Named("PAWN")).CapitalizeFirst(), "LetterLawViolationDetectedForbiddenThingUse".Translate(arg.Named("TITLE"), pawn.Named("PAWN"), violationSourceName.Named("CULPRIT"), this.Named("FACTION"), 4.ToString().Named("GOODWILL"), detectionChance.ToStringPercent().Named("CHANCE")), LetterDefOf.NegativeEvent, pawn);
     }
 }
예제 #3
0
 public override IEnumerable <StatDrawEntry> SpecialDisplayStats()
 {
     foreach (Faction allFaction in Find.FactionManager.AllFactions)
     {
         RoyalTitleDef minTitleToUse = ThingRequiringRoyalPermissionUtility.GetMinTitleToUse(parent.def, allFaction);
         if (minTitleToUse != null)
         {
             yield return(new StatDrawEntry(StatCategoryDefOf.BasicsNonPawnImportant, "Stat_Thing_MinimumRoyalTitle_Name".Translate(allFaction.Named("FACTION")).Resolve(), minTitleToUse.GetLabelCapForBothGenders(), "Stat_Thing_Weapon_MinimumRoyalTitle_Desc".Translate(allFaction.Named("FACTION")).Resolve(), 2100));
         }
     }
 }
        public static IEnumerable <ThingDef> GetAllowedThingDefs(ThingSetMakerParams parms)
        {
            TechLevel techLevel           = parms.techLevel ?? TechLevel.Undefined;
            IEnumerable <ThingDef> source = parms.filter.AllowedThingDefs;

            if (techLevel != 0)
            {
                source = source.Where((ThingDef x) => (int)x.techLevel <= (int)techLevel);
            }
            RoyalTitleDef highestTitle = null;

            if (parms.makingFaction != null && parms.makingFaction.def.HasRoyalTitles)
            {
                foreach (Pawn allMapsCaravansAndTravelingTransportPods_Alive_Colonist in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists)
                {
                    RoyalTitleDef royalTitleDef = ((allMapsCaravansAndTravelingTransportPods_Alive_Colonist.royalty != null) ? allMapsCaravansAndTravelingTransportPods_Alive_Colonist.royalty.GetCurrentTitle(parms.makingFaction) : null);
                    if (royalTitleDef != null && (highestTitle == null || royalTitleDef.seniority > highestTitle.seniority))
                    {
                        highestTitle = royalTitleDef;
                    }
                }
            }
            source = source.Where(delegate(ThingDef x)
            {
                CompProperties_Techprint compProperties = x.GetCompProperties <CompProperties_Techprint>();
                if (compProperties != null)
                {
                    if (parms.makingFaction != null && !compProperties.project.heldByFactionCategoryTags.Contains(parms.makingFaction.def.categoryTag))
                    {
                        return(false);
                    }
                    if (compProperties.project.IsFinished || compProperties.project.TechprintRequirementMet)
                    {
                        return(false);
                    }
                }
                if (parms.makingFaction != null && parms.makingFaction.def.HasRoyalTitles)
                {
                    RoyalTitleDef minTitleToUse = ThingRequiringRoyalPermissionUtility.GetMinTitleToUse(x, parms.makingFaction);
                    if (minTitleToUse != null && (highestTitle == null || highestTitle.seniority < minTitleToUse.seniority))
                    {
                        return(false);
                    }
                }
                return(true);
            });
            return(source.Where((ThingDef x) => CanGenerate(x) && (!parms.maxThingMarketValue.HasValue || x.BaseMarketValue <= parms.maxThingMarketValue) && (parms.validator == null || parms.validator(x))));
        }