Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout trigger for NPCs #1322

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 8 additions & 0 deletions src/game/chars/CChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down