private static bool Prefix(DragDropCraftingPanel __instance) { if (!LoaderConfig.Instance.FreeCrafting) { return(true); } ProtoCraft instanceField = Util.GetInstanceField <ProtoCraft>(__instance, "_currentCraft"); int _craftMultiplier = Util.GetInstanceField <int>(__instance, "_craftMultiplier"); if (instanceField != null) { if (LoaderConfig.Instance.AvoidCraftNotice) { GameInventoryHelper.AddItem(instanceField.Result, instanceField.ResultCount * _craftMultiplier, false, false); } else { instanceField.Components.ForEach(delegate(CraftComponent comp) { ProtoItem item = comp.ValidItems.PickRandom <ProtoItem>(); int num = comp.RequiredCount * _craftMultiplier; if (!GameInventoryHelper.ContainsItem(item, num, false)) { GameInventoryHelper.AddItem(item, num, false, false); } }); } return(false); } return(true); }
public static void Postfix(Builder __instance, string protoItemName, Vector3i location, Matrix3i rotation, int quickSlotUsed = -1, JSONClass uniqueData = null, int _buildCount = 0) { if (__instance == Player.Local.Builder && LoaderConfig.Instance.InfiniteItem) { UMFGUI.AddConsoleText("Placed: " + protoItemName, false); ProtoItem protoItemByName = ProtoDatabase.GetProtoItemByName(protoItemName, Array.Empty <FindOptions>()); ProtoItemBlock protoItemBlock = protoItemByName as ProtoItemBlock; if (!protoItemName.Contains("hearthstone_white_item")) { protoItemBlock.GetProtoBlock(); GameInventoryHelper.AddItem(protoItemByName, (_buildCount != 0) ? _buildCount : 1, true, false); } } }