diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 7c4e6e127..7c462acd9 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -7,6 +7,7 @@ #include #include #include "soh/OTRGlobals.h" +#include #define Path _Path @@ -315,6 +316,27 @@ static bool ItemHandler(std::shared_ptr Console, const std::vecto return CMD_SUCCESS; } +static bool GiveItemHandler(std::shared_ptr Console, const std::vector args) { + if (args.size() != 3) { + SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); + return CMD_FAILED; + } + GetItemEntry getItemEntry = GET_ITEM_NONE; + + if (args[1].compare("vanilla") == 0) { + getItemEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, std::stoi(args[2])); + } else if (args[1].compare("randomizer") == 0) { + getItemEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_RANDOMIZER, std::stoi(args[2])); + } else { + SohImGui::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'vanilla' or 'randomizer'"); + return CMD_FAILED; + } + + GiveItemEntryWithoutActor(gGlobalCtx, getItemEntry); + + return CMD_SUCCESS; +} + static bool EntranceHandler(std::shared_ptr Console, const std::vector& args) { if (args.size() != 2) { SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); @@ -1041,6 +1063,11 @@ void DebugConsole_Init(void) { { "slot", Ship::ArgumentType::NUMBER } }}); + CMD_REGISTER("give_item", { GiveItemHandler, "Gives an item to the player as if it was given from an actor", { + { "vanilla|randomizer", Ship::ArgumentType::TEXT }, + { "giveItemID", Ship::ArgumentType::NUMBER } + }}); + CMD_REGISTER("item", { ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", { { "slot", Ship::ArgumentType::NUMBER }, { "item id", Ship::ArgumentType::NUMBER }