private static DiaNode FightersSent()
        {
            DiaNode diaNode = new DiaNode("MilitaryAidSent".Translate(FactionDialogMaker.faction.leader.LabelIndefinite()).CapitalizeFirst());

            diaNode.options.Add(FactionDialogMaker.OKToRoot());
            return(diaNode);
        }
Ejemplo n.º 2
0
 private static DiaNode FightersSent(Faction faction, Pawn negotiator)
 {
     return(new DiaNode("MilitaryAidSent".Translate(faction.leader).CapitalizeFirst())
     {
         options =
         {
             FactionDialogMaker.OKToRoot(faction, negotiator)
         }
     });
 }
Ejemplo n.º 3
0
 private static DiaNode CantMakeItInTime(Faction faction, Pawn negotiator)
 {
     return(new DiaNode("CantSendMilitaryAidInTime".Translate(faction.leader).CapitalizeFirst())
     {
         options =
         {
             FactionDialogMaker.OKToRoot(faction, negotiator)
         }
     });
 }
        private static DiaOption RequestTraderOption(Map map, int silverCost)
        {
            string text = "RequestTrader".Translate(silverCost.ToString());

            if (FactionDialogMaker.AmountSendableSilver(map) < silverCost)
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("NeedSilverLaunchable".Translate(silverCost));
                return(diaOption);
            }
            if (!FactionDialogMaker.faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp))
            {
                DiaOption diaOption2 = new DiaOption(text);
                diaOption2.Disable("BadTemperature".Translate());
                return(diaOption2);
            }
            int num = FactionDialogMaker.faction.lastTraderRequestTick + 240000 - Find.TickManager.TicksGame;

            if (num > 0)
            {
                DiaOption diaOption3 = new DiaOption(text);
                diaOption3.Disable("WaitTime".Translate(num.ToStringTicksToPeriod(true, false, true)));
                return(diaOption3);
            }
            DiaOption diaOption4 = new DiaOption(text);
            DiaNode   diaNode    = new DiaNode("TraderSent".Translate(FactionDialogMaker.faction.leader.LabelIndefinite()).CapitalizeFirst());

            diaNode.options.Add(FactionDialogMaker.OKToRoot());
            DiaNode diaNode2 = new DiaNode("ChooseTraderKind".Translate(FactionDialogMaker.faction.leader.LabelIndefinite()));

            foreach (TraderKindDef caravanTraderKind in FactionDialogMaker.faction.def.caravanTraderKinds)
            {
                TraderKindDef localTk    = caravanTraderKind;
                DiaOption     diaOption5 = new DiaOption(localTk.LabelCap);
                diaOption5.action = delegate
                {
                    IncidentParms incidentParms = new IncidentParms();
                    incidentParms.target     = map;
                    incidentParms.faction    = FactionDialogMaker.faction;
                    incidentParms.traderKind = localTk;
                    incidentParms.forced     = true;
                    Find.Storyteller.incidentQueue.Add(IncidentDefOf.TraderCaravanArrival, Find.TickManager.TicksGame + 120000, incidentParms);
                    FactionDialogMaker.faction.lastTraderRequestTick = Find.TickManager.TicksGame;
                    TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, silverCost, map, null);
                };
                diaOption5.link = diaNode;
                diaNode2.options.Add(diaOption5);
            }
            DiaOption diaOption6 = new DiaOption("GoBack".Translate());

            diaOption6.linkLateBind = FactionDialogMaker.ResetToRoot();
            diaNode2.options.Add(diaOption6);
            diaOption4.link = diaNode2;
            return(diaOption4);
        }
Ejemplo n.º 5
0
 private static DiaNode FightersSent()
 {
     return(new DiaNode("MilitaryAidSent".Translate(new object[]
     {
         FactionDialogMaker.faction.leader.LabelIndefinite()
     }).CapitalizeFirst())
     {
         options =
         {
             FactionDialogMaker.OKToRoot()
         }
     });
 }
Ejemplo n.º 6
0
        private static DiaOption RequestAICoreQuest(Map map, Faction faction, Pawn negotiator)
        {
            string text = "RequestAICoreInformation".Translate(ThingDefOf.AIPersonaCore.label, 1500.ToString());

            if (faction.PlayerGoodwill < 40)
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("NeedGoodwill".Translate(40.ToString("F0")));
                return(diaOption);
            }
            IncidentDef   def  = IncidentDefOf.Quest_ItemStashAICore;
            bool          flag = PlayerItemAccessibilityUtility.ItemStashHas(ThingDefOf.AIPersonaCore);
            IncidentParms coreIncidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, Find.World);

            coreIncidentParms.faction = faction;
            bool flag2 = def.Worker.CanFireNow(coreIncidentParms, false);

            if (flag || !flag2)
            {
                DiaOption diaOption2 = new DiaOption(text);
                diaOption2.Disable("NoKnownAICore".Translate(1500));
                return(diaOption2);
            }
            if (FactionDialogMaker.AmountSendableSilver(map) < 1500)
            {
                DiaOption diaOption3 = new DiaOption(text);
                diaOption3.Disable("NeedSilverLaunchable".Translate(1500));
                return(diaOption3);
            }
            DiaOption diaOption4 = new DiaOption(text);

            diaOption4.action = delegate
            {
                if (def.Worker.TryExecute(coreIncidentParms))
                {
                    TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 1500, map, null);
                }
                Current.Game.GetComponent <GameComponent_OnetimeNotification>().sendAICoreRequestReminder = false;
            };
            string text2 = "RequestAICoreInformationResult".Translate(faction.leader).CapitalizeFirst();

            diaOption4.link = new DiaNode(text2)
            {
                options =
                {
                    FactionDialogMaker.OKToRoot(faction, negotiator)
                }
            };
            return(diaOption4);
        }
Ejemplo n.º 7
0
        private static DiaOption OfferGiftOption(Map map)
        {
            if (FactionDialogMaker.AmountSendableSilver(map) < 300)
            {
                DiaOption diaOption = new DiaOption("OfferGift".Translate());
                diaOption.Disable("NeedSilverLaunchable".Translate(new object[]
                {
                    300
                }));
                return(diaOption);
            }
            float     goodwillDelta = 12f * FactionDialogMaker.negotiator.GetStatValue(StatDefOf.DiplomacyPower, true);
            DiaOption diaOption2    = new DiaOption("OfferGift".Translate() + " (" + "SilverForGoodwill".Translate(new object[]
            {
                300,
                goodwillDelta.ToString("#####0")
            }) + ")");

            diaOption2.action = delegate
            {
                TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 300, map, null);
                FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, goodwillDelta);
            };
            string text = "SilverGiftSent".Translate(new object[]
            {
                FactionDialogMaker.faction.leader.LabelIndefinite(),
                Mathf.RoundToInt(goodwillDelta)
            }).CapitalizeFirst();

            diaOption2.link = new DiaNode(text)
            {
                options =
                {
                    FactionDialogMaker.OKToRoot()
                }
            };
            return(diaOption2);
        }
Ejemplo n.º 8
0
        private static DiaOption RequestTraderOption(Map map, Faction faction, Pawn negotiator)
        {
            string text = "RequestTrader".Translate(new object[]
            {
                15
            });

            if (faction.PlayerRelationKind != FactionRelationKind.Ally)
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("MustBeAlly".Translate());
                return(diaOption);
            }
            if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp))
            {
                DiaOption diaOption2 = new DiaOption(text);
                diaOption2.Disable("BadTemperature".Translate());
                return(diaOption2);
            }
            int num = faction.lastTraderRequestTick + 240000 - Find.TickManager.TicksGame;

            if (num > 0)
            {
                DiaOption diaOption3 = new DiaOption(text);
                diaOption3.Disable("WaitTime".Translate(new object[]
                {
                    num.ToStringTicksToPeriod()
                }));
                return(diaOption3);
            }
            DiaOption diaOption4 = new DiaOption(text);
            DiaNode   diaNode    = new DiaNode("TraderSent".Translate(new object[]
            {
                faction.leader.LabelIndefinite()
            }).CapitalizeFirst());

            diaNode.options.Add(FactionDialogMaker.OKToRoot(faction, negotiator));
            DiaNode diaNode2 = new DiaNode("ChooseTraderKind".Translate(new object[]
            {
                faction.leader.LabelIndefinite()
            }));

            foreach (TraderKindDef current in from x in faction.def.caravanTraderKinds
                     where x.requestable
                     select x)
            {
                TraderKindDef localTk    = current;
                DiaOption     diaOption5 = new DiaOption(localTk.LabelCap);
                diaOption5.action = delegate
                {
                    IncidentParms incidentParms = new IncidentParms();
                    incidentParms.target     = map;
                    incidentParms.faction    = faction;
                    incidentParms.traderKind = localTk;
                    incidentParms.forced     = true;
                    Find.Storyteller.incidentQueue.Add(IncidentDefOf.TraderCaravanArrival, Find.TickManager.TicksGame + 120000, incidentParms, 240000);
                    faction.lastTraderRequestTick = Find.TickManager.TicksGame;
                    Faction arg_B2_0       = faction;
                    Faction ofPlayer       = Faction.OfPlayer;
                    int     goodwillChange = -15;
                    bool    canSendMessage = false;
                    string  reason         = "GoodwillChangedReason_RequestedTrader".Translate();
                    arg_B2_0.TryAffectGoodwillWith(ofPlayer, goodwillChange, canSendMessage, true, reason, null);
                };
                diaOption5.link = diaNode;
                diaNode2.options.Add(diaOption5);
            }
            DiaOption diaOption6 = new DiaOption("GoBack".Translate());

            diaOption6.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator);
            diaNode2.options.Add(diaOption6);
            diaOption4.link = diaNode2;
            return(diaOption4);
        }