static void Postfix(CraftingCampaignBehavior __instance, ItemObject item) { foreach (CraftingPiece piece in SmeltingHelper.GetNewPartsFromSmelting(item)) { methodInfo.Invoke(__instance, new object[] { piece }); } }
private static void Postfix(SmeltingVM __instance, ItemRoster ____playerItemRoster) { foreach (SmeltingItemVM item in __instance.SmeltableItemList) { int count = SmeltingHelper.GetNewPartsFromSmelting(item.Item).Count(); if (count > 0) { string parts = count == 1 ? "part" : "parts"; item.Name = item.Name + $" ({count} new {parts})"; } } }
static void Postfix(CraftingCampaignBehavior __instance, ItemObject item) { if (item == null) { return; } if (__instance == null) { throw new ArgumentNullException(nameof(__instance), $"Tried to run postfix for {nameof(CraftingCampaignBehavior)}.DoSmelting but the instance was null."); } if (openPartMethodInfo == null) { GetMethodInfo(); } foreach (CraftingPiece piece in SmeltingHelper.GetNewPartsFromSmelting(item)) { if (piece != null && piece.Name != null) { openPartMethodInfo.Invoke(__instance, new object[] { piece }); } } }