feat(Scripts/Commands): Add online session time to pinfo command (#24388)

Co-authored-by: victor <vngodoyr@unap.cl>
Co-authored-by: sogladev <sogladev@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
Victor Godoy
2026-03-21 00:05:54 -03:00
committed by GitHub
parent d17aac161f
commit 710d4986bd
3 changed files with 12 additions and 0 deletions

View File

@@ -2418,6 +2418,13 @@ public:
// Output XX. LANG_PINFO_CHR_PLAYEDTIME
handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true)));
// Output XXI. LANG_PINFO_CHR_ONLINETIME (only for online players)
if (playerTarget)
{
uint32 onlineTime = uint32(GameTime::GetGameTime().count() - playerTarget->m_logintime);
handler->PSendSysMessage(LANG_PINFO_CHR_ONLINETIME, secsToTimeString(onlineTime, true));
}
// Mail Data - an own query, because it may or may not be useful.
// SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
CharacterDatabasePreparedStatement* mailQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);