public override void OpenLetter() { Pawn pawn = lookTargets.TryGetPrimaryTarget().Thing as Pawn; ThingWithComps deadlyItem = (ThingWithComps)lookTargets.targets.First(gti => gti.HasThing && gti.Thing.TryGetComp <CompLootAffixableThing>() != null).Thing; var comp = deadlyItem.TryGetComp <CompLootAffixableThing>(); LootAffixDef affix = comp.AllAffixDefs.First(lad => lad.IsNegativeDeadly(deadlyItem)); string affixLabel = comp.AllAffixesByAffixDefs[affix]; TaggedString text = "RimLoot_NegativeDeadlyAffixLetter_Desc".Translate( pawn.Named("PAWN"), deadlyItem.Named("ITEM"), affix.FullStatsReport(deadlyItem, affixLabel).Named("EFFECT") ); DiaNode nodeRoot = new DiaNode(text); nodeRoot.options.AddRange(Choices); Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo( nodeRoot: nodeRoot, faction: relatedFaction, radioMode: radioMode, title: title )); }
// FIXME: Icons on the affix hyperlinks public override IEnumerable <StatDrawEntry> SpecialDisplayStats() { StatCategoryDef category = parent.def.IsApparel ? StatCategoryDefOf.Apparel : parent.def.IsWeapon ? StatCategoryDefOf.Weapon : StatCategoryDefOf.BasicsImportant ; string reportText = "RimLoot_LootAffixDescription".Translate() + "\n\n"; var affixDict = AllAffixDefsByAffixes; foreach (string affixKey in AffixStrings) { LootAffixDef affix = affixDict[affixKey]; reportText += affix.FullStatsReport(parent, affixKey) + "\n"; } if (Prefs.DevMode) { reportText += "[DEV] Affix Rules:\n " + string.Join("\n ", affixRules) + "\n\n"; reportText += "[DEV] Total Points: " + affixes.Select(lad => lad.GetRealAffixCost(parent)).Sum() + "\n " + string.Join("\n ", affixes.Select(lad => AllAffixesByAffixDefs[lad] + ": " + lad.GetRealAffixCost(parent))) + "\n\n" ; } yield return(new StatDrawEntry( category: category, label: "RimLoot_LootAffixModifiers".Translate(), valueString: GenText.ToCommaList( AllAffixDefsByAffixes.Select(kv => kv.Value.LabelWithStyle(parent, kv.Key)), false ), reportText: reportText, hyperlinks: affixes.SelectMany(lad => lad.GetHyperlinks(parent)), displayPriorityWithinCategory: 1 )); // Add any additional entries from the defs or modifiers foreach (string affixKey in AffixStrings) { LootAffixDef affix = affixDict[affixKey]; foreach (var statDrawEntry in affix.SpecialDisplayStatsForThing(parent, affixKey)) { yield return(statDrawEntry); } } }