public override bool TryExecute(IncidentParms parms) { if (!this.TryResolveParms(parms)) { return(false); } Pawn sora = TreasuresUtils.TryGetSoraGoodseller(); if (sora == null) { sora = TreasuresUtils.GenSoraGoodseller(parms.faction); } else if (sora.Dead || sora.Spawned) { return(false); } else { sora.SetFaction(parms.faction); } List <Pawn> list = base.SpawnPawns(parms); list.Add(sora); GenSpawn.Spawn(sora, CellFinder.RandomClosewalkCellNear(parms.spawnCenter, 5)); IntVec3 chillSpot; RCellFinder.TryFindRandomSpotJustOutsideColony(sora, out chillSpot); LordJob_VisitColony lordJob = new LordJob_VisitColony(parms.faction, chillSpot); LordMaker.MakeNewLord(parms.faction, lordJob, list); this.TryConvertOnePawnToSmallTrader(new List <Pawn> { sora }, parms.faction); Pawn factionLeader = list.Find((Pawn x) => parms.faction.leader == x); string label; string letterText; string text = "SingleVisitorArrivesTraderInfo".Translate(); string text2 = (factionLeader == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate(); label = "LetterLabelSingleVisitorArrives".Translate(); letterText = "SingleVisitorArrives".Translate(new object[] { sora.story.adulthood.title.ToLower(), parms.faction.Name, sora.Name, text, text2 }); letterText = letterText.AdjustedFor(sora); Find.LetterStack.ReceiveLetter(label, letterText, LetterType.Good, sora); return(true); }
protected override bool CanFireNowSub() { Pawn sora = TreasuresUtils.TryGetSoraGoodseller(); return(sora == null || !(sora.Dead || sora.Spawned)); }