| 231 | } |
| 232 | |
| 233 | void MainInterface::openMerchantWindow(Json const& config, EntityId sourceEntityId) { |
| 234 | if (m_merchantWindow && m_paneManager.isDisplayed(m_merchantWindow)) { |
| 235 | m_paneManager.dismissPane(m_merchantWindow); |
| 236 | if (sourceEntityId != NullEntityId && m_merchantWindow->sourceEntityId() == sourceEntityId) { |
| 237 | m_merchantWindow.reset(); |
| 238 | return; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | bool openWithInventory = config.getBool("openWithInventory", true); |
| 243 | bool closeWithInventory = config.getBool("closeWithInventory", !m_paneManager.registeredPaneIsDisplayed(MainInterfacePanes::Inventory)); |
| 244 | m_merchantWindow = make_shared<MerchantPane>(m_client->worldClient(), m_client->mainPlayer(), config, sourceEntityId); |
| 245 | m_paneManager.displayPane(PaneLayer::Window, m_merchantWindow, [this, closeWithInventory](PanePtr const&) { |
| 246 | if (closeWithInventory) |
| 247 | m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory); |
| 248 | }); |
| 249 | if (openWithInventory) |
| 250 | m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory); |
| 251 | |
| 252 | m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory), |
| 253 | m_merchantWindow, Root::singleton().assets()->json("/interface.config:bringAdjacentWindowGap").toFloat()); |
| 254 | } |
| 255 | |
| 256 | void MainInterface::togglePlainCraftingWindow() { |
| 257 | m_paneManager.toggleRegisteredPane(MainInterfacePanes::CraftingPlain); |
nothing calls this directly
no test coverage detected