From 505ff98784a9f233d9c21769cc3607d95b07a4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20K=C4=B1l=C4=B1=C3=A7o=C4=9Flu?= Date: Sat, 26 Oct 2024 14:58:16 +0300 Subject: [PATCH] New client function CLOSECONTAINER and CLOSEVENDORMENU CLOSEVENDORMENU OR CLOSEVENDORMENU empty if empty, 14 squares will close the sales menu of all near shops. If no value is entered, it closes the sales menu of all vendors in the surrounding area (14 squares). If a value is entered and this value is the vendor uid, it closes the sales menu of the vendor belonging to that serial number. CLOSECONTAINER Actually, there is already a package for this, but since dealing with the package takes a long time, such a command was needed. When CLOSECONTAINER is entered, that container is closed in the interface. Tested. --- Changelog.txt | 7 +++++ src/game/clients/CClient.cpp | 48 ++++++++++++++++++++++++++++++++ src/tables/CClient_functions.tbl | 2 ++ 3 files changed, 57 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 034689fd8..30a37f990 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3914,3 +3914,10 @@ Added: 'H' shortcut for variables to get the value as hexadecimal. 13-10-2024, Jhobean - Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released. + +26-10-2024, canerksk +- Added: New client function CLOSECONTAINER and CLOSEVENDORMENU + CLOSEVENDORMENU OR CLOSEVENDORMENU empty if empty, 14 squares will close the sales menu of all near shops. + If no value is entered, it closes the sales menu of all vendors in the surrounding area (14 squares). If a value is entered and this value is the vendor uid, it closes the sales menu of the vendor belonging to that serial number. + CLOSECONTAINER + Actually, there is already a package for this, but since dealing with the package takes a long time, such a command was needed. When CLOSECONTAINER is entered, that container is closed in the interface. diff --git a/src/game/clients/CClient.cpp b/src/game/clients/CClient.cpp index 7fc23ab34..ca1cdd76f 100644 --- a/src/game/clients/CClient.cpp +++ b/src/game/clients/CClient.cpp @@ -14,6 +14,7 @@ #include "../CWorld.h" #include "../CWorldGameTime.h" #include "../CWorldMap.h" +#include "../CWorldSearch.h" #include "../spheresvr.h" #include "../triggers.h" #include "CParty.h" @@ -1289,6 +1290,53 @@ bool CClient::r_Verb( CScript & s, CTextConsole * pSrc ) // Execute command from } break; + case CV_CLOSECONTAINER: + { + const CItem *pItem = nullptr; + if (s.HasArgs()) + { + const CUID uid(s.GetArgDWVal()); + if (!uid.IsItem()) + return (false); + pItem = uid.ItemFind(); + } + if (pItem != nullptr && pItem->IsType(IT_CONTAINER)) + closeUIWindow(pItem, PacketCloseUIWindow::Container); + } + break; + + case CV_CLOSEVENDORMENU: + { + const CChar *pChar = m_pChar; + if (s.HasArgs()) + { + const CUID uid(s.GetArgDWVal()); + if (!uid.IsChar()) + return (false); + pChar = uid.CharFind(); + if (pChar) + addVendorClose(pChar); + } + else + { + auto AreaChars = CWorldSearchHolder::GetInstance(pChar->GetTopPoint(), UO_MAP_VIEW_SIGHT); + for (;;) + { + const CChar *pCharArea = AreaChars->GetChar(); + if (pCharArea == nullptr) + break; + if (pCharArea->m_pPlayer) + continue; + if (pCharArea == GetChar()) + continue; + if (!pCharArea->NPC_IsVendor()) + continue; + addVendorClose(pCharArea); + } + } + } + break; + case CV_CODEXOFWISDOM: { int64 piArgs[2]; diff --git a/src/tables/CClient_functions.tbl b/src/tables/CClient_functions.tbl index 3ec981b58..66f87d7d6 100644 --- a/src/tables/CClient_functions.tbl +++ b/src/tables/CClient_functions.tbl @@ -16,9 +16,11 @@ ADD(CAST, "CAST") ADD(CHANGEFACE, "CHANGEFACE") ADD(CHARLIST, "CHARLIST") ADD(CLEARCTAGS, "CLEARCTAGS") +ADD(CLOSECONTAINER, "CLOSECONTAINER") ADD(CLOSEPAPERDOLL, "CLOSEPAPERDOLL") ADD(CLOSEPROFILE, "CLOSEPROFILE") ADD(CLOSESTATUS, "CLOSESTATUS") +ADD(CLOSEVENDORMENU,"CLOSEVENDORMENU") ADD(CODEXOFWISDOM, "CODEXOFWISDOM") ADD(CTAGLIST, "CTAGLIST") ADD(DYE, "DYE")