예제 #1
0
 public override string CompInspectStringExtra()
 {
     if (ActiveRequest)
     {
         return("CaravanRequestInfo".Translate(TradeRequestUtility.RequestedThingLabel(requestThingDef, requestCount).CapitalizeFirst(), GenThing.ThingsToCommaList(rewards, useAnd: true).CapitalizeFirst(), (expiration - Find.TickManager.TicksGame).ToStringTicksToDays(), (requestThingDef.GetStatValueAbstract(StatDefOf.MarketValue) * (float)requestCount).ToStringMoney(), GenThing.GetMarketValue(rewards).ToStringMoney()));
     }
     return(null);
 }
 public override string CompInspectStringExtra()
 {
     if (this.ActiveRequest)
     {
         return("CaravanRequestInfo".Translate(new object[]
         {
             TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount).CapitalizeFirst(),
             GenThing.ThingsToCommaList(this.rewards, true, true, -1).CapitalizeFirst(),
             (this.expiration - Find.TickManager.TicksGame).ToStringTicksToDays("F1"),
             (this.requestThingDef.GetStatValueAbstract(StatDefOf.MarketValue, null) * (float)this.requestCount).ToStringMoney(null),
             GenThing.GetMarketValue(this.rewards).ToStringMoney(null)
         }));
     }
     return(null);
 }
        public override string CompInspectStringExtra()
        {
            string result;

            if (this.ActiveRequest)
            {
                result = "CaravanRequestInfo".Translate(new object[]
                {
                    TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount).CapitalizeFirst(),
                    GenThing.ThingsToCommaList(this.rewards, true, true, -1).CapitalizeFirst(),
                    (this.expiration - Find.TickManager.TicksGame).ToStringTicksToDays("F1")
                });
            }
            else
            {
                result = null;
            }
            return(result);
        }
        private Command FulfillRequestCommand(Caravan caravan)
        {
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandFulfillTradeOffer".Translate();
            command_Action.defaultDesc  = "CommandFulfillTradeOfferDesc".Translate();
            command_Action.icon         = TradeRequestComp.TradeCommandTex;
            command_Action.action       = delegate()
            {
                if (!this.ActiveRequest)
                {
                    Log.Error("Attempted to fulfill an unavailable request", false);
                }
                else if (!CaravanInventoryUtility.HasThings(caravan, this.requestThingDef, this.requestCount, new Func <Thing, bool>(this.PlayerCanGive)))
                {
                    Messages.Message("CommandFulfillTradeOfferFailInsufficient".Translate(new object[]
                    {
                        TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount)
                    }), MessageTypeDefOf.RejectInput, false);
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CommandFulfillTradeOfferConfirm".Translate(new object[]
                    {
                        GenLabel.ThingLabel(this.requestThingDef, null, this.requestCount),
                        GenThing.ThingsToCommaList(this.rewards, true, true, -1)
                    }), delegate
                    {
                        this.Fulfill(caravan);
                    }, false, null));
                }
            };
            if (!CaravanInventoryUtility.HasThings(caravan, this.requestThingDef, this.requestCount, new Func <Thing, bool>(this.PlayerCanGive)))
            {
                command_Action.Disable("CommandFulfillTradeOfferFailInsufficient".Translate(new object[]
                {
                    TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount)
                }));
            }
            return(command_Action);
        }
예제 #5
0
        private Command FulfillRequestCommand(Caravan caravan)
        {
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandFulfillTradeOffer".Translate();
            command_Action.defaultDesc  = "CommandFulfillTradeOfferDesc".Translate();
            command_Action.icon         = TradeCommandTex;
            command_Action.action       = delegate
            {
                if (!ActiveRequest)
                {
                    Log.Error("Attempted to fulfill an unavailable request");
                }
                else if (!CaravanInventoryUtility.HasThings(caravan, requestThingDef, requestCount, PlayerCanGive))
                {
                    Messages.Message("CommandFulfillTradeOfferFailInsufficient".Translate(TradeRequestUtility.RequestedThingLabel(requestThingDef, requestCount)), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CommandFulfillTradeOfferConfirm".Translate(GenLabel.ThingLabel(requestThingDef, null, requestCount), GenThing.ThingsToCommaList(rewards, useAnd: true)), delegate
                    {
                        Fulfill(caravan);
                    }));
                }
            };
            if (!CaravanInventoryUtility.HasThings(caravan, requestThingDef, requestCount, PlayerCanGive))
            {
                command_Action.Disable("CommandFulfillTradeOfferFailInsufficient".Translate(TradeRequestUtility.RequestedThingLabel(requestThingDef, requestCount)));
            }
            return(command_Action);
        }