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); }
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); }
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); }