private static IEnumerable <DiaOption> DebugOptions() { yield return(new DiaOption("(Debug) Goodwill +10") { action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, 10f); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)) }); /*Error: Unable to find new state assignment for yield return*/; }
private static DiaOption OfferGiftOption(Map map) { // TODO: Compare with vanilla method int cost = GetCost(Hospitality_MapComponent.Instance(map).GetBribeCount(faction)); //Log.Message(faction.name + ": " + Hospitality_MapComponent.Instance.GetBribeCount(faction) + " = " + cost); int silver = TradeUtility.AllLaunchableThings(map).Where(t => t.def == ThingDefOf.Silver).Sum(t => t.stackCount); if (silver < cost) { var diaOption = new DiaOption("OfferGift".Translate() + " (" + "NeedSilverLaunchable".Translate(new object[] { cost }) + ")"); diaOption.Disable("NotEnoughSilver".Translate()); return(diaOption); } float goodwillDelta = 12f * negotiator.GetStatValue(StatDefOf.GiftImpact); var diaOption2 = new DiaOption("OfferGift".Translate() + " (" + "SilverForGoodwill".Translate(new object[] { cost, goodwillDelta.ToString("#####0") }) + ")"); diaOption2.action = delegate { TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, cost, map, null); faction.AffectGoodwillWith(Faction.OfPlayer, goodwillDelta); Hospitality_MapComponent.Instance(map).Bribe(faction); }; string text = "SilverGiftSent".Translate(new object[] { faction.Name, Mathf.RoundToInt(goodwillDelta) }); diaOption2.link = new DiaNode(text) { options = { new DiaOption("OK".Translate()) { linkLateBind = () => Source.FactionDialogFor(negotiator, faction) } } }; return(diaOption2); }
private static IEnumerable <DiaOption> DebugOptions(Faction faction, Pawn negotiator) { yield return(new DiaOption("(Debug) Goodwill +10") { action = delegate { faction.TryAffectGoodwillWith(Faction.OfPlayer, 10, false, true, null, null); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)) }); yield return(new DiaOption("(Debug) Goodwill -10") { action = delegate { faction.TryAffectGoodwillWith(Faction.OfPlayer, -10, false, true, null, null); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)) }); }
private static IEnumerable <DiaOption> DebugOptions() { DiaOption opt = new DiaOption("(Debug) Goodwill +10"); opt.action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, 10f); }; opt.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); yield return(opt); DiaOption opt2 = new DiaOption("(Debug) Goodwill -10"); opt2.action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, -10f); }; opt2.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); yield return(opt2); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: { DiaOption opt = new DiaOption("(Debug) Goodwill +10"); opt.action = delegate() { faction.TryAffectGoodwillWith(Faction.OfPlayer, 10, false, true, null, null); }; opt.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)); this.$current = opt; if (!this.$disposing) { this.$PC = 1; } return(true); } case 1u: { DiaOption opt2 = new DiaOption("(Debug) Goodwill -10"); opt2.action = delegate() { < DebugOptions > c__AnonStorey.faction.TryAffectGoodwillWith(Faction.OfPlayer, -10, false, true, null, null); }; opt2.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(< DebugOptions > c__AnonStorey.negotiator, <DebugOptions> c__AnonStorey.faction)); this.$current = opt2; if (!this.$disposing) { this.$PC = 2; } return(true); }
private static Func <DiaNode> ResetToRoot(Faction faction, Pawn negotiator) { return(() => FactionDialogMaker.FactionDialogFor(negotiator, faction)); }
public void TryOpenComms(Pawn negotiator) { Dialog_Negotiation dialog_Negotiation = new Dialog_Negotiation(negotiator, this, FactionDialogMaker.FactionDialogFor(negotiator, this), true); dialog_Negotiation.soundAmbient = SoundDefOf.RadioComms_Ambience; Find.WindowStack.Add(dialog_Negotiation); }
private static Func <DiaNode> ResetToRoot() { return(() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); }