From d50870f457c42ed89d500425aec81a037bf76786 Mon Sep 17 00:00:00 2001 From: AconiteX <63141077+AconiteX@users.noreply.github.com> Date: Sat, 14 Aug 2021 03:17:37 -0400 Subject: [PATCH] Block Tells/Mail in NPE #12 #13 --- .../src/shared/command/CommandCppFuncs.cpp | 18 ++++++++++++++++++ .../page/SwgCuiPersistentMessageBrowser.cpp | 16 ++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/engine/client/library/clientGame/src/shared/command/CommandCppFuncs.cpp b/src/engine/client/library/clientGame/src/shared/command/CommandCppFuncs.cpp index 399dff645..801c9d23d 100644 --- a/src/engine/client/library/clientGame/src/shared/command/CommandCppFuncs.cpp +++ b/src/engine/client/library/clientGame/src/shared/command/CommandCppFuncs.cpp @@ -1057,6 +1057,12 @@ void CommandCppFuncsNamespace::commandFuncInstantMessageTell (Command const if (!player || player->getNetworkId () != actorId) return; + if(Game::isTutorial() && !Game::getPlayerObject()->isAdmin()) + { + CuiSystemMessageManager::sendFakeSystemMessage(Unicode::narrowToWide("You cannot initiate a tell while in the tutorial.")); + return; + } + Unicode::String result; IGNORE_RETURN(CuiInstantMessageManager::tell (params, result)); if (!result.empty ()) @@ -1071,6 +1077,12 @@ void CommandCppFuncsNamespace::commandFuncInstantMessageTtell (Command const if (!player || player->getNetworkId () != actorId) return; + if (Game::isTutorial() && !Game::getPlayerObject()->isAdmin()) + { + CuiSystemMessageManager::sendFakeSystemMessage(Unicode::narrowToWide("You cannot initiate a tell while in the tutorial.")); + return; + } + Unicode::String result; IGNORE_RETURN(CuiInstantMessageManager::targetedTell (params, result)); if (!result.empty ()) @@ -1085,6 +1097,12 @@ void CommandCppFuncsNamespace::commandFuncInstantMessageRetell (Command const if (!player || player->getNetworkId () != actorId) return; + if (Game::isTutorial() && !Game::getPlayerObject()->isAdmin()) + { + CuiSystemMessageManager::sendFakeSystemMessage(Unicode::narrowToWide("You cannot initiate a tell while in the tutorial.")); + return; + } + Unicode::String result; IGNORE_RETURN(CuiInstantMessageManager::retell (params, result)); if (!result.empty ()) diff --git a/src/game/client/library/swgClientUserInterface/src/shared/page/SwgCuiPersistentMessageBrowser.cpp b/src/game/client/library/swgClientUserInterface/src/shared/page/SwgCuiPersistentMessageBrowser.cpp index acdb14b6e..572435611 100644 --- a/src/game/client/library/swgClientUserInterface/src/shared/page/SwgCuiPersistentMessageBrowser.cpp +++ b/src/game/client/library/swgClientUserInterface/src/shared/page/SwgCuiPersistentMessageBrowser.cpp @@ -119,11 +119,11 @@ m_lastScrollPosY (0L) setState (MS_closeable); setState (MS_closeDeactivates); - // disable New/Reply/Forward button if squelched + // disable New/Reply/Forward button if squelched or in tutorial const bool isSquelched = Game::isPlayerSquelched(); - m_buttonNew->SetEnabled(!isSquelched); - m_buttonReply->SetEnabled(!isSquelched); - m_buttonForward->SetEnabled(!isSquelched); + m_buttonNew->SetEnabled(!isSquelched && !Game::isTutorial()); + m_buttonReply->SetEnabled(!isSquelched && !Game::isTutorial()); + m_buttonForward->SetEnabled(!isSquelched && !Game::isTutorial()); registerMediatorObject (*m_table, true); registerMediatorObject (*m_buttonNew, true); @@ -710,14 +710,14 @@ void SwgCuiPersistentMessageBrowser::update(float deltaTimeSecs) { CuiMediator::update(deltaTimeSecs); - // disable New/Reply/Forward button if squelched + // disable New/Reply/Forward button if squelched or in tutorial const bool isSquelched = Game::isPlayerSquelched(); if (m_buttonNew) - m_buttonNew->SetEnabled(!isSquelched); + m_buttonNew->SetEnabled(!isSquelched && !Game::isTutorial()); if (m_buttonReply) - m_buttonReply->SetEnabled(!isSquelched); + m_buttonReply->SetEnabled(!isSquelched && !Game::isTutorial()); if (m_buttonForward) - m_buttonForward->SetEnabled(!isSquelched); + m_buttonForward->SetEnabled(!isSquelched && !Game::isTutorial()); } //======================================================================