protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; if (!base.TryResolveParms(parms)) { return(false); } if (parms.faction.HostileTo(Faction.OfPlayer)) { return(false); } List <Pawn> list = base.SpawnPawns(parms); if (list.Count == 0) { return(false); } for (int i = 0; i < list.Count; i++) { if (list[i].needs != null && list[i].needs.food != null) { list[i].needs.food.CurLevel = list[i].needs.food.MaxLevel; } } TraderKindDef traderKindDef = null; for (int j = 0; j < list.Count; j++) { Pawn pawn = list[j]; if (pawn.TraderKind != null) { traderKindDef = pawn.TraderKind; break; } } string label = "LetterLabelTraderCaravanArrival".Translate(new object[] { parms.faction.Name, traderKindDef.label }).CapitalizeFirst(); string text = "LetterTraderCaravanArrival".Translate(new object[] { parms.faction.Name, traderKindDef.label }).CapitalizeFirst(); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref label, ref text, "LetterRelatedPawnsNeutralGroup".Translate(new object[] { Faction.OfPlayer.def.pawnsPlural }), true, true); Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.PositiveEvent, list[0], parms.faction, null); IntVec3 chillSpot; RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out chillSpot); LordJob_TradeWithColony lordJob = new LordJob_TradeWithColony(parms.faction, chillSpot); LordMaker.MakeNewLord(parms.faction, lordJob, map, list); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; if (!TryResolveParms(parms)) { return(false); } if (parms.faction.HostileTo(Faction.OfPlayer)) { return(false); } List <Pawn> list = SpawnPawns(parms); if (list.Count == 0) { return(false); } for (int i = 0; i < list.Count; i++) { if (list[i].needs != null && list[i].needs.food != null) { list[i].needs.food.CurLevel = list[i].needs.food.MaxLevel; } } TraderKindDef traderKind = null; for (int j = 0; j < list.Count; j++) { Pawn pawn = list[j]; if (pawn.TraderKind != null) { traderKind = pawn.TraderKind; break; } } SendLetter(parms, list, traderKind); RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out var result); LordJob_TradeWithColony lordJob = new LordJob_TradeWithColony(parms.faction, result); LordMaker.MakeNewLord(parms.faction, lordJob, map, list); return(true); }