예제 #1
0
 private static DiaOption OKToRoot(Faction faction, Pawn negotiator)
 {
     return(new DiaOption("OK".Translate())
     {
         linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator)
     });
 }
예제 #2
0
 private static DiaOption OKToRoot()
 {
     return(new DiaOption("OK".Translate())
     {
         linkLateBind = FactionDialogMaker.ResetToRoot()
     });
 }
        private static DiaOption OKToRoot()
        {
            DiaOption diaOption = new DiaOption("OK".Translate());

            diaOption.linkLateBind = FactionDialogMaker.ResetToRoot();
            return(diaOption);
        }
        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);
        }
예제 #5
0
        private static DiaOption RequestMilitaryAidOption(Map map)
        {
            string text = "RequestMilitaryAid".Translate(new object[]
            {
                -25f
            });

            if (!FactionDialogMaker.faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp))
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("BadTemperature".Translate());
                return(diaOption);
            }
            DiaOption diaOption2 = new DiaOption(text);

            if (map.attackTargetsCache.TargetsHostileToColony.Any(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer)))
            {
                if (!map.attackTargetsCache.TargetsHostileToColony.Any((IAttackTarget p) => ((Thing)p).Faction != null && ((Thing)p).Faction.HostileTo(FactionDialogMaker.faction)))
                {
                    IEnumerable <Faction> source = (from pa in map.attackTargetsCache.TargetsHostileToColony.Where(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer))
                                                    select((Thing)pa).Faction into fa
                                                    where fa != null && !fa.HostileTo(FactionDialogMaker.faction)
                                                    select fa).Distinct <Faction>();
                    string   arg_1B2_0 = "MilitaryAidConfirmMutualEnemy";
                    object[] expr_178  = new object[2];
                    expr_178[0] = FactionDialogMaker.faction.Name;
                    expr_178[1] = GenText.ToCommaList(from fa in source
                                                      select fa.Name, true);
                    DiaNode   diaNode    = new DiaNode(arg_1B2_0.Translate(expr_178));
                    DiaOption diaOption3 = new DiaOption("CallConfirm".Translate());
                    diaOption3.action = delegate
                    {
                        FactionDialogMaker.CallForAid(map);
                    };
                    diaOption3.link = FactionDialogMaker.FightersSent();
                    DiaOption diaOption4 = new DiaOption("CallCancel".Translate());
                    diaOption4.linkLateBind = FactionDialogMaker.ResetToRoot();
                    diaNode.options.Add(diaOption3);
                    diaNode.options.Add(diaOption4);
                    diaOption2.link = diaNode;
                    return(diaOption2);
                }
            }
            diaOption2.action = delegate
            {
                FactionDialogMaker.CallForAid(map);
            };
            diaOption2.link = FactionDialogMaker.FightersSent();
            return(diaOption2);
        }
예제 #6
0
        private static DiaOption RequestMilitaryAidOption(Map map, Faction faction, Pawn negotiator)
        {
            string text = "RequestMilitaryAid".Translate(new object[]
            {
                25
            });

            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.lastMilitaryAidRequestTick + 60000 - Find.TickManager.TicksGame;

            if (num > 0)
            {
                DiaOption diaOption3 = new DiaOption(text);
                diaOption3.Disable("WaitTime".Translate(new object[]
                {
                    num.ToStringTicksToPeriod()
                }));
                return(diaOption3);
            }
            if (NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, faction))
            {
                DiaOption diaOption4 = new DiaOption(text);
                diaOption4.Disable("HostileVisitorsPresent".Translate());
                return(diaOption4);
            }
            DiaOption diaOption5 = new DiaOption(text);

            if (faction.def.techLevel < TechLevel.Industrial)
            {
                diaOption5.link = FactionDialogMaker.CantMakeItInTime(faction, negotiator);
            }
            else
            {
                IEnumerable <Faction> source = (from x in map.attackTargetsCache.TargetsHostileToColony.Where(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer))
                                                select((Thing)x).Faction into x
                                                where x != null && !x.HostileTo(faction)
                                                select x).Distinct <Faction>();
                if (source.Any <Faction>())
                {
                    string   arg_224_0 = "MilitaryAidConfirmMutualEnemy";
                    object[] expr_1E9  = new object[2];
                    expr_1E9[0] = faction.Name;
                    expr_1E9[1] = (from fa in source
                                   select fa.Name).ToCommaList(true);
                    DiaNode   diaNode    = new DiaNode(arg_224_0.Translate(expr_1E9));
                    DiaOption diaOption6 = new DiaOption("CallConfirm".Translate());
                    diaOption6.action = delegate
                    {
                        FactionDialogMaker.CallForAid(map, faction);
                    };
                    diaOption6.link = FactionDialogMaker.FightersSent(faction, negotiator);
                    DiaOption diaOption7 = new DiaOption("CallCancel".Translate());
                    diaOption7.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator);
                    diaNode.options.Add(diaOption6);
                    diaNode.options.Add(diaOption7);
                    diaOption5.link = diaNode;
                }
                else
                {
                    diaOption5.action = delegate
                    {
                        FactionDialogMaker.CallForAid(map, faction);
                    };
                    diaOption5.link = FactionDialogMaker.FightersSent(faction, negotiator);
                }
            }
            return(diaOption5);
        }
예제 #7
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);
        }
        private static DiaOption RequestMilitaryAidOption(Map map, Faction faction, Pawn negotiator)
        {
            string text = "RequestMilitaryAid".Translate(new object[]
            {
                20
            });
            DiaOption result;

            if (faction.PlayerRelationKind != FactionRelationKind.Ally)
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("MustBeAlly".Translate());
                result = diaOption;
            }
            else if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp))
            {
                DiaOption diaOption2 = new DiaOption(text);
                diaOption2.Disable("BadTemperature".Translate());
                result = diaOption2;
            }
            else
            {
                DiaOption diaOption3 = new DiaOption(text);
                if (faction.def.techLevel < TechLevel.Industrial)
                {
                    diaOption3.link = FactionDialogMaker.CantMakeItInTime(faction, negotiator);
                }
                else
                {
                    IEnumerable <Faction> source = (from x in map.attackTargetsCache.TargetsHostileToColony
                                                    where GenHostility.IsActiveThreatToPlayer(x)
                                                    select((Thing)x).Faction into x
                                                    where x != null && !x.HostileTo(faction)
                                                    select x).Distinct <Faction>();
                    if (source.Any <Faction>())
                    {
                        string   key   = "MilitaryAidConfirmMutualEnemy";
                        object[] array = new object[2];
                        array[0] = faction.Name;
                        array[1] = (from fa in source
                                    select fa.Name).ToCommaList(true);
                        DiaNode   diaNode    = new DiaNode(key.Translate(array));
                        DiaOption diaOption4 = new DiaOption("CallConfirm".Translate());
                        diaOption4.action = delegate()
                        {
                            FactionDialogMaker.CallForAid(map, faction);
                        };
                        diaOption4.link = FactionDialogMaker.FightersSent(faction, negotiator);
                        DiaOption diaOption5 = new DiaOption("CallCancel".Translate());
                        diaOption5.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator);
                        diaNode.options.Add(diaOption4);
                        diaNode.options.Add(diaOption5);
                        diaOption3.link = diaNode;
                    }
                    else
                    {
                        diaOption3.action = delegate()
                        {
                            FactionDialogMaker.CallForAid(map, faction);
                        };
                        diaOption3.link = FactionDialogMaker.FightersSent(faction, negotiator);
                    }
                }
                result = diaOption3;
            }
            return(result);
        }