Example #1
0
 public static float ApparelScoreRaw([NotNull] Pawn pawn, [NotNull] Apparel apparel)
 {
     if (pawn == null)
     {
         throw new ArgumentNullException(nameof(pawn));
     }
     if (apparel == null)
     {
         throw new ArgumentNullException(nameof(apparel));
     }
     if (!(pawn.outfits.CurrentOutfit is ExtendedOutfit outfit))
     {
         Log.ErrorOnce("OutfitManager: Not an ExtendedOutfit, something went wrong.", 399441);
         return(0f);
     }
     #if DEBUG
     Log.Message($"OutfitManager: ----- '{pawn.Name}' - '{apparel.def.defName}' ({apparel.Label}) -----", true);
     #endif
     var statPriorities =
         StatPriorityHelper.CalculateStatPriorities(pawn, outfit.StatPriorities, outfit.AutoWorkPriorities);
     var score = ApparelScoreRawPriorities(apparel, statPriorities);
     ApplyHitPointsScoring(apparel, ref score);
     ApplySpecialScoring(apparel, ref score);
     ApplyInsulationScoring(pawn, apparel, ref score);
     ApplyTaintedScoring(pawn, apparel, outfit, ref score);
     ApplyHumanLeatherScoring(pawn, apparel, ref score);
     ApplyGenderScoring(pawn, apparel, ref score);
     ApplyRoyalTitleScoring(pawn, apparel, ref score);
     #if DEBUG
     Log.Message($"OutfitManager: Total score of '{apparel.Label}' for pawn '{pawn.Name}' = {score}", true);
     Log.Message("OutfitManager: -----------------------------------------------------------------", true);
     #endif
     return(score);
 }
 public void SetDefaultStatPriorities(IEnumerable <StatPriority> defaultStatPriorities)
 {
     if (defaultStatPriorities == null)
     {
         return;
     }
     foreach (var statPriority in _statPriorities)
     {
         statPriority.Default = float.NaN;
     }
     foreach (var statPriority in defaultStatPriorities)
     {
         StatPriorityHelper.SetDefaultStatPriority(_statPriorities, statPriority.Stat, statPriority.Weight);
     }
 }