int main(object me) { float value; mapping r; if (time() - me->query_temp("scan_time") < 10 && ! wizardp(me)) return notify_fail("等等,系统喘气中……\n"); r = rusage(); value = SCALE * (r["utime"] + r["stime"]) / uptime(); write(NOR + WHT "\n\t\t .__________ 系 统 资 讯 __________.\n"); write(NOR + WHT "\t\t ─────────────────────────\n"); write(NOR + WHT "\t\t 游戏的识别名称: " + MUD_NAME + "\n"); write(NOR + WHT "\t\t 界面系统的版本: " + __VERSION__ + "\n"); write(NOR + WHT "\t\t 系统函数库版本: Nitan Mudlib Version 2.1\n"); printf(NOR + WHT "\t\t CPU 使用百分比: %f %% 被这个游戏使用中\n", value ); write(NOR + WHT "\t\t CPU 的负担状况: " + query_load_average() + "\n"); printf(NOR + WHT "\t\t 共使用的记忆体: %s bytes\n", memory_expression(memory_info()) ); write(NOR + WHT "\t\t 线上使用者总数: " + sizeof( users() ) + " 个人在线上\n"); write(NOR + WHT "\t\t 注册使用者总数: " + count_ppls() + " 个人在本游戏注册\n"); write(NOR + WHT "\t\t 载入的物件总数: " + sizeof( objects() ) + " 个物件\n"); write(NOR + WHT "\t\t 心跳总数的资讯: " + sizeof(heart_beats()) + " 个\n"); write(NOR + WHT "\t\t 延迟呼叫数资讯: " + sizeof(call_out_info()) + " 个\n"); write(NOR + WHT "\t\t 系统负载的资讯: " + query_load_average() + "\n"); write(NOR + WHT "\t\t 讯息传输的资讯: " + query_rusage_message() + "\n"); write(NOR + WHT "\t\t 连续执行的时间: " + dotime() + "\n"); write(NOR + WHT "\t\t 游戏现在的状态: " + STATUS + "\n" NOR); write(NOR + WHT "\t\t 游戏对 PK 限制: 每天不超过 8 人,每人不超过 2 次\n\n" NOR); me->set_temp("scan_time", time()); return 1; }
int cmd_whenreboot() { int x, hour = 0, min = 0, sec = 0; string obname; mixed *callouts; callouts = call_out_info(); x = sizeof(callouts); sec = (int)SHUTDOWN_D->query_shutdown(); if (!sec) { while (x--) { catch(obname = file_name(callouts[x][0])); if ((obname=="/adm/daemons/rebootd") && ((string)callouts[x][1] == "doomsday")) sec = ((int)callouts[x][2] + 3600); } } else {
int cmd_mudstatus() { int utime=uptime(), mem=memory_info(), i=0, ct=0; object *o; if(!archp(this_player())) return 0; write("%^BLUE%^+=+=+=+( %^BOLD%^%^WHITE%^Mud Status%^RESET%^%^BLUE%^ )+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=%^RESET%^"); write(" The mud has been online for "+query_time(uptime())+""); write(" The mud will reboot in "+query_time((EVENTS_D->query_next_reboot())-time())+""); write(" Number of Objects Loaded: "+i=sizeof(o=objects())); write(" "+add_commas(mem)+" bytes of memory is loaded."); while(i--) if(query_heart_beat(o[i])) ct++; write(" Number of objects with heartbeats: "+ct+"."); write(" Number of callouts: "+sizeof(call_out_info())+"."); write(" Processing "+query_load_average()+"."); if(find_object("/d/nopk/standard/freezer")) write(" Number of link-dead players: "+ sizeof( all_inventory( find_object( "/d/nopk/standard/freezer" ) ) ) ); write(" Number of players online: "+(string)sizeof(users())); write("%^BLUE%^+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+%^RESET%^\n"); return 1; }
void check_whonature() { mixed *info; int i; object ob; int who=0, nature=0; info = call_out_info(); for(i=0; i<sizeof(info); i++) { if( "/"+sprintf("%O",info[i][0]) == WHO_D ) who =1; if( "/"+sprintf("%O",info[i][0]) == NATURE_D ) nature=1; } if(!who) { if(ob=find_object(WHO_D)) destruct(ob); call_other(WHO_D,"???"); } if(!nature) { if(ob=find_object(NATURE_D)) destruct(ob); call_other(NATURE_D,"???"); } return; }
// callouts.c inherit F_CLEAN_UP; int main(object me, string arg) { mixed *info; int i; string output; output = sprintf("%-30s %-20s %5s %s\n", "物件", "函数", "延迟时间", "参数"); if( arg && arg!="" ) info = filter_array(call_out_info(), (: $1[1]==$2 :), arg); else info = call_out_info(); for(i=0; i<sizeof(info); i++) { if ( sizeof(info[i]) == 4) output += sprintf("%-30O %-20s %5d %O\n", info[i][0], info[i][1], info[i][2], info[i][3] ); else output += sprintf("%-30O %-20s %5d\n", info[i][0], info[i][1], info[i][2] ); } me->start_more(output); return 1; } int help()