Esempio n. 1
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);

            TransportPodsArrivalActionUtility.DropTravelingTransportPods(pods, cell, mapParent.Map);
            Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion);
        }
Esempio n. 2
0
        public static FloatMenuAcceptanceReport CanAttack(IEnumerable <IThingHolder> pods, SettlementBase settlement)
        {
            FloatMenuAcceptanceReport result;

            if (settlement == null || !settlement.Spawned || !settlement.Attackable)
            {
                result = false;
            }
            else if (!TransportPodsArrivalActionUtility.AnyNonDownedColonist(pods))
            {
                result = false;
            }
            else if (settlement.EnterCooldownBlocksEntering())
            {
                result = FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(new object[]
                {
                    settlement.EnterCooldownDaysLeft().ToString("0.#")
                }));
            }
            else
            {
                result = true;
            }
            return(result);
        }
Esempio n. 3
0
        public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, SettlementBase settlement)
        {
            using (IEnumerator <FloatMenuOption> enumerator = TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop), "AttackAndDropAtEdge".Translate(settlement.Label), representative, settlement.Tile).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    FloatMenuOption f2 = enumerator.Current;
                    yield return(f2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            using (IEnumerator <FloatMenuOption> enumerator2 = TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.CenterDrop), "AttackAndDropInCenter".Translate(settlement.Label), representative, settlement.Tile).GetEnumerator())
            {
                if (enumerator2.MoveNext())
                {
                    FloatMenuOption f = enumerator2.Current;
                    yield return(f);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_0219:
            /*Error near IL_021a: Unexpected return in MoveNext()*/;
        }
Esempio n. 4
0
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, SettlementBase settlement)
 {
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSettlement>(() => TransportPodsArrivalAction_VisitSettlement.CanVisit(pods, settlement), () => new TransportPodsArrivalAction_VisitSettlement(settlement), "VisitSettlement".Translate(new object[]
     {
         settlement.Label
     }), representative, settlement.Tile));
 }
        public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Site site)
        {
            using (IEnumerator <FloatMenuOption> enumerator = TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanVisit(pods, site), () => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.EdgeDrop), "DropAtEdge".Translate(), representative, site.Tile).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    FloatMenuOption f2 = enumerator.Current;
                    yield return(f2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            using (IEnumerator <FloatMenuOption> enumerator2 = TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanVisit(pods, site), () => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.CenterDrop), "DropInCenter".Translate(), representative, site.Tile).GetEnumerator())
            {
                if (enumerator2.MoveNext())
                {
                    FloatMenuOption f = enumerator2.Current;
                    yield return(f);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_01ef:
            /*Error near IL_01f0: Unexpected return in MoveNext()*/;
        }
Esempio n. 6
0
 public override IEnumerable <FloatMenuOption> GetShuttleFloatMenuOptions(IEnumerable <IThingHolder> pods, Action <int, TransportPodsArrivalAction> launchAction)
 {
     foreach (FloatMenuOption shuttleFloatMenuOption in base.GetShuttleFloatMenuOptions(pods, launchAction))
     {
         yield return(shuttleFloatMenuOption);
     }
     if ((bool)TransportPodsArrivalAction_GiveGift.CanGiveGiftTo(pods, this))
     {
         yield return(new FloatMenuOption("GiveGiftViaTransportPods".Translate(base.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, this).ToStringWithSign()), delegate
         {
             TradeRequestComp tradeReqComp = GetComponent <TradeRequestComp>();
             if (tradeReqComp.ActiveRequest && pods.Any((IThingHolder p) => p.GetDirectlyHeldThings().Contains(tradeReqComp.requestThingDef)))
             {
                 Find.WindowStack.Add(new Dialog_MessageBox("GiveGiftViaTransportPodsTradeRequestWarning".Translate(), "Yes".Translate(), delegate
                 {
                     launchAction(base.Tile, new TransportPodsArrivalAction_GiveGift(this));
                 }, "No".Translate()));
             }
             else
             {
                 launchAction(base.Tile, new TransportPodsArrivalAction_GiveGift(this));
             }
         }));
     }
     if (base.HasMap)
     {
         yield break;
     }
     foreach (FloatMenuOption floatMenuOption in TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, this), () => new TransportPodsArrivalAction_Shuttle(this), "AttackShuttle".Translate(Label), launchAction, base.Tile))
     {
         yield return(floatMenuOption);
     }
 }
Esempio n. 7
0
        public static FloatMenuAcceptanceReport CanVisit(IEnumerable <IThingHolder> pods, Site site)
        {
            FloatMenuAcceptanceReport result;

            if (site == null || !site.Spawned || !site.core.def.transportPodsCanLandAndGenerateMap)
            {
                result = false;
            }
            else if (!TransportPodsArrivalActionUtility.AnyNonDownedColonist(pods))
            {
                result = false;
            }
            else if (site.EnterCooldownBlocksEntering())
            {
                result = FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(new object[]
                {
                    site.EnterCooldownDaysLeft().ToString("0.#")
                }));
            }
            else
            {
                result = true;
            }
            return(result);
        }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Caravan caravan)
 {
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_GiveToCaravan>(() => TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(pods, caravan), () => new TransportPodsArrivalAction_GiveToCaravan(caravan), "GiveToCaravan".Translate(new object[]
     {
         caravan.Label
     }), representative, caravan.Tile));
 }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, SettlementBase settlement)
 {
     if (settlement.Faction == Faction.OfPlayer)
     {
         return(Enumerable.Empty <FloatMenuOption>());
     }
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanGiveGiftTo(pods, settlement), () => new TransportPodsArrivalAction_GiveGift(settlement), "GiveGiftViaTransportPods".Translate(settlement.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()), representative, settlement.Tile));
 }
 public static bool CanFormCaravanAt(IEnumerable <IThingHolder> pods, int tile)
 {
     if (TransportPodsArrivalActionUtility.AnyPotentialCaravanOwner(pods, Faction.OfPlayer))
     {
         return(!Find.World.Impassable(tile));
     }
     return(false);
 }
Esempio n. 11
0
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, SettlementBase settlement)
 {
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_GiveGift>(() => TransportPodsArrivalAction_GiveGift.CanGiveGiftTo(pods, settlement), () => new TransportPodsArrivalAction_GiveGift(settlement), "GiveGiftViaTransportPods".Translate(new object[]
     {
         settlement.Faction.Name,
         FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()
     }), representative, settlement.Tile));
 }
Esempio n. 12
0
 public static void DropTravelingTransportPods(List <ActiveDropPodInfo> dropPods, IntVec3 near, Map map)
 {
     TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(dropPods);
     for (int i = 0; i < dropPods.Count; i++)
     {
         IntVec3 c;
         DropCellFinder.TryFindDropSpotNear(near, map, out c, false, true, false);
         DropPodUtility.MakeDropPodAt(c, map, dropPods[i], false);
     }
 }
Esempio n. 13
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop), "AttackAndDropAtEdge".Translate(new object[]
                    {
                        settlement.Label
                    }), representative, settlement.Tile).GetEnumerator();
                    num = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_1A9;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        f             = enumerator.Current;
                        this.$current = f;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                enumerator2 = TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(< GetFloatMenuOptions > c__AnonStorey.pods, <GetFloatMenuOptions> c__AnonStorey.settlement), () => new TransportPodsArrivalAction_AttackSettlement(< GetFloatMenuOptions > c__AnonStorey.settlement, PawnsArrivalModeDefOf.CenterDrop), "AttackAndDropInCenter".Translate(new object[]
                {
Esempio n. 14
0
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Settlement settlement)
 {
     foreach (FloatMenuOption floatMenuOption in TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop), "AttackAndDropAtEdge".Translate(settlement.Label), representative, settlement.Tile))
     {
         yield return(floatMenuOption);
     }
     foreach (FloatMenuOption floatMenuOption2 in TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.CenterDrop), "AttackAndDropInCenter".Translate(settlement.Label), representative, settlement.Tile))
     {
         yield return(floatMenuOption2);
     }
 }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Site site)
 {
     foreach (FloatMenuOption f in TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>(() => TransportPodsArrivalAction_VisitSite.CanVisit(pods, site), () => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.EdgeDrop), "DropAtEdge".Translate(), representative, site.Tile))
     {
         yield return(f);
     }
     foreach (FloatMenuOption f2 in TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>(() => TransportPodsArrivalAction_VisitSite.CanVisit(pods, site), () => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.CenterDrop), "DropInCenter".Translate(), representative, site.Tile))
     {
         yield return(f2);
     }
 }
Esempio n. 16
0
 public static FloatMenuAcceptanceReport CanVisit(IEnumerable <IThingHolder> pods, SettlementBase settlement)
 {
     if (settlement == null || !settlement.Spawned || !settlement.Visitable)
     {
         return(false);
     }
     if (!TransportPodsArrivalActionUtility.AnyPotentialCaravanOwner(pods, Faction.OfPlayer))
     {
         return(false);
     }
     return(true);
 }
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool  flag          = !this.site.HasMap;
            Map   orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(this.site.Tile, SiteCoreWorker.MapSize, null);

            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, true, true);
            }
            Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true);
            this.arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
Esempio n. 18
0
 public static FloatMenuAcceptanceReport CanAttack(IEnumerable <IThingHolder> pods, Settlement settlement)
 {
     if (settlement == null || !settlement.Spawned || !settlement.Attackable)
     {
         return(false);
     }
     if (!TransportPodsArrivalActionUtility.AnyNonDownedColonist(pods))
     {
         return(false);
     }
     if (settlement.EnterCooldownBlocksEntering())
     {
         return(FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(settlement.EnterCooldownDaysLeft().ToString("0.#"))));
     }
     return(true);
 }
Esempio n. 19
0
 public static FloatMenuAcceptanceReport CanVisit(IEnumerable <IThingHolder> pods, Site site)
 {
     if (site == null || !site.Spawned)
     {
         return(false);
     }
     if (!TransportPodsArrivalActionUtility.AnyNonDownedColonist(pods))
     {
         return(false);
     }
     if (site.EnterCooldownBlocksEntering())
     {
         return(FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(site.EnterCooldownTicksLeft().ToStringTicksToPeriod())));
     }
     return(true);
 }
Esempio n. 20
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing  lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool   flag          = !settlement.HasMap;
            Map    orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(settlement.Tile, null);
            string letterLabel   = "LetterLabelCaravanEnteredEnemyBase".Translate();
            string letterText    = "LetterTransportPodsLandedInEnemyBase".Translate(settlement.Label).CapitalizeFirst();

            SettlementUtility.AffectRelationsOnAttacked(settlement, ref letterText);
            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref letterLabel, ref letterText, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true);
            }
            Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.NeutralEvent, lookTarget, settlement.Faction);
            arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
Esempio n. 21
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool  num           = !site.HasMap;
            Map   orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(site.Tile, CaravanArrivalAction_VisitSite.MapSize, null);

            if (num)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
            }
            if (site.Faction != null && site.Faction != Faction.OfPlayer)
            {
                site.Faction.TrySetRelationKind(Faction.OfPlayer, FactionRelationKind.Hostile);
            }
            Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion);
            arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Settlement settlement)
 {
     if (settlement.Faction == Faction.OfPlayer)
     {
         return(Enumerable.Empty <FloatMenuOption>());
     }
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanGiveGiftTo(pods, settlement), () => new TransportPodsArrivalAction_GiveGift(settlement), "GiveGiftViaTransportPods".Translate(settlement.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()), representative, settlement.Tile, delegate(Action action)
     {
         TradeRequestComp tradeReqComp = settlement.GetComponent <TradeRequestComp>();
         if (tradeReqComp.ActiveRequest && pods.Any((IThingHolder p) => p.GetDirectlyHeldThings().Contains(tradeReqComp.requestThingDef)))
         {
             Find.WindowStack.Add(new Dialog_MessageBox("GiveGiftViaTransportPodsTradeRequestWarning".Translate(), "Yes".Translate(), delegate
             {
                 action();
             }, "No".Translate()));
         }
         else
         {
             action();
         }
     }));
 }
Esempio n. 23
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing  lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool   flag          = !this.settlement.HasMap;
            Map    orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(this.settlement.Tile, null);
            string label         = "LetterLabelCaravanEnteredEnemyBase".Translate();
            string text          = "LetterTransportPodsLandedInEnemyBase".Translate(new object[]
            {
                this.settlement.Label
            }).CapitalizeFirst();

            SettlementUtility.AffectRelationsOnAttacked(this.settlement, ref text);
            if (flag)
            {
                Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref label, ref text, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(new object[]
                {
                    Faction.OfPlayer.def.pawnsPlural
                }), true, true);
            }
            Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, lookTarget, this.settlement.Faction, null);
            this.arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
Esempio n. 24
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>(() => TransportPodsArrivalAction_VisitSite.CanVisit(pods, site), () => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.EdgeDrop), "DropAtEdge".Translate(), representative, site.Tile).GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_177;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        f             = enumerator.Current;
                        this.$current = f;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                enumerator2 = TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>(() => TransportPodsArrivalAction_VisitSite.CanVisit(< GetFloatMenuOptions > c__AnonStorey.pods, <GetFloatMenuOptions> c__AnonStorey.site), () => new TransportPodsArrivalAction_VisitSite(< GetFloatMenuOptions > c__AnonStorey.site, PawnsArrivalModeDefOf.CenterDrop), "DropInCenter".Translate(), representative, <GetFloatMenuOptions> c__AnonStorey.site.Tile).GetEnumerator();
                num         = 4294967293u;
                try
                {
IL_177:
                    switch (num)
                    {
                    }
                    if (enumerator2.MoveNext())
                    {
                        f2            = enumerator2.Current;
                        this.$current = f2;
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator2 != null)
                        {
                            enumerator2.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }