private static IEnumerable <DiaOption> DebugOptions(Faction faction) { DiaOption opt = new DiaOption("(Debug) Goodwill +10"); opt.action = delegate { CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, 10f); }; opt.linkLateBind = (() => FactionDialogMaker_IoM.FactionDialogFor(FactionDialogMaker_IoM.negotiator, FactionDialogMaker_IoM.faction)); yield return(opt); DiaOption opt2 = new DiaOption("(Debug) Goodwill -10"); opt2.action = delegate { CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, -10f); }; opt2.linkLateBind = (() => FactionDialogMaker_IoM.FactionDialogFor(FactionDialogMaker_IoM.negotiator, FactionDialogMaker_IoM.faction)); yield return(opt2); }
private static DiaOption OfferGiftOption(Map map) { if (FactionDialogMaker_IoM.AmountSendableSilver(map) < 300) { DiaOption diaOption = new DiaOption("OfferGift".Translate()); diaOption.Disable("NeedSilverLaunchable".Translate(new object[] { 300 })); return(diaOption); } float goodwillDelta = 5f * FactionDialogMaker_IoM.negotiator.GetStatValue(StatDefOf.GiftImpact, 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); CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, goodwillDelta); }; string text = "SilverGiftSent".Translate(new object[] { FactionDialogMaker_IoM.faction.leader.LabelIndefinite(), Mathf.RoundToInt(goodwillDelta) }).CapitalizeFirst(); diaOption2.link = new DiaNode(text) { options = { FactionDialogMaker_IoM.OKToRoot() } }; return(diaOption2); }