private static IEnumerable <string> GetAllRequiredApparelPerGroup(Pawn p) { if (p.royalty == null || !p.royalty.allowApparelRequirements) { yield break; } foreach (RoyalTitle t in p.royalty.AllTitlesInEffectForReading) { if (t.def.requiredApparel == null || t.def.requiredApparel.Count <= 0) { continue; } for (int i = 0; i < t.def.requiredApparel.Count; i++) { RoyalTitleDef.ApparelRequirement apparelRequirement = t.def.requiredApparel[i]; if (apparelRequirement.IsMet(p)) { continue; } IEnumerable <ThingDef> enumerable = apparelRequirement.AllRequiredApparelForPawn(p); foreach (ThingDef item in enumerable) { yield return(item.LabelCap); } } } yield return("ApparelRequirementAnyPrestigeArmor".Translate()); yield return("ApparelRequirementAnyPsycasterApparel".Translate()); }
private Apparel FindGarmentSatisfyingTitleRequirement(Pawn pawn, RoyalTitleDef.ApparelRequirement req) { Room room = pawn.GetRoom(); if (room.isPrisonCell) { foreach (IntVec3 cell in room.Cells) { List <Thing> thingList = cell.GetThingList(pawn.Map); for (int i = 0; i < thingList.Count; i++) { Apparel apparel = thingList[i] as Apparel; if (apparel != null && req.ApparelMeetsRequirement(thingList[i].def, allowUnmatched: false) && pawn.CanReserve(apparel) && !apparel.IsBurning() && (!EquipmentUtility.IsBiocoded(apparel) || EquipmentUtility.IsBiocodedFor(apparel, pawn)) && ApparelUtility.HasPartsToWear(pawn, apparel.def)) { return(apparel); } } } } return(null); }
private static IEnumerable <string> GetFirstRequiredApparelPerGroup(Pawn p) { if (p.royalty != null && p.royalty.allowApparelRequirements) { foreach (RoyalTitle t in p.royalty.AllTitlesInEffectForReading) { if (t.def.requiredApparel != null && t.def.requiredApparel.Count > 0) { for (int i = 0; i < t.def.requiredApparel.Count; i++) { RoyalTitleDef.ApparelRequirement apparelRequirement = t.def.requiredApparel[i]; if (!apparelRequirement.IsMet(p)) { yield return(apparelRequirement.AllRequiredApparelForPawn(p).First().LabelCap); } } } } yield return("ApparelRequirementAnyPrestigeArmor".Translate()); yield return("ApparelRequirementAnyPsycasterApparel".Translate()); } }