public static int GetGoodwillChange(IEnumerable <IThingHolder> pods, SettlementBase giveTo) { float num = 0f; foreach (IThingHolder current in pods) { ThingOwner directlyHeldThings = current.GetDirectlyHeldThings(); for (int i = 0; i < directlyHeldThings.Count; i++) { float singlePrice; if (directlyHeldThings[i].def == ThingDefOf.Silver) { singlePrice = directlyHeldThings[i].MarketValue; } else { float priceFactorSell_TraderPriceType = (giveTo.TraderKind == null) ? 1f : giveTo.TraderKind.PriceTypeFor(directlyHeldThings[i].def, TradeAction.PlayerSells).PriceMultiplier(); float tradePriceImprovementOffsetForPlayer = giveTo.TradePriceImprovementOffsetForPlayer; singlePrice = TradeUtility.GetPricePlayerSell(directlyHeldThings[i], priceFactorSell_TraderPriceType, 1f, tradePriceImprovementOffsetForPlayer); } num += FactionGiftUtility.GetBaseGoodwillChange(directlyHeldThings[i], directlyHeldThings[i].stackCount, singlePrice, giveTo.Faction); } } return(FactionGiftUtility.PostProcessedGoodwillChange(num, giveTo.Faction)); }
public static int GetGoodwillChange(IEnumerable <IThingHolder> pods, SettlementBase giveTo) { float num = 0f; foreach (IThingHolder thingHolder in pods) { ThingOwner directlyHeldThings = thingHolder.GetDirectlyHeldThings(); for (int i = 0; i < directlyHeldThings.Count; i++) { float priceFactorSell_TraderPriceType = (giveTo.TraderKind == null) ? 1f : giveTo.TraderKind.PriceTypeFor(directlyHeldThings[i].def, TradeAction.PlayerSells).PriceMultiplier(); float tradePriceImprovementOffsetForPlayer = giveTo.TradePriceImprovementOffsetForPlayer; float pricePlayerSell = TradeUtility.GetPricePlayerSell(directlyHeldThings[i], priceFactorSell_TraderPriceType, 1f, tradePriceImprovementOffsetForPlayer); num += FactionGiftUtility.GetGoodwillChange(directlyHeldThings[i], directlyHeldThings[i].stackCount, pricePlayerSell, giveTo.Faction); } } return((int)num); }