From 7fea3e8f6c3cce410884a395c13d90924cb377b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20K=C4=B1l=C4=B1=C3=A7o=C4=9Flu?= Date: Fri, 25 Oct 2024 17:46:39 +0300 Subject: [PATCH] Logout trigger for NPCs @Logout trigger When NPCs (mounts) are logged out of the session in any way, i.e. mounted or minimised, they will log out (disconnect) but will not trigger. --- Changelog.txt | 3 +++ src/game/chars/CChar.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 034689fd8..352a258ae 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3914,3 +3914,6 @@ 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. + +25-10-2024, canerksk +- Added: @Logout trigger When NPCs (mounts) are logged out of the session in any way, i.e. mounted or minimised, they will log out (disconnect) but will not trigger. \ No newline at end of file diff --git a/src/game/chars/CChar.cpp b/src/game/chars/CChar.cpp index c1b95127a..1b0b4a8bd 100644 --- a/src/game/chars/CChar.cpp +++ b/src/game/chars/CChar.cpp @@ -528,6 +528,14 @@ void CChar::SetDisconnected(CSector* pNewSector) GetClientActive()->GetNetState()->markReadClosed(); } + if (m_pNPC && !g_Serv.IsLoading()) + { + if (IsTrigUsed(TRIGGER_LOGOUT)) + { + OnTrigger(CTRIG_LogOut, this, nullptr); + } + } + if (m_pPlayer) { m_pPlayer->_iTimeLastDisconnectedMs = CWorldGameTime::GetCurrentTime().GetTimeRaw();