From f59782a4790b5942c2b1da632c7eb07d15aee8ef Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 22 Jun 2017 18:51:46 -0700 Subject: [PATCH] Add remove all held items of boxdata part of the winforms api, unused by pkhex closes #1264 no need putting held items in inventory as the inventory can be edited outright --- PKHeX.WinForms/Util/SAVUtil.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/PKHeX.WinForms/Util/SAVUtil.cs b/PKHeX.WinForms/Util/SAVUtil.cs index 32636d82c..843af71fd 100644 --- a/PKHeX.WinForms/Util/SAVUtil.cs +++ b/PKHeX.WinForms/Util/SAVUtil.cs @@ -47,6 +47,14 @@ namespace PKHeX.WinForms return true; } + /// + /// Dumps the to a folder with individual decrypted files. + /// + /// that is being dumped from. + /// Folder to store files. + /// Result message from the method. + /// Box contents to be dumped. + /// public static bool DumpBox(this SaveFile SAV, string path, out string result, int currentBox) { PKM[] boxdata = SAV.BoxData; @@ -173,5 +181,21 @@ namespace PKHeX.WinForms return errata.ToArray(); } + + /// + /// Removes the for all in the . + /// + /// that is being operated on. + /// to set. If no argument is supplied, the held item will be removed. + public static void SetBoxDataAllHeldItems(this SaveFile SAV, int item = 0) + { + var boxdata = SAV.BoxData; + foreach (PKM pk in boxdata) + { + pk.HeldItem = item; + pk.RefreshChecksum(); + } + SAV.BoxData = boxdata; + } } }