diff --git a/GWToolboxdll/Modules/InventoryManager.cpp b/GWToolboxdll/Modules/InventoryManager.cpp index 2018d46e2..a734c20e9 100644 --- a/GWToolboxdll/Modules/InventoryManager.cpp +++ b/GWToolboxdll/Modules/InventoryManager.cpp @@ -461,6 +461,15 @@ namespace { } pending_moves.clear(); } + void store_all_nicholas_items() { + const std::vector items = filter_items(GW::Constants::Bag::Backpack, GW::Constants::Bag::Bag_2, [](const InventoryManager::Item* item) { + return item && DailyQuests::GetNicholasItemInfo(item->name_enc); + }); + for (const auto& item : items) { + move_item_to_storage(item); + } + pending_moves.clear(); + } // Move a whole stack into/out of storage @@ -507,72 +516,8 @@ namespace { AddItemRowToWindow_pt AddItemRowToWindow_Func = nullptr; AddItemRowToWindow_pt RetAddItemRowToWindow = nullptr; - // x, y, z, w; Top, right, bottom, left - struct Rect { - float top, right, bottom, left; - - bool contains(const GW::Vec2f& pos) const - { - return pos.x > left - && pos.x < right - && pos.y > top - && pos.y < bottom; - } - - Rect() { top = right = bottom = left = 0.0f; } - - Rect(const float _x, const float _y, const float _z, const float _w) - { - top = _x; - right = _y; - bottom = _z; - left = _w; - } - }; - - Rect& operator*=(Rect& lhs, const float rhs) - { - lhs.top *= rhs; - lhs.bottom *= rhs; - lhs.left *= rhs; - lhs.right *= rhs; - return lhs; - } - - Rect operator*(const float lhs, Rect rhs) - { - rhs *= lhs; - return rhs; - } - - - const Rect GetGWWindowPadding() - { - Rect gw_window_padding = {33.f, 14.f, 14.f, 18.f}; - gw_window_padding *= GuiUtils::GetGWScaleMultiplier(); - return gw_window_padding; - } - - // Size of a single inv slot on-screen (includes 1px right padding, 2px bottom padding) - const GW::Vec2f GetInventorySlotSize() - { - GW::Vec2f inventory_slot_size = {41.f, 50.f}; - inventory_slot_size *= GuiUtils::GetGWScaleMultiplier(); - return inventory_slot_size; - } - - // Width of scrollbar on gw windows. - constexpr float gw_scrollbar_width = 20.f; uint32_t pending_item_move_for_trade = 0; - bool GetMousePosition(GW::Vec2f& pos) - { - const ImVec2 imgui_pos = ImGui::GetIO().MousePos; - pos.x = static_cast(imgui_pos.x); - pos.y = static_cast(imgui_pos.y); - return true; - } - bool IsTradeWindowOpen() { if (GW::Map::GetInstanceType() != GW::Constants::InstanceType::Outpost) { @@ -2247,6 +2192,13 @@ bool InventoryManager::DrawItemContextMenu(const bool open) goto end_popup; } } + if (DailyQuests::GetNicholasItemInfo(context_item_actual->name_enc)) { + if (ImGui::Button("Store All Nicholas Items", size)) { + ImGui::CloseCurrentPopup(); + store_all_nicholas_items(); + goto end_popup; + } + } snprintf(move_all_label, _countof(move_all_label), "Store All %s", context_item.plural_item_name.string().c_str()); } if(context_item_actual->IsStorageItem()) { diff --git a/GWToolboxdll/Windows/DailyQuestsWindow.cpp b/GWToolboxdll/Windows/DailyQuestsWindow.cpp index dbff1c75e..014ad74b6 100644 --- a/GWToolboxdll/Windows/DailyQuestsWindow.cpp +++ b/GWToolboxdll/Windows/DailyQuestsWindow.cpp @@ -1645,6 +1645,8 @@ const MapID DailyQuests::QuestData::GetQuestGiverOutpost() { return MapID::None; DailyQuests::NicholasCycleData* DailyQuests::GetNicholasItemInfo(const wchar_t* item_name_encoded) { + if (!item_name_encoded) + return nullptr; for (auto& nicholas_item : nicholas_cycles) { if (nicholas_item.enc_name == item_name_encoded) { return &nicholas_item;