Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public static int GetGoodwillChange(List <Tradeable> tradeables, Faction theirFaction)
        {
            float num = 0f;

            for (int i = 0; i < tradeables.Count; i++)
            {
                if (tradeables[i].ActionToDo == TradeAction.PlayerSells)
                {
                    int count = Mathf.Min(tradeables[i].CountToTransferToDestination, tradeables[i].CountHeldBy(Transactor.Colony));
                    num += FactionGiftUtility.GetBaseGoodwillChange(tradeables[i].AnyThing, count, tradeables[i].GetPriceFor(TradeAction.PlayerSells), theirFaction);
                }
            }
            return(FactionGiftUtility.PostProcessedGoodwillChange(num, theirFaction));
        }