Ejemplo n.º 1
0
 public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
 {
     if (this.CanTradeNow && CaravanVisitUtility.SettlementVisitedNow(caravan) == this)
     {
         yield return(CaravanVisitUtility.TradeCommand(caravan));
     }
     if (CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(caravan, this))
     {
         yield return(FactionGiftUtility.OfferGiftsCommand(caravan, this));
     }
     foreach (Gizmo g in base.GetCaravanGizmos(caravan))
     {
         yield return(g);
     }
     if (this.Attackable)
     {
         yield return(new Command_Action
         {
             icon = SettlementBase.AttackCommand,
             defaultLabel = "CommandAttackSettlement".Translate(),
             defaultDesc = "CommandAttackSettlementDesc".Translate(),
             action = delegate
             {
                 SettlementUtility.Attack(caravan, this.$this);
             }
         });
     }
 }
Ejemplo n.º 2
0
 public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan)
 {
     foreach (FloatMenuOption floatMenuOption in base.GetFloatMenuOptions(caravan))
     {
         yield return(floatMenuOption);
     }
     if (CaravanVisitUtility.SettlementVisitedNow(caravan) != this)
     {
         foreach (FloatMenuOption floatMenuOption2 in CaravanArrivalAction_VisitSettlement.GetFloatMenuOptions(caravan, this))
         {
             yield return(floatMenuOption2);
         }
     }
     foreach (FloatMenuOption floatMenuOption3 in CaravanArrivalAction_Trade.GetFloatMenuOptions(caravan, this))
     {
         yield return(floatMenuOption3);
     }
     foreach (FloatMenuOption floatMenuOption4 in CaravanArrivalAction_OfferGifts.GetFloatMenuOptions(caravan, this))
     {
         yield return(floatMenuOption4);
     }
     foreach (FloatMenuOption floatMenuOption5 in CaravanArrivalAction_AttackSettlement.GetFloatMenuOptions(caravan, this))
     {
         yield return(floatMenuOption5);
     }
 }
Ejemplo n.º 3
0
 public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
 {
     if (CanTradeNow && CaravanVisitUtility.SettlementVisitedNow(caravan) == this)
     {
         yield return(CaravanVisitUtility.TradeCommand(caravan, base.Faction, TraderKind));
     }
     if ((bool)CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(caravan, this))
     {
         yield return(FactionGiftUtility.OfferGiftsCommand(caravan, this));
     }
     foreach (Gizmo caravanGizmo in base.GetCaravanGizmos(caravan))
     {
         yield return(caravanGizmo);
     }
     if (Attackable)
     {
         Command_Action command_Action = new Command_Action();
         command_Action.icon         = AttackCommand;
         command_Action.defaultLabel = "CommandAttackSettlement".Translate();
         command_Action.defaultDesc  = "CommandAttackSettlementDesc".Translate();
         command_Action.action       = delegate
         {
             SettlementUtility.Attack(caravan, this);
         };
         yield return(command_Action);
     }
 }
        public override FloatMenuAcceptanceReport StillValid(Caravan caravan, int destinationTile)
        {
            FloatMenuAcceptanceReport floatMenuAcceptanceReport = base.StillValid(caravan, destinationTile);

            if (!floatMenuAcceptanceReport)
            {
                return(floatMenuAcceptanceReport);
            }
            if (this.settlement != null && this.settlement.Tile != destinationTile)
            {
                return(false);
            }
            return(CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(caravan, this.settlement));
        }
Ejemplo n.º 5
0
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan)
        {
            using (IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(caravan).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    FloatMenuOption o = enumerator.Current;
                    yield return(o);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (CaravanVisitUtility.SettlementVisitedNow(caravan) != this)
            {
                using (IEnumerator <FloatMenuOption> enumerator2 = CaravanArrivalAction_VisitSettlement.GetFloatMenuOptions(caravan, this).GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        FloatMenuOption f3 = enumerator2.Current;
                        yield return(f3);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            using (IEnumerator <FloatMenuOption> enumerator3 = CaravanArrivalAction_OfferGifts.GetFloatMenuOptions(caravan, this).GetEnumerator())
            {
                if (enumerator3.MoveNext())
                {
                    FloatMenuOption f2 = enumerator3.Current;
                    yield return(f2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            using (IEnumerator <FloatMenuOption> enumerator4 = CaravanArrivalAction_AttackSettlement.GetFloatMenuOptions(caravan, this).GetEnumerator())
            {
                if (enumerator4.MoveNext())
                {
                    FloatMenuOption f = enumerator4.Current;
                    yield return(f);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_029a:
            /*Error near IL_029b: Unexpected return in MoveNext()*/;
        }
Ejemplo n.º 6
0
        public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
        {
            _003CGetCaravanGizmos_003Ec__Iterator1 _003CGetCaravanGizmos_003Ec__Iterator = (_003CGetCaravanGizmos_003Ec__Iterator1) /*Error near IL_0040: stateMachine*/;

            if (CanTradeNow && CaravanVisitUtility.SettlementVisitedNow(caravan) == this)
            {
                yield return((Gizmo)CaravanVisitUtility.TradeCommand(caravan));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if ((bool)CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(caravan, this))
            {
                yield return((Gizmo)FactionGiftUtility.OfferGiftsCommand(caravan, this));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            using (IEnumerator <Gizmo> enumerator = base.GetCaravanGizmos(caravan).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo g = enumerator.Current;
                    yield return(g);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (Attackable)
            {
                yield return((Gizmo) new Command_Action
                {
                    icon = AttackCommand,
                    defaultLabel = "CommandAttackSettlement".Translate(),
                    defaultDesc = "CommandAttackSettlementDesc".Translate(),
                    action = delegate
                    {
                        SettlementUtility.Attack(caravan, _003CGetCaravanGizmos_003Ec__Iterator._0024this);
                    }
                });

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield break;
IL_022e:
            /*Error near IL_022f: Unexpected return in MoveNext()*/;
        }
Ejemplo n.º 7
0
 public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan)
 {
     foreach (FloatMenuOption o in this.< GetFloatMenuOptions > __BaseCallProxy2(caravan))
     {
         yield return(o);
     }
     if (CaravanVisitUtility.SettlementVisitedNow(caravan) != this)
     {
         foreach (FloatMenuOption f in CaravanArrivalAction_VisitSettlement.GetFloatMenuOptions(caravan, this))
         {
             yield return(f);
         }
     }
     foreach (FloatMenuOption f2 in CaravanArrivalAction_OfferGifts.GetFloatMenuOptions(caravan, this))
     {
         yield return(f2);
     }
     foreach (FloatMenuOption f3 in CaravanArrivalAction_AttackSettlement.GetFloatMenuOptions(caravan, this))
     {
         yield return(f3);
     }
     yield break;
 }
 internal FloatMenuAcceptanceReport <> m__0()
 {
     return(CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(this.caravan, this.settlement));
 }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan, SettlementBase settlement)
 {
     return(CaravanArrivalActionUtility.GetFloatMenuOptions <CaravanArrivalAction_OfferGifts>(() => CaravanArrivalAction_OfferGifts.CanOfferGiftsTo(caravan, settlement), () => new CaravanArrivalAction_OfferGifts(settlement), "OfferGifts".Translate(), caravan, settlement.Tile, settlement));
 }
 public static FloatMenuAcceptanceReport CanOfferGiftsTo(Caravan caravan, SettlementBase settlement)
 {
     return(settlement != null && settlement.Spawned && !settlement.HasMap && settlement.Faction != null && settlement.Faction != Faction.OfPlayer && !settlement.Faction.def.permanentEnemy && settlement.Faction.HostileTo(Faction.OfPlayer) && settlement.CanTradeNow && CaravanArrivalAction_OfferGifts.HasNegotiator(caravan));
 }