diff --git a/D2tweaks.aps b/D2tweaks.aps new file mode 100644 index 0000000..d75f7c3 Binary files /dev/null and b/D2tweaks.aps differ diff --git a/D2tweaks.vcxproj b/D2tweaks.vcxproj index fae16f5..b3ebdc3 100644 --- a/D2tweaks.vcxproj +++ b/D2tweaks.vcxproj @@ -279,6 +279,7 @@ + diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..0e34598 --- /dev/null +++ b/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by D2tweaks.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/d2tweaks/server/modules/item_move/item_move_server.cpp b/src/d2tweaks/server/modules/item_move/item_move_server.cpp index 84a258f..97f45da 100644 --- a/src/d2tweaks/server/modules/item_move/item_move_server.cpp +++ b/src/d2tweaks/server/modules/item_move/item_move_server.cpp @@ -96,7 +96,7 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g const auto key = static_cast(packet)->item_code; // Display key in a message box - MessageBox(NULL, key, "Item code", MB_OK | MB_ICONINFORMATION); + //MessageBox(NULL, key, "Item code", MB_OK | MB_ICONINFORMATION); const auto item = instance.get_server_unit(game, itemMove->item_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item const char* itemcode = itemMove->item_code; @@ -148,7 +148,8 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g // Serialize item data into binary file std::string playerName = player->player_data->name; std::string fileName = "./Save/" + playerName + ".boh"; - std::ofstream outFile(fileName, std::ios::binary); + // Open file in append mode + std::ofstream outFile(fileName, std::ios::binary | std::ios::app); if (!outFile) { std::cerr << "Error opening file: " << fileName << std::endl; return false; @@ -158,6 +159,7 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g outFile.close(); } + return true; } diff --git a/src/d2tweaks/ui/ui_manager.cpp b/src/d2tweaks/ui/ui_manager.cpp index fd3474c..4261d74 100644 --- a/src/d2tweaks/ui/ui_manager.cpp +++ b/src/d2tweaks/ui/ui_manager.cpp @@ -58,18 +58,17 @@ #include #include #include -#include -#include #include #include // For std::setw #include -#include #include // For std::invalid_argument #include #include #include +#include // Include for edit control + using namespace std; diablo2::structures::unit* g_item1; @@ -137,6 +136,12 @@ struct D2InventoryGridInfoStrc WORD pad0x16; //0x16 }; +// Declare a variable to hold the handle to the edit box control +HWND g_hEditBox = nullptr; +// Declare a variable to store the input text +std::vector g_inputText(256, '\0'); // Adjust the size according to your needs + + LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -366,6 +371,19 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, const auto record = diablo2::d2_common::get_item_record(g_hoverItem->data_record_index); char* normCode = record->string_code; + if (strncmp(normCode, "ib1", 3) == 0) { + + // display Messagebox with normCode + //MessageBoxA(0, normCode, "normCode", 0); + + // we need to accept user input here + // we need to get the user input and store it in a variable + // we need to use win32 api to get the user input using editbox control, simple inputbox, not using resources.rc + + + + } + const auto player = diablo2::d2_client::get_local_player(); auto pInventory = player->inventory; @@ -397,7 +415,7 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, int rowID; }; - std::unordered_map gemTypes = { + static std::unordered_map gemTypes = { {"gcv", {1, 382}}, // Chipped Amethyst {"gcw", {1, 383}}, // Chipped Diamond {"gcg", {1, 384}}, // Chipped Emerald @@ -477,7 +495,8 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, for (const auto& gem : gemTypes) { // Accessing key and value const std::string& _key = gem.first; - key = gem.first.c_str(); + key = gem.first.c_str(); + const GemType& value = gem.second; if (strncmp(normCode, key, 3) == 0) { D2PropertyStrc itemProperty = {}; @@ -488,6 +507,8 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, diablo2::d2_common::add_property(gemBag, &itemProperty, 0); diablo2::d2_client::play_sound(record->drop_sound, nullptr, 0, 0, 0); + //MessageBoxA(0, key, "key", 0); + static d2_tweaks::common::item_move_cs packet; packet.item_guid = g_hoverItem->guid; packet.item_code = key;