Beispiel #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 this.< GetCaravanGizmos > __BaseCallProxy1(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);
             }
         });
     }
     yield break;
 }
Beispiel #2
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);
     }
 }
        private void DoEnter(Caravan caravan, Site site)
        {
            LookTargets lookTargets    = new LookTargets(caravan.PawnsListForReading);
            bool        draftColonists = site.Faction == null || site.Faction.HostileTo(Faction.OfPlayer);
            bool        num            = !site.HasMap;
            Map         orGenerateMap  = GetOrGenerateMapUtility.GetOrGenerateMap(site.Tile, MapSize, null);

            if (num)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, site).CapitalizeFirst());
                AppendThreatInfo(stringBuilder, site, orGenerateMap, out var letterDef, out var allLookTargets);
                TaggedString letterText = null;
                SettlementUtility.AffectRelationsOnAttacked_NewTmp(site, ref letterText);
                if (!letterText.NullOrEmpty())
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.AppendLine();
                    }
                    stringBuilder.AppendLineTagged(letterText);
                }
                List <HediffDef> list = null;
                foreach (SitePart part in site.parts)
                {
                    if (part.def.arrivedLetterHediffHyperlinks.NullOrEmpty())
                    {
                        continue;
                    }
                    if (list == null)
                    {
                        list = new List <HediffDef>();
                    }
                    foreach (HediffDef arrivedLetterHediffHyperlink in part.def.arrivedLetterHediffHyperlinks)
                    {
                        if (!list.Contains(arrivedLetterHediffHyperlink))
                        {
                            list.Add(arrivedLetterHediffHyperlink);
                        }
                    }
                }
                ChoiceLetter choiceLetter = LetterMaker.MakeLetter("LetterLabelCaravanEnteredMap".Translate(site), stringBuilder.ToString(), letterDef ?? LetterDefOf.NeutralEvent, allLookTargets.IsValid() ? allLookTargets : lookTargets);
                choiceLetter.hyperlinkHediffDefs = list;
                Find.LetterStack.ReceiveLetter(choiceLetter);
            }
            else
            {
                Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredMap".Translate(site), "LetterCaravanEnteredMap".Translate(caravan.Label, site).CapitalizeFirst(), LetterDefOf.NeutralEvent, lookTargets);
            }
            CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, CaravanDropInventoryMode.DoNotDrop, draftColonists);
        }
 public static void Attack(Caravan caravan, SettlementBase settlement)
 {
     if (!settlement.HasMap)
     {
         LongEventHandler.QueueLongEvent(delegate()
         {
             SettlementUtility.AttackNow(caravan, settlement);
         }, "GeneratingMapForNewEncounter", false, null);
     }
     else
     {
         SettlementUtility.AttackNow(caravan, settlement);
     }
 }
Beispiel #5
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);
        }
Beispiel #6
0
        public static void AttackNow_SettlementReinforcement_Postfix(RimWorld.Planet.SettlementUtility __instance, Caravan caravan, RimWorld.Planet.Settlement settlement)
        {
            RimWarSettlementComp rwsc = settlement.GetComponent <RimWarSettlementComp>();

            if (rwsc != null && rwsc.ReinforcementPoints > 0)
            {
                //if(rwsc.parent.def.defName == "City_Faction" || rwsc.parent.def.defName == "City_Citadel")
                //{
                //    Warband b = WorldUtility.CreateWarband((rwsc.ReinforcementPoints), WorldUtility.GetRimWarDataForFaction(rwsc.parent.Faction), settlement, settlement.Tile, settlement, WorldObjectDefOf.Settlement);
                //    b.launched = true;
                //}
                //else
                //{
                WorldUtility.CreateWarband((rwsc.ReinforcementPoints), WorldUtility.GetRimWarDataForFaction(rwsc.parent.Faction), settlement, settlement.Tile, settlement, WorldObjectDefOf.Settlement);
                //}
            }
        }
Beispiel #7
0
        private static void AttackNow(Caravan caravan, SettlementBase settlement)
        {
            Pawn   t             = caravan.PawnsListForReading[0];
            bool   flag          = !settlement.HasMap;
            Map    orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(settlement.Tile, null);
            string label         = "LetterLabelCaravanEnteredEnemyBase".Translate();
            string text          = "LetterCaravanEnteredEnemyBase".Translate(caravan.Label, settlement.Label).CapitalizeFirst();

            SettlementUtility.AffectRelationsOnAttacked(settlement, ref text);
            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref label, ref text, "LetterRelatedPawnsSettlement".Translate(Faction.OfPlayer.def.pawnsPlural), true, true);
            }
            Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, t, settlement.Faction, null);
            CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, CaravanDropInventoryMode.DoNotDrop, true, null);
        }
Beispiel #8
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()*/;
        }
Beispiel #9
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);
        }
Beispiel #10
0
 public override void Arrived(Caravan caravan)
 {
     SettlementUtility.Attack(caravan, this.settlement);
 }
 internal void <> m__0()
 {
     SettlementUtility.AttackNow(this.caravan, this.settlement);
 }