PWE_PRC8/_module/nss/ff_stat_ff.nss
Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

56 lines
1.8 KiB
Plaintext

//*************************************
//* NWN-MySQL 4.0 (c) 2004 FastFrench *
//*************************************
// This file is licensed under the terms of the
// GNU GENERAL PUBLIC LICENSE (GPL) Version 2
// ************************
// ** ff_stat_ff_now.nss **
// ************************
// ** This script is part of the server status dialog
#include "ff_include"
string DisplayTime(int NbMinute)
{
if (NbMinute>60)
return IntToString(NbMinute/60)+"hr "+IntToString(NbMinute%60)+"mn";
else
return IntToString(NbMinute%60)+"mn";
}
//µ
int StartingConditional()
{
int NbJ = GetLocalInt(GetPCSpeaker(),"MenuNo");
string sPeriod="24 hours";
if (NbJ==7) sPeriod="one week";
else
if (NbJ==30) sPeriod="one month";
else
if (NbJ==90) sPeriod="three months";
else
if (NbJ==180) sPeriod="six months";
else
NbJ = 1;
SQLLocalExecAndFetchDirect("SELECT COUNT(Date), ROUND((MAX(NbPlayerAvg)+MIN(NbPlayerAvg))/2),MAX(NbPlayerMax),Max(NbDMMax) FROM restart WHERE Date>DATE_SUB(NOW(),INTERVAL "+IntToString(NbJ)+" DAY) AND CauseRestart!=3");
int NbRestart = SQLLocalEatDataInt();
if (NbRestart<1) return FALSE;
string AvgPlayer = SQLLocalEatData();
string MaxPlayer = SQLLocalEatData();
string MaxDM = SQLLocalEatData();
string sRes=ff_Colorize("[b]Within [g]"+sPeriod+"[b], there were [g]"+AvgPlayer+"[b] players\n");
sRes += ff_Colorize("on average and up to [g]"+MaxPlayer+"[b] players max.\non this server.\n\n");
sRes += ff_Colorize("There were up to [g]"+MaxDM+"[b] DMs within this same period of time.\n\n");
sRes += ff_Colorize("The server restarted [g]"+IntToString(NbRestart)+"[b] times,\n");
sRes += ff_Colorize("so every [g]"+DisplayTime((60*24*NbJ)/NbRestart)+"[b] on average\n");
SetCustomToken(100, sRes);
return TRUE;
}