コード例 #1
0
        private float CalcRequestedItemPrice(Tradeable item)
        {
            if (item.IsCurrency)
            {
                return(item.BaseMarketValue);
            }

            var basePrice       = item.BaseMarketValue;
            var negotiatorBonus = negotiator.GetStatValue(StatDefOf.TradePriceImprovement);
            var settlementBonus = GetOfferPriceImprovementOffsetForFaction(faction);
            var distMultiplier  = DetermineDistMultiplier(out _);
            var total           = basePrice * distMultiplier * requestingItemMarkupMultiplier;

            total -= total * negotiatorBonus;
            total -= total * settlementBonus;

            return(total);
        }
コード例 #2
0
ファイル: Utility.cs プロジェクト: jeremybris/RimBank
        public static void AskPayByBankNotes(Tradeable currency, bool isVirtual = false)
        {
            if (!isVirtual && !Methods.CanColonyAffordTrade(TradeSession.deal))
            {
                Find.WindowStack.WindowOfType <Dialog_Trade>().FlashSilver();
                Messages.Message("MessageColonyCannotAfford".Translate(), MessageTypeDefOf.RejectInput);
                return;
            }
            int playersilver        = currency.CountHeldBy(Transactor.Colony);
            int notesCountAvaliable = GetNotesCountAvaliable(Transactor.Colony);
            int countToTransfer     = currency.CountToTransfer;
            int num = 0;

            for (int num2 = Methods.cacheNotes.Count - 1; num2 > -1; num2--)
            {
                num += Methods.cacheNotes[num2].CountHeldBy(Transactor.Trader);
            }
            Find.WindowStack.Add(new Dialog_PayByBankNotes(countToTransfer, playersilver, notesCountAvaliable, currency.CountHeldBy(Transactor.Trader), num, isVirtual));
        }
コード例 #3
0
        internal static float PriceFor(this Tradeable _this, TradeAction action)
        {
            float num  = TradeSession.trader.TraderKind.PriceTypeFor(_this.ThingDef, action).PriceMultiplier();
            float num2 = TradeUtility.RandomPriceFactorFor(TradeSession.trader, _this);
            float num3 = 1f;

            if (TradeSession.playerNegotiator != null)
            {
                float num4 = Mathf.Clamp01(TradeSession.playerNegotiator.health.capacities.GetEfficiency(PawnCapacityDefOf.Talking));
                if (action == TradeAction.PlayerBuys)
                {
                    num3 += 1f - num4;
                }
                else
                {
                    num3 -= 0.5f * (1f - num4);
                }
            }
            float num5;

            if (action == TradeAction.PlayerBuys)
            {
                num5 = _this.BaseMarketValue * (1f - TradeSession.playerNegotiator.GetStatValue(StatDefOf.TradePriceImprovement, true)) * num3 * num * num2;
                num5 = Mathf.Max(num5, 0.01f);
            }
            else
            {
                num5  = _this.BaseMarketValue * Find.Storyteller.difficulty.baseSellPriceFactor * _this.AnyThing.GetStatValue(StatDefOf.SellPriceFactor, true) * (1f + TradeSession.playerNegotiator.GetStatValue(StatDefOf.TradePriceImprovement, true)) * num3 * num * num2;
                num5 *= Detours_Tradeable.LaunchPricePostFactorCurve.Evaluate(num5);
                num5  = Mathf.Max(num5, 0.01f);
                if (num5 >= _this.PriceFor(TradeAction.PlayerBuys))
                {
                    Log.ErrorOnce("Skill of negotitator trying to put sell price above buy price.", 65387);
                    num5 = _this.PriceFor(TradeAction.PlayerBuys);
                }
            }
            if (num5 > 99.5f)
            {
                num5 = Mathf.Round(num5);
            }
            return(num5);
        }
コード例 #4
0
ファイル: DynamicPrice.cs プロジェクト: ELLIOTTCABLE/RimIce
        public static void Postfix(Tradeable __instance, ref PriceType __result, TradeAction action)
        {
            if (__instance.ThingDef == Things.Resource_IceBlocks)
            {
                var mapTileIndex = TradeSession.playerNegotiator.Tile;

                var tileTemp = Current.Game.World.tileTemperatures.GetOutdoorTemp(mapTileIndex);

                var isBase = Current.Game.World.worldObjects.AnySettlementAt(mapTileIndex) && Current.Game.World.worldObjects.ObjectsAt(mapTileIndex).Any(x => !x.Faction.IsPlayer);

                var isColony = Current.Game.World.worldObjects.AnySettlementAt(mapTileIndex) && Current.Game.World.worldObjects.ObjectsAt(mapTileIndex).Any(x => x.Faction.IsPlayer);

                if (action == TradeAction.PlayerBuys)
                {
                    if (isColony)
                    {
                        // ice trader
                        __result = PriceType.Normal;
                    }
                    else if (isBase)
                    {
                        // buy from faction base
                        __result = (PriceType)(byte)Math.Round(Math.Exp(tileTemp / 20)); // for celsius degrees
                    }
                }
                else
                {
                    if (isColony)
                    {
                        // caravan buys at this cost
                        __result = (PriceType)(byte)(tileTemp < 0 ? 1 : tileTemp < 20 ? 2 : tileTemp < 30 ? 3 : 4);
                    }
                    else if (isBase)
                    {
                        // sell to faction base
                        __result = (PriceType)(byte)Math.Round(Math.Exp(tileTemp / 20) / 2); // for celsius degrees
                    }
                }
            }
        }
コード例 #5
0
ファイル: Trading.cs プロジェクト: rwmt/Multiplayer
        private void CheckReassign(Tradeable tradeable, Transactor side)
        {
            List <Thing> things = side == Transactor.Colony ? tradeable.thingsColony : tradeable.thingsTrader;

            for (int j = things.Count - 1; j >= 1; j--)
            {
                Thing             thing = things[j];
                TransferAsOneMode mode  = tradeable.TraderWillTrade ? TransferAsOneMode.Normal : TransferAsOneMode.InactiveTradeable;

                if (recacheThings.Contains(thing))
                {
                    if (!TransferableUtility.TransferAsOne(tradeable.AnyThing, thing, mode))
                    {
                        things.RemoveAt(j);
                    }
                    else
                    {
                        AddToTradeables(thing, side);
                    }
                }
            }
        }
コード例 #6
0
 private void CacheTradeables()
 {
     cachedCurrencyTradeable = TradeSession.deal.AllTradeables.FirstOrDefault((Tradeable x) => x.IsCurrency && (TradeSession.TradeCurrency != TradeCurrency.Favor || x.IsFavor));
     cachedTradeables        = (from tr in TradeSession.deal.AllTradeables
                                where !tr.IsCurrency && (tr.TraderWillTrade || !TradeSession.trader.TraderKind.hideThingsNotWillingToTrade)
                                select tr).OrderByDescending(delegate(Tradeable tr)
     {
         if (!tr.TraderWillTrade)
         {
             return(-1);
         }
         return(0);
     }).ThenBy((Tradeable tr) => tr, sorter1.Comparer).ThenBy((Tradeable tr) => tr, sorter2.Comparer).ThenBy((Tradeable tr) => TransferableUIUtility.DefaultListOrderPriority(tr)).ThenBy((Tradeable tr) => tr.ThingDef.label).ThenBy(delegate(Tradeable tr)
     {
         QualityCategory result;
         if (tr.AnyThing.TryGetQuality(out result))
         {
             return((int)result);
         }
         return(-1);
     }).ThenBy((Tradeable tr) => tr.AnyThing.HitPoints).ToList <Tradeable>();
 }
コード例 #7
0
        public Dialog_PayByBankNotes(int expense, int playersilver, int playernotes, int tradersilver, int tradernotes, bool isVirtual)
        {
            forcePause      = true;
            silverTradeable = new Tradeable();
            notesTradeable  = new Tradeable();
            this.isVirtual  = isVirtual;

            Thing item = new Thing
            {
                def        = ThingDefOf.Silver,
                stackCount = playersilver
            };

            silverTradeable.thingsColony.Add(item);

            item = new Thing
            {
                def        = ThingDefOf.Silver,
                stackCount = tradersilver
            };
            silverTradeable.thingsTrader.Add(item);

            item = new Thing
            {
                def        = BankDefOf.BankNote,
                stackCount = playernotes
            };
            notesTradeable.thingsColony.Add(item);

            item = new Thing
            {
                def        = BankDefOf.BankNote,
                stackCount = tradernotes
            };
            notesTradeable.thingsTrader.Add(item);
            silverTradeable.ForceTo(expense);
        }
コード例 #8
0
 public virtual bool CustomCheckViolation(Tradeable silver, Tradeable notes)
 {
     return(false);
 }
コード例 #9
0
        public static void DrawTradeableRow(Rect rect, Tradeable trad, int index)
        {
            if (index % 2 == 1)
            {
                GUI.DrawTexture(rect, TradeUI.TradeAlternativeBGTex);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float num  = rect.width;
            int   num2 = trad.CountHeldBy(Transactor.Trader);

            if (num2 != 0)
            {
                Rect rect2 = new Rect(num - 75f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect2))
                {
                    Widgets.DrawHighlight(rect2);
                }
                Text.Anchor = TextAnchor.MiddleRight;
                Rect rect3 = rect2;
                rect3.xMin += 5f;
                rect3.xMax -= 5f;
                Widgets.Label(rect3, num2.ToStringCached());
                TooltipHandler.TipRegion(rect2, "TraderCount".Translate());
                Rect rect4 = new Rect(rect2.x - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleRight;
                TradeUI.DrawPrice(rect4, trad, TradeAction.PlayerBuys);
            }
            num -= 175f;
            Rect rect5 = new Rect(num - 240f, 0f, 240f, rect.height);

            TradeUI.DrawCountAdjustInterface(rect5, trad);
            num -= 240f;
            int num3 = trad.CountHeldBy(Transactor.Colony);

            if (num3 != 0)
            {
                Rect rect6 = new Rect(num - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                TradeUI.DrawPrice(rect6, trad, TradeAction.PlayerSells);
                Rect rect7 = new Rect(rect6.x - 75f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect7))
                {
                    Widgets.DrawHighlight(rect7);
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect8 = rect7;
                rect8.xMin += 5f;
                rect8.xMax -= 5f;
                Widgets.Label(rect8, num3.ToStringCached());
                TooltipHandler.TipRegion(rect7, "ColonyCount".Translate());
            }
            num -= 175f;
            Rect rect9 = new Rect(0f, 0f, num, rect.height);

            if (Mouse.IsOver(rect9))
            {
                Widgets.DrawHighlight(rect9);
            }
            Rect rect10 = new Rect(0f, 0f, 27f, 27f);

            Widgets.ThingIcon(rect10, trad.AnyThing);
            Widgets.InfoCardButton(40f, 0f, trad.AnyThing);
            Text.Anchor = TextAnchor.MiddleLeft;
            Rect rect11 = new Rect(80f, 0f, rect9.width - 80f, rect.height);

            Text.WordWrap = false;
            Widgets.Label(rect11, trad.Label);
            Text.WordWrap = true;
            Tradeable localTrad = trad;

            TooltipHandler.TipRegion(rect9, new TipSignal(delegate
            {
                if (!localTrad.HasAnyThing)
                {
                    return(string.Empty);
                }
                return(localTrad.Label + ": " + localTrad.TipDescription);
            }, localTrad.GetHashCode()));
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }
コード例 #10
0
        public void DrawTradeableRow(Rect rect, Tradeable trad, int index)
        {
            if (index == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float width = rect.width;
            int   num   = trad.CountHeldBy(Transactor.Trader);

            if (num != 0)
            {
                Rect rect2 = new Rect(width - 75f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect2))
                {
                    Widgets.DrawHighlight(rect2);
                }
                Text.Anchor = TextAnchor.MiddleRight;
                Rect rect3 = rect2;
                rect3.xMin += 5f;
                rect3.xMax -= 5f;
                Widgets.Label(rect3, num.ToStringCached());
                TooltipHandler.TipRegion(rect2, "TraderCount".Translate());
            }
            width -= 85f;
            Rect rect4 = new Rect(width - 240f, 0f, 240f, rect.height);

            if (index == 2 && notesTradeable.CountHeldBy(Transactor.Colony) == 0 && notesTradeable.CountHeldBy(Transactor.Trader) == 0)
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                Color color = GUI.color;
                GUI.color = Color.gray;
                Widgets.Label(rect4, "NoNotes".Translate());
                GUI.color = color;
            }
            else if (index == 1 && isVirtual && VirtualTrader.SilverAlsoAdjustable)
            {
                ExtUtil.DoCountAdjustInterfaceForSilver(rect4, trad, index, -trad.CountHeldBy(Transactor.Colony), trad.CountHeldBy(Transactor.Trader), flash: false);
            }
            else
            {
                TransferableUIUtility.DoCountAdjustInterface(rect4, trad, index, -trad.CountHeldBy(Transactor.Colony), trad.CountHeldBy(Transactor.Trader));
            }
            width -= 240f;
            int num2 = trad.CountHeldBy(Transactor.Colony);

            if (num2 != 0)
            {
                Rect rect5 = new Rect(width - 75f - 10f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect5))
                {
                    Widgets.DrawHighlight(rect5);
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect6 = rect5;
                rect6.xMin += 5f;
                rect6.xMax -= 5f;
                Widgets.Label(rect6, num2.ToStringCached());
                TooltipHandler.TipRegion(rect5, "ColonyCount".Translate());
            }
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }
コード例 #11
0
        private static void DrawPrice(Rect rect, Tradeable trad, TradeAction action)
        {
            if (trad.IsCurrency || !trad.TraderWillTrade)
            {
                return;
            }
            rect = rect.Rounded();
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            float     num   = trad.PriceFor(action);
            PriceType pType = PriceTypeUtlity.ClosestPriceType(num / trad.BaseMarketValue);

            switch (pType)
            {
            case PriceType.VeryCheap:
                GUI.color = new Color(0f, 1f, 0f);
                break;

            case PriceType.Cheap:
                GUI.color = new Color(0.5f, 1f, 0.5f);
                break;

            case PriceType.Normal:
                GUI.color = Color.white;
                break;

            case PriceType.Expensive:
                GUI.color = new Color(1f, 0.5f, 0.5f);
                break;

            case PriceType.Exorbitant:
                GUI.color = new Color(1f, 0f, 0f);
                break;
            }
            float factor = TradeUtility.RandomPriceFactorFor(TradeSession.trader, trad);

            factor = (factor - 1) * 100;
            string        label      = "$" + num.ToString("F2") + " (" + factor.ToString("F1") + "%)";
            Func <string> textGetter = delegate
            {
                if (!trad.HasAnyThing)
                {
                    return(string.Empty);
                }
                return(((action != TradeAction.PlayerBuys) ? "SellPriceDesc".Translate() : "BuyPriceDesc".Translate()) + "\n\n" + "PriceTypeDesc".Translate(("PriceType" + pType).Translate()));
            };

            TooltipHandler.TipRegion(rect, new TipSignal(textGetter, trad.GetHashCode() * 297));
            Rect rect2 = new Rect(rect);

            rect2.xMax -= 5f;
            rect2.xMin += 5f;
            if (Text.Anchor == TextAnchor.MiddleLeft)
            {
                rect2.xMax += 300f;
            }
            if (Text.Anchor == TextAnchor.MiddleRight)
            {
                rect2.xMin -= 300f;
            }
            Widgets.Label(rect2, label);
            GUI.color = Color.white;
        }
コード例 #12
0
 public override bool CustomCheckViolation(Tradeable silver, Tradeable notes)
 {
     return(silver.CountPostDealFor(Transactor.Trader) < 0);
 }
コード例 #13
0
 public static void Tradeable_GetPriceFor_Patch(Tradeable __instance) =>
     __instance.InitPriceDataIfNeeded();
コード例 #14
0
ファイル: HashCodes.cs プロジェクト: rwmt/Multiplayer
 static void Postfix(Tradeable __instance, ref int __result)
 {
     __result = RuntimeHelpers.GetHashCode(__instance);
 }
コード例 #15
0
        private void DrawTradeableRow(Rect rowRect, ThingEntry entry, int index)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(rowRect);
            }
            Tradeable trade = entry.tradeable;

            // Begin Row group
            GUI.BeginGroup(rowRect);
            float x = 0; // starting from left

            // Draw item icon and info icon
            Text.Anchor = TextAnchor.MiddleLeft;
            Rect idRect = new Rect(x, 0, iconNameAreaWidth, rowRect.height);

            TransferableUIUtility.DoExtraAnimalIcons(trade, rowRect, ref x);
            DrawTradeableLabels(idRect, entry);

            x += iconNameAreaWidth;

            // Draw the price for requesting the item
            Rect  priceTextArea = new Rect(x, 0, priceTextAreaWidth, rowRect.height);
            float price         = DrawPrice(priceTextArea, trade);

            x += priceTextAreaWidth;

            // Draw the number the colony currently has, if any
            int colonyItemCount = trade.CountHeldBy(Transactor.Colony);

            if (colonyItemCount != 0)
            {
                Rect colonyItemCountArea = new Rect(x, 0, colonyItemCountAreaWidth, rowRect.height);
                if (Mouse.IsOver(colonyItemCountArea))
                {
                    Widgets.DrawHighlight(colonyItemCountArea);
                }
                Rect paddedRect = colonyItemCountArea;
                paddedRect.xMin += 5f;
                paddedRect.xMax -= 5f;
                Widgets.Label(paddedRect, colonyItemCount.ToStringCached());
                TooltipHandler.TipRegion(colonyItemCountArea, colonyCountTooltipText);
            }

            // Draw the input box to select number of requests
            Rect countAdjustInterfaceRect    = new Rect(rightAlignOffset, 0, rightContentSize, rowRect.height);
            Rect interactiveNumericFieldArea = new Rect(countAdjustInterfaceRect.center.x - 45f, countAdjustInterfaceRect.center.y - 12.5f, 90f, 25f).Rounded();
            Rect paddedNumericFieldArea      = interactiveNumericFieldArea.ContractedBy(2f);

            paddedNumericFieldArea.xMax -= 15f;
            paddedNumericFieldArea.xMin += 16f;

            int    amountRequested = requestSession.deal.GetCountForItem(thingTypeFilter, trade);
            string amountAsString  = amountRequested.ToString();

            Widgets.TextFieldNumeric(paddedNumericFieldArea, ref amountRequested, ref amountAsString, 0, float.MaxValue);
            requestSession.deal.AdjustItemRequest(thingTypeFilter, entry, amountRequested, price);

            // Draw the reset to zero button by input field
            if (amountRequested > 0)
            {
                Rect resetToZeroButton = interactiveNumericFieldArea;
                resetToZeroButton.x    -= resetItemCountAreaWidth - 5;
                resetToZeroButton.width = resetItemCountAreaWidth;
                if (Widgets.ButtonText(resetToZeroButton, "0"))
                {
                    requestSession.deal.AdjustItemRequest(thingTypeFilter, entry, 0, price);
                }
            }

            // End Row group
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }
コード例 #16
0
        private static void DrawCountAdjustInterface(Rect rect, Tradeable trad)
        {
            Rect rect2 = new Rect(rect.center.x - 45f, rect.center.y - 12.5f, 90f, 25f);

            if (Time.time - Dialog_Trade.lastCurrencyFlashTime < 1f && trad.IsCurrency)
            {
                GUI.DrawTexture(rect2, TradeUI.SilverFlashTex);
            }
            if (!trad.IsCurrency)
            {
                int   num  = trad.CountHeldBy(Transactor.Colony) + trad.CountHeldBy(Transactor.Trader);
                float num2 = (float)num / 400f;
                if (num2 < 1f)
                {
                    num2 = 1f;
                }
                if (DragSliderManager.DragSlider(rect2, num2, new DragSliderCallback(TradeSliders.TradeSliderDraggingStarted), new DragSliderCallback(TradeSliders.TradeSliderDraggingUpdate), new DragSliderCallback(TradeSliders.TradeSliderDraggingCompleted)))
                {
                    TradeSliders.dragTrad              = trad;
                    TradeSliders.dragBaseAmount        = trad.countToDrop;
                    TradeSliders.dragLimitWarningGiven = false;
                }
            }
            int    countToDrop = trad.countToDrop;
            string label;

            if (countToDrop > 0)
            {
                label = countToDrop.ToString();
            }
            else if (countToDrop < 0)
            {
                label = (-countToDrop).ToString();
            }
            else
            {
                GUI.color = TradeUI.NoTradeColor;
                label     = "0";
            }
            if (Mouse.IsOver(rect2))
            {
                GUI.color = Color.yellow;
            }
            if (trad.IsCurrency)
            {
                GUI.color = Color.white;
            }
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect2, label);
            Text.Anchor = TextAnchor.UpperLeft;
            GUI.color   = Color.white;
            if (!trad.IsCurrency)
            {
                if (trad.CanSetToDropOneMore().Accepted)
                {
                    Rect rect3 = new Rect(rect2.x - 30f, rect.y, 30f, rect.height);
                    if (Widgets.TextButton(rect3, "<", true, false))
                    {
                        AcceptanceReport acceptanceReport = trad.TrySetToDropOneMore();
                        if (!acceptanceReport.Accepted)
                        {
                            Messages.Message(acceptanceReport.Reason, MessageSound.RejectInput);
                        }
                        else
                        {
                            SoundDefOf.TickHigh.PlayOneShotOnCamera();
                        }
                    }
                    rect3.x -= rect3.width;
                    if (Widgets.TextButton(rect3, "<<", true, false))
                    {
                        trad.SetToDropMax();
                        SoundDefOf.TickHigh.PlayOneShotOnCamera();
                    }
                }
                if (trad.CanSetToLaunchOneMore().Accepted)
                {
                    Rect rect4 = new Rect(rect2.xMax, rect.y, 30f, rect.height);
                    if (Widgets.TextButton(rect4, ">", true, false))
                    {
                        AcceptanceReport acceptanceReport2 = trad.TrySetToLaunchOneMore();
                        if (!acceptanceReport2.Accepted)
                        {
                            Messages.Message(acceptanceReport2.Reason, MessageSound.RejectInput);
                        }
                        else
                        {
                            SoundDefOf.TickLow.PlayOneShotOnCamera();
                        }
                    }
                    rect4.x += rect4.width;
                    if (Widgets.TextButton(rect4, ">>", true, false))
                    {
                        trad.SetToLaunchMax();
                        SoundDefOf.TickLow.PlayOneShotOnCamera();
                    }
                }
            }
            if (trad.countToDrop != 0)
            {
                Rect position = new Rect(rect2.x + rect2.width / 2f - (float)(TradeUI.TradeArrow.width / 2), rect2.y + rect2.height / 2f - (float)(TradeUI.TradeArrow.height / 2), (float)TradeUI.TradeArrow.width, (float)TradeUI.TradeArrow.height);
                if (trad.countToDrop > 0)
                {
                    position.x     += position.width;
                    position.width *= -1f;
                }
                GUI.DrawTexture(position, TradeUI.TradeArrow);
            }
            if (!trad.TraderWillTrade)
            {
                GUI.color = new Color(0.5f, 0.5f, 0.5f);
                Widgets.DrawLineHorizontal(rect2.x + rect2.width / 3f, rect2.y + rect2.height / 2f, rect2.width / 3f);
                GUI.color = Color.white;
            }
        }
コード例 #17
0
        private string GetPriceTooltip(Faction faction, Pawn negotiator, Tradeable trad, float priceFor)
        {
            if (!trad.HasAnyThing)
            {
                return(string.Empty);
            }

            string text = "IR.ItemRequestWindow.PriceUponDelivery".Translate();

            text += "\n\n";
            text  = text + StatDefOf.MarketValue.LabelCap + ": " + trad.BaseMarketValue.ToStringMoney("F2");

            string text2 = text;

            text = string.Concat(new string[]
            {
                text2,
                "\n  x ",
                requestingItemMarkupMultiplier.ToString("F2"),
                "IR.ItemRequestWindow.Requesting".Translate()
            });

            if (Find.Storyteller.difficulty.tradePriceFactorLoss != 0f)
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "\n  x ",
                    (1f + Find.Storyteller.difficulty.tradePriceFactorLoss).ToString("F2"),
                    " (",
                    "DifficultyLevel".Translate(),
                    ")"
                });
            }

            float daysToTravel;
            float distPriceOffset = DetermineDistMultiplier(out daysToTravel);

            text += "\n";
            text2 = text;
            text  = string.Concat(new string[]
            {
                text2,
                "\n",
                "IR.ItemRequestWindow.DeliveryCharge".Translate(daysToTravel.ToString("F1")),
                " x",
                distPriceOffset.ToString("F2")
            });

            text += "\n";
            text2 = text;
            text  = string.Concat(new string[]
            {
                text2,
                "\n",
                "YourNegotiatorBonus".Translate(),
                ": -",
                negotiator.GetStatValue(StatDefOf.TradePriceImprovement, true).ToStringPercent()
            });

            float priceGainSettlement = GetOfferPriceImprovementOffsetForFaction(faction);

            if (priceGainSettlement != 0f)
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "\n",
                    "IR.ItemRequestWindow.FactionRelationOffset".Translate(),
                    " ",
                    Mathf.Sign(priceGainSettlement) >= 0 ? "-" : "+",
                    Mathf.Abs(priceGainSettlement).ToStringPercent()
                });
            }

            text += "\n\n";
            text  = text + "FinalPrice".Translate() + ": " + priceFor.ToStringMoney("F2");
            if (priceFor <= 0.01f)
            {
                text = text + " (" + "minimum".Translate() + ")";
            }
            return(text);
        }
コード例 #18
0
ファイル: TradingUI.cs プロジェクト: vasilevp/Multiplayer
 private bool RemoveCachedTradeable(Tradeable t)
 {
     dialog?.cachedTradeables.Remove(t);
     return(true);
 }
コード例 #19
0
 public static bool CheckVisible(Tradeable tradable)
 {
     return(SearchUtility.regulatedKeyword.Length <= 0 || SearchUtility.RegulateString(tradable.LabelCap).Contains(SearchUtility.regulatedKeyword));
 }