diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-07 11:35:13 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-07 11:35:13 +0000 |
commit | 24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563 (patch) | |
tree | b5c5bcfdd52bea7f5b223653e24e757d1369551a /src/map/atcommand.c | |
parent | 4bd24425858e186737a3dd60bbe1ee2f3a4a4e67 (diff) | |
download | hercules-24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563.tar.gz hercules-24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563.tar.bz2 hercules-24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563.tar.xz hercules-24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563.zip |
* Updated core and map-server to jA 1115~1137
* Fixed a typo in Volcano
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1206 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ded7d593d..9fea47dee 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -213,6 +213,7 @@ ACMD_FUNC(mobsearch); ACMD_FUNC(cleanmap); ACMD_FUNC(npctalk); ACMD_FUNC(pettalk); +ACMD_FUNC(users); ACMD_FUNC(autoloot); // by Upa-Kun #ifndef TXT_ONLY @@ -489,6 +490,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_CleanMap, "@cleanmap", 0, atcommand_cleanmap }, { AtCommand_NpcTalk, "@npctalk", 0, atcommand_npctalk }, { AtCommand_PetTalk, "@pettalk", 0, atcommand_pettalk }, + { AtCommand_Users, "@users", 0, atcommand_users }, { AtCommand_ResetState, "/reset", 40, NULL }, #ifndef TXT_ONLY // sql-only commands @@ -7839,6 +7841,47 @@ atcommand_pettalk( } /*========================================== + * @users + * サーバー内の人数マップを表示させる + * 手抜きのため汚くなっているのは仕様です。 + *------------------------------------------ + */ + +static struct dbt *users_db; +static int users_all; + +static int atcommand_users_sub1(struct map_session_data* sd,va_list va) { + int users = (int)strdb_search(users_db,sd->mapname) + 1; + users_all++; + strdb_insert(users_db,sd->mapname,(void *)users); + return 0; +} + +static int atcommand_users_sub2(void* key,void* val,va_list va) { + char buf[256]; + struct map_session_data* sd = va_arg(va,struct map_session_data*); + sprintf(buf,"%s : %d (%d%%)",(char *)key,(int)val,(int)val * 100 / users_all); + clif_displaymessage(sd->fd,buf); + return 0; +} + +int +atcommand_users( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char buf[256]; + users_all = 0; + users_db = strdb_init(24); + clif_foreachclient(atcommand_users_sub1); + strdb_foreach(users_db,atcommand_users_sub2,sd); + sprintf(buf,"all : %d",users_all); + clif_displaymessage(fd,buf); + strdb_final(users_db,NULL); + return 0; +} + +/*========================================== * *------------------------------------------ */ |