private void InitPriceDataIfNeeded() { if (!(pricePlayerBuy > 0f)) { if (IsCurrency) { pricePlayerBuy = BaseMarketValue; pricePlayerSell = BaseMarketValue; } else { priceFactorBuy_TraderPriceType = PriceTypeFor(TradeAction.PlayerBuys).PriceMultiplier(); priceFactorSell_TraderPriceType = PriceTypeFor(TradeAction.PlayerSells).PriceMultiplier(); priceGain_PlayerNegotiator = TradeSession.playerNegotiator.GetStatValue(StatDefOf.TradePriceImprovement); priceGain_Settlement = TradeSession.trader.TradePriceImprovementOffsetForPlayer; priceFactorSell_ItemSellPriceFactor = AnyThing.GetStatValue(StatDefOf.SellPriceFactor); pricePlayerBuy = TradeUtility.GetPricePlayerBuy(AnyThing, priceFactorBuy_TraderPriceType, priceGain_PlayerNegotiator, priceGain_Settlement); pricePlayerSell = TradeUtility.GetPricePlayerSell(AnyThing, priceFactorSell_TraderPriceType, priceGain_PlayerNegotiator, priceGain_Settlement); if (pricePlayerSell >= pricePlayerBuy) { Log.ErrorOnce("Trying to put player-sells price above player-buys price for " + AnyThing, 65387); pricePlayerSell = pricePlayerBuy; } } } }
private void InitPriceDataIfNeeded() { if (this.pricePlayerBuy > 0f) { return; } if (this.IsCurrency) { this.pricePlayerBuy = this.BaseMarketValue; this.pricePlayerSell = this.BaseMarketValue; return; } this.priceFactorBuy_TraderPriceType = this.PriceTypeFor(TradeAction.PlayerBuys).PriceMultiplier(); this.priceFactorSell_TraderPriceType = this.PriceTypeFor(TradeAction.PlayerSells).PriceMultiplier(); this.priceGain_PlayerNegotiator = TradeSession.playerNegotiator.GetStatValue(StatDefOf.TradePriceImprovement, true); this.priceGain_Settlement = TradeSession.trader.TradePriceImprovementOffsetForPlayer; this.priceFactorSell_ItemSellPriceFactor = this.AnyThing.GetStatValue(StatDefOf.SellPriceFactor, true); this.pricePlayerBuy = TradeUtility.GetPricePlayerBuy(this.AnyThing, this.priceFactorBuy_TraderPriceType, this.priceGain_PlayerNegotiator, this.priceGain_Settlement); this.pricePlayerSell = TradeUtility.GetPricePlayerSell(this.AnyThing, this.priceFactorSell_TraderPriceType, this.priceGain_PlayerNegotiator, this.priceGain_Settlement); if (this.pricePlayerSell >= this.pricePlayerBuy) { Log.ErrorOnce("Trying to put player-sells price above player-buys price for " + this.AnyThing, 65387, false); this.pricePlayerSell = this.pricePlayerBuy; } }
private void InitPriceDataIfNeeded() { if (pricePlayerBuy > 0f) { return; } if (IsCurrency) { pricePlayerBuy = BaseMarketValue; pricePlayerSell = BaseMarketValue; return; } priceFactorBuy_TraderPriceType = PriceTypeFor(TradeAction.PlayerBuys).PriceMultiplier(); priceFactorSell_TraderPriceType = PriceTypeFor(TradeAction.PlayerSells).PriceMultiplier(); priceGain_PlayerNegotiator = TradeSession.playerNegotiator.GetStatValue(StatDefOf.TradePriceImprovement); priceGain_Settlement = TradeSession.trader.TradePriceImprovementOffsetForPlayer; priceFactorSell_ItemSellPriceFactor = AnyThing.GetStatValue(StatDefOf.SellPriceFactor); pricePlayerBuy = TradeUtility.GetPricePlayerBuy(AnyThing, priceFactorBuy_TraderPriceType, priceGain_PlayerNegotiator, priceGain_Settlement); pricePlayerSell = TradeUtility.GetPricePlayerSell(AnyThing, priceFactorSell_TraderPriceType, priceGain_PlayerNegotiator, priceGain_Settlement, TradeSession.TradeCurrency); if (pricePlayerSell >= pricePlayerBuy) { pricePlayerSell = pricePlayerBuy; } }