public static void GiveGift(List <Pawn> possibleGivers, Faction faction) { if (possibleGivers.NullOrEmpty <Pawn>()) { return; } Pawn pawn = null; for (int i = 0; i < possibleGivers.Count; i++) { if (possibleGivers[i].RaceProps.Humanlike && possibleGivers[i].Faction == faction) { pawn = possibleGivers[i]; break; } } if (pawn == null) { for (int j = 0; j < possibleGivers.Count; j++) { if (possibleGivers[j].Faction == faction) { pawn = possibleGivers[j]; break; } } } if (pawn == null) { pawn = possibleGivers[0]; } List <Thing> list = VisitorGiftForPlayerUtility.GenerateGifts(faction, pawn.Map); TargetInfo target = TargetInfo.Invalid; for (int k = 0; k < list.Count; k++) { if (GenPlace.TryPlaceThing(list[k], pawn.Position, pawn.Map, ThingPlaceMode.Near, null, null)) { target = list[k]; } else { list[k].Destroy(DestroyMode.Vanish); } } if (target.IsValid) { LetterStack arg_1B1_0 = Find.LetterStack; string arg_1B1_1 = "LetterLabelVisitorsGaveGift".Translate(new object[] { pawn.Faction.Name }); string arg_193_0 = "LetterVisitorsGaveGift"; object[] expr_150 = new object[2]; expr_150[0] = pawn.Faction.def.pawnsPlural; expr_150[1] = (from g in list select g.LabelCap).ToLineList(" -"); arg_1B1_0.ReceiveLetter(arg_1B1_1, arg_193_0.Translate(expr_150).AdjustedFor(pawn, "PAWN"), LetterDefOf.PositiveEvent, target, faction, null); } }
//public void ReceiveLetter(TaggedString label, TaggedString text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List<ThingDef> hyperlinkThingDefs = null, string debugInfo = null) public static void ReceiveLetterAppend(LetterStack stack, TaggedString label, TaggedString text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List <ThingDef> hyperlinkThingDefs = null, string debugInfo = null) { if (Mod.settings.dropPodWhatDropped) { text += "\n\n" + "TD.WhatDropped".Translate(thingLabel); } stack.ReceiveLetter(label, text, textLetterDef, lookTargets, relatedFaction, quest, hyperlinkThingDefs, debugInfo); }
public static void ReceiveLetterAppend(LetterStack stack, string label, string text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, string debugInfo = null) { text += "\n\n" + "TD.WhatDropped".Translate(thingLabel); stack.ReceiveLetter(label, text, textLetterDef, lookTargets, relatedFaction, debugInfo); }