private static void CreateLord(Faction faction, IntVec3 chillSpot, List <Pawn> pawns, Map map) { var mapComp = Hospitality_MapComponent.Instance(map); int stayDuration = (int)(Rand.Range(1f, 2.4f) * GenDate.TicksPerDay); var lordJob = new LordJob_VisitColony(faction, chillSpot, stayDuration); LordMaker.MakeNewLord(faction, lordJob, map, pawns); // Set default interaction pawns.ForEach(delegate(Pawn p) { var compGuest = p.GetComp <CompGuest>(); if (compGuest != null) { compGuest.mayBuy = mapComp.defaultMayBuy; compGuest.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.Chat; compGuest.GuestArea = mapComp.defaultAreaRestriction; } }); bool gotTrader = false; if (Rand.Value < 0.75f) { gotTrader = TryConvertOnePawnToSmallTrader(pawns, faction, map); } string label; string description; Pawn pawn = pawns.Find(x => faction.leader == x); if (pawns.Count == 1) { string traderDesc = (!gotTrader) ? string.Empty : "SingleVisitorArrivesTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate(); label = "LetterLabelSingleVisitorArrives".Translate(); description = "SingleVisitorArrives".Translate(new object[] { pawns[0].GetTitle().ToLower(), faction.Name, pawns[0].Name, traderDesc, leaderDesc }); description = description.AdjustedFor(pawns[0]); } else { string traderDesc = (!gotTrader) ? string.Empty : "GroupVisitorsArriveTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "GroupVisitorsArriveLeaderInfo".Translate(new object[] { pawn.LabelShort }); label = "LetterLabelGroupVisitorsArrive".Translate(); description = "GroupVisitorsArrive".Translate(new object[] { faction.Name, traderDesc, leaderDesc }); } Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.Good, pawns[0]); }
public static void CreateLord(Faction faction, IntVec3 chillSpot, List <Pawn> pawns, Map map, bool showLetter, bool getUpsetWhenLost, int duration) { // Make sure existing lords don't hold any of the pawns RemovePawnsFromMapLords(pawns, map); var mapComp = map.GetMapComponent(); var lordJob = new LordJob_VisitColony(faction, chillSpot, duration, getUpsetWhenLost); var lord = LordMaker.MakeNewLord(faction, lordJob, map, pawns); // Set default interaction pawns.ForEach(delegate(Pawn p) { var compGuest = p.GetComp <CompGuest>(); if (compGuest != null) { compGuest.ResetForGuest(lord); compGuest.SetEntertain(mapComp.defaultEntertain); compGuest.SetMakeFriends(mapComp.defaultMakeFriends); compGuest.SetGuestArea(mapComp.defaultAreaRestriction); compGuest.SetShoppingArea(mapComp.defaultAreaShopping); } }); foreach (var pawn in pawns) { pawn.ConvertToTrader(true); } Pawn leader = pawns.Find(x => faction.leader == x); TaggedString label; TaggedString description; if (pawns.Count == 1) { var value2 = leader == null ? TaggedString.Empty : "\n\n" + "SingleVisitorArrivesLeaderInfo".Translate(pawns[0].Named("PAWN")).AdjustedFor(pawns[0]); label = "LetterLabelSingleVisitorArrives".Translate(); description = "SingleVisitorArrives".Translate(pawns[0].story.Title, faction.Name, pawns[0].Name.ToStringFull, string.Empty, value2, pawns[0].Named("PAWN")).AdjustedFor(pawns[0]); } else { var value4 = leader == null ? TaggedString.Empty : "\n\n" + "GroupVisitorsArriveLeaderInfo".Translate(leader.LabelShort, leader); label = "LetterLabelGroupVisitorsArrive".Translate(); description = "GroupVisitorsArrive".Translate(faction.Name, string.Empty, value4); } if (showLetter) { PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(pawns, ref label, ref description, "LetterRelatedPawnsNeutralGroup".Translate(Faction.OfPlayer.def.pawnsPlural), true); Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.PositiveEvent, pawns[0], faction); } }
private static void CreateLord(Faction faction, IntVec3 chillSpot, List <Pawn> pawns, Map map) { var mapComp = Hospitality_MapComponent.Instance(map); int stayDuration = (int)(Rand.Range(1f, 2.4f) * GenDate.TicksPerDay); var lordJob = new LordJob_VisitColony(faction, chillSpot, stayDuration); LordMaker.MakeNewLord(faction, lordJob, map, pawns); // Set default interaction pawns.ForEach(delegate(Pawn p) { var compGuest = p.GetComp <CompGuest>(); if (compGuest != null) { compGuest.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.ReduceResistance; compGuest.GuestArea = mapComp.defaultAreaRestriction; compGuest.ShoppingArea = mapComp.defaultAreaShopping; } }); bool gotTrader = false; int traderIndex = 0; if (Rand.Value < 0.75f) { gotTrader = TryConvertOnePawnToSmallTrader(pawns, faction, map, out traderIndex); } string label; string description; Pawn pawn = pawns.Find(x => faction.leader == x); if (pawns.Count == 1) { string traderDesc = !gotTrader ? string.Empty : "SingleVisitorArrivesTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate(); label = "LetterLabelSingleVisitorArrives".Translate(); description = "SingleVisitorArrives".Translate(new object[] { pawns[0].story.Title, faction.Name, pawns[0].Name, traderDesc, leaderDesc }); description = description.AdjustedFor(pawns[0]); } else { string traderDesc = (!gotTrader) ? string.Empty : "GroupVisitorsArriveTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "GroupVisitorsArriveLeaderInfo".Translate(new object[] { pawn.LabelShort }); label = "LetterLabelGroupVisitorsArrive".Translate(); description = "GroupVisitorsArrive".Translate(new object[] { faction.Name, traderDesc, leaderDesc }); } // NEW PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(pawns, ref label, ref description, "LetterRelatedPawnsNeutralGroup".Translate(new object[] { Faction.OfPlayer.def.pawnsPlural }), true, true); //Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.NeutralEvent, pawns[0], faction, null); var lookTarget = gotTrader ? pawns[traderIndex] : pawns[0]; Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.PositiveEvent, lookTarget, faction); }