int cmd( string player, int sorted ) { string *quests, text; int i, size; if ( !player ) { quests = QUEST_HANDLER->query_quest_names(); text = "$P$Quest list$P$\nTotal quests on " + mud_name() + " :-\n\n"; } else { quests = LIBRARY->query_quests(player); if (!quests) { add_failed_mess( "That player has not done any " "quests.\n" ); return 0; } if ( sorted ) quests = sort_array( quests, 1 ); text = "$P$Quest list$P$\nQuests done for player " + player + " :-\n\n"; } size = sizeof(quests); for ( i = 0; i < size; i++ ) { text += sprintf("%d. %s (%s) %s\n", i + 1, quests[i], QUEST_HANDLER->query_quest_title (quests[i]), quest_text( quests[i] ) ); } tell_object( this_player(), text ); return 1; } /* cmd() */
nomask static int cmd_hook(string cmd) { string file; string verb; int foo ; mapping before, after ; verb = query_verb(); if (environment() && environment()->valid_exit(verb)) { verb = "go"; cmd = query_verb(); } file = (string)CMD_D->find_cmd(verb, explode(query("PATH"), ":")); if(file && file != "") { #ifdef PROFILING before = rusage() ; #endif foo = (int)call_other(file, "cmd_" + verb, cmd); #ifdef PROFILING after = rusage() ; "/adm/daemons/profile"->log_cmd(verb,before,after) ; #endif return foo ; } if (environment() && environment()->query("quiet")) return 0 ; #ifdef PROFILING before = rusage() ; #endif foo = (int)EMOTE_D->parse(verb, cmd); if (foo) { #ifdef PROFILING after = rusage() ; "/adm/daemons/profile"->log_cmd(verb,before,after) ; #endif return foo ; } #ifdef PROFILING before = rusage(); #endif #ifndef INTERMUD if(verb == "gwiz" || verb == "interwiz"){ printf("Sorry, %s does not support intermud.\n",capitalize(mud_name())); return 1; } #endif /* INTERMUD */ foo = (int) CHANNELS_D -> parse_channel( verb, cmd ); #ifdef PROFILING if( foo ) { after = rsuage(); "/adm/daemons/profile" -> log_cmd( verb, before, after ); } #endif return foo; }
nomask private void main() { outf("%s currently has the following quests:\n", mud_name()); out(implode(QUEST_D->get_goals_for_quests_cmd(),"\n")); out("\n\nType help <questname> for more info about a quest.\n"); }
varargs string imc2_mud_name(string name){ string mudname; if(name) mudname = name; else mudname = mud_name(); return replace_string(mudname," ","_"); }
nomask private void main() { outf("%s currently has the following quests:\n", mud_name()); out("(* after the quest indicates you have completed it)\n"); out(implode(map(QUEST_D->get_goals_for_quests_cmd(),(:modify:)),"\n")); out("\n\nType help <questname> for more info about a quest.\n"); out ("Or use the hint system.\n"); }
string do_info(string args) { mapping r; float cpu; string mach, vers, name, up, memory, listing; int obs, i; mixed *info, *services; if(args && args != ""){ args = I3_D->query_network_name(args); if(!args){ return("Could not obtain information about that MUD\n"); } info = I3_D->query_mud(args); services = keys(info[10]); listing = ""; for(i=0;i<sizeof(services);i++) listing += services[i]+", "; listing += "\n"; return ( "" + pad( "MUD NAME: " + args, PAD ) + "MUDLIB: " + info[5] + "\n" + pad( "ADDRESS: " + info[1] + " " + info[2], PAD ) + "DRIVER: " + info[7] + "\n" + pad("MUD TYPE: " + info[8], PAD ) + "CPU USE: " + "Unknown" + " %\n" + pad("CURRENT USERS: " + "Unknown", PAD ) + "MEMORY: " + "Unknown" + "\n" + pad("MUD STATUS: " + info[9], PAD ) + "OBJECTS: " + "Unknown\n" + pad("SERVICES: " + listing, PAD) + "" ); } r = rusage(); obs = sizeof( objects() ); mach = arch(); name = capitalize( mud_name() ); vers = version(); cpu = SCALE * (r["utime"] + r["stime"]) / uptime(); memory = (string) CMD_MEM -> parse_mem( memory_info() ); up = format_time( uptime() ); return ( "" + pad( "MUD NAME: " + name, PAD ) + "MUDLIB: " + MUDLIB_NAME + " (" + MUDLIB_VERSION_NUMBER + ")\n" + pad( "ARCHITECTURE: " + mach, PAD ) + "DRIVER: " + vers + "\n" + pad("DRIVER UPTIME: " + up, PAD ) + "CPU USE: " + cpu + " %\n" + pad("CURRENT USERS: " + sizeof( users() ), PAD ) + "MEMORY: " + memory + "\n" + pad("MUD STATUS: " + STATUS, PAD ) + "OBJECTS: " + obs + " loaded.\n" + "" ); }
string gateway( string args ) { return sprintf( @EndFormat <HTML> <HEAD> <TITLE>%s Who Gateway</TITLE> </HEAD> <BODY> <H1>%s Who Gateway</H1> <LISTING>%s%s%s</LISTING> </BODY> </HTML> EndFormat , capitalize( mud_name() ), capitalize( mud_name() ), (string)CMD_WHO-> do_who(), (string)CMD_MUDINFO-> do_info(), "______________________________________________________________________________" ); }
void setup() { set_light(40); set_short(mud_name()+": El Vacío"); set_long("Éste es el lugar al que vienes cuando el lugar en el que " + "estás desaparece y no tienes ningún lugar al que ir. " + "La razón por la que estás en él se deberá muy probablemente " + "a algún fallo involuntario del programador de la zona en la " + "que estabas.\n"); add_exit("ciudad", ENTRY_POS, "standard"); }
mixed cmd(string str) { string target; if(!str || str == "") str = mud_name(); target = INTERMUD_D->GetMudName(str); if(!target){ write("Unknown target mud."); return 1; } this_player()->SetProperty("pinging",1); SERVICES_D->eventSendAuthRequest(target); return 1; }
string finger_all() { object *who, link; int i, j; string msg; who = users(); who = filter_array(who, "filter_users", this_object()); who = sort_array(who, "sort_users", this_object()); j = who ? sizeof(who) : 0; msg = LINE1; if (j == 0) { msg += "[" + capitalize(mud_name()) + "] No one is presently " + "connected (" + ctime(time()) + ").\n"; } else { msg += "[" + capitalize(mud_name()) + "] " + j + (j == 1 ? " user" : " users") + " " + (j == 1 ? "is " : "are ") + "presently connected (" + ctime(time()) + ").\n"; msg += LINE2; msg += sprintf("%-12s%-20s%-14s%-7s%-21s", "Login", "Real Name", "Position", "Idle", "Where\n"); msg += LINE2; } for (i = 0; i < j; i++) { link = (object)who[i]->query_link(); if (!link || !link->RNAME) continue; msg += sprintf("%-12s%-20s%-14s%-7s%-21s", capitalize((string)link->NAME), capitalize(extract((string)link->RNAME, 0, 18)), capitalize((string)DOMAIN_D->query_domain_level(link)), query_idle_string(who[i], 0), extract(query_ip_name(who[i]), 0, 20) + "\n"); } return msg + LINE1; }
int cmd(string person, string text) { string target, mud; if (sscanf(person, "%s@%s", target, mud) != 2) { return 0; } if ( !strlen( target ) || !strlen( mud ) ) { return 0; } SERVICES_D->eventSendEmote(target, mud, text); add_succeeded_mess( ({ sprintf("You emote to %s@%s: %s@%s %s\n", capitalize(target), mud, this_player()->query_cap_name(), mud_name(), text), "" }) );
int cmd_hostname() { mapping list=I3_DAEMON->query_mudlist(); string *names=keys(list); mixed vls=values(list); printf( "%s is running on %s, port: %d.\n", capitalize(THIS_MUD), //(string)DNS_MASTER-> get_host_name(THIS_MUD), vls[member_array(mud_name(),names)][1], __PORT__, ); return 1; }
void do_tell(string str) { string name, host, mess, newhost; if (sscanf(str, "%s@%s %s", name, host, mess) == 3) { if ((newhost = INTERMUD_D->GetMudName(replace_string(host, ".", " ")))) { SERVICES_D->eventSendTell(name, newhost, mess); write(sprintf("You tell %s@%s: %-=*s\n", capitalize(name), host, (int)this_player()->query_cols() -strlen(name)-strlen(host)-13, mess)); return; } write(mud_name()+" does not know about the MUD "+host+".\n"); return; } } /* do_tell() */
int cmd(string str) { string ret; str = lower_case(str); str = (string)this_player()->expand_nickname(str); ret = (string)"/secure/finger"->refer_info(str); if (ret) { this_player()->more_string( this_player()->fit_message(ret), "refer: "+str ); return 1; } add_failed_mess("No one by the name of " + str + " has " "ever visited " + mud_name() + ".\n"); return 0; } /* cmd() */
mixed cmd(string args) { if( !args || args == "" ) { string *files; int cols, i, maxi, x, y; message("help", mud_name() + " has the following FAQ lists:", this_player()); cols = ((int *)this_player()->GetScreen())[0]; i = sizeof(files = get_dir(DIR_FAQS "/")); while(i--) if( (y =strlen(files[i])) > x ) x = y; cols = cols / (x+2); message("help", format_page(files, cols), this_player()); message("prompt", "\nWhich FAQ (general)? ", this_player()); input_to( (: GetFAQ :) ); return 1; }
int cmd(string str) { string tz, tmp, extra; int offset, x, scr, nr; if(sizeof(query_os_type())) extra = " for "+query_os_type(); tz = this_player()->GetProperty("timezone"); if(!tz || !valid_timezone(tz)) tz = query_tz(); offset = TIME_D->GetOffset(tz); offset += EXTRA_TIME_OFFSET; if(query_os_type() != "windows" ) x = offset * 3600; else x = 0; scr = ((int *)this_player()->GetScreen())[0]; nr = (time() - uptime()) + (EVENTS_D->GetRebootInterval() * 3600); tmp = center(mud_name(), scr) + "\n"; tmp += sprintf("%:-"+(scr/2)+"s%"+(scr/2)+"s\n", "Driver: " + version(), "Library: " + mudlib() + " " + mudlib_version()+extra); tmp += sprintf("%:-" + (scr/2) + "s%" + (scr/2) + "s\n", "Up since: " + ctime((time() - uptime()) +x), "Next reboot: " + ctime(nr + x)); tmp += center("Current time: " + ctime(time() + x) + " " + tz, scr); message("system", tmp, this_player()); return 1; }
mixed cmd(string args) { mixed tmp; string primary, secondary; if( !archp(previous_object()) ) return 0; // If no arguments are specified, dump all links. if( !args || args == "" ) { mapping links; string formatString; int screenSize = ((int *)this_player()->GetScreen())[0]; int playerSize = ((screenSize * 4) / 16) -1; int emailSize = ((screenSize * 6) / 16) - 1; int lastOnSize = ((screenSize * 6) / 16) - 1; if(playerSize < 14) playerSize = 14; if(emailSize < 25) emailSize = 25; if(lastOnSize < 25) lastOnSize = 25; formatString = "%:-" + playerSize + "s %:-" + emailSize + "s %:-" + lastOnSize + "s"; tmp = ({ center("%^CYAN%^ " + mud_name() + " Approved Character Links%^YELLOW%^", screenSize) });
string GetHelp() { return ("Syntax: version\n\n" "Gives you version information about "+mud_name()+" as well as how " "long the mud has been up in your local time if you have it " "specified."); }
int SendUptime(int fd){ socket_write(fd, "\n"+mud_name()+" has been up "+time_elapsed(uptime())+"\n\n"); debug("socket_close: "+socket_close(fd)); return 1; }
string query_intermud_ip(){ if(INTERMUD_D->GetMudList()[mud_name()]) return INTERMUD_D->GetMudList()[mud_name()][1]; else return ""; }
int main() { write(HIW + capitalize(mud_name()) + " has been running since " + NOR + HIG + ctime(time() - uptime()) + "\n" + NOR); return 1; }
static int cmd(string str, object me, string verb) { string ret, ttl; if (!strlen(str)) { object *obs; string type; int i; obs = users(); write(sprintf("%-12.12s %-20.20s %-20.20s %-20.20s\n", _LANG_FINGER_NAME, _LANG_FINGER_REAL_NAME, _LANG_FINGER_CITY, _LANG_FINGER_BIRTHDAY)); for (i = 0; i < sizeof(obs); i++) { string euid; string rnstr; string pname; object player; object user; user = obs[i]; player = obs[i]->player(); // should not happen... EVER! if (!player) continue; if (user->query_invis() && !this_user()->query_coder()) continue; if (user->query_invis() > 1 && !this_user()->query_administrator()) continue; // type = (obs[i]->query_earmuffs() ? "e" : " "); euid = geteuid(user); type = user->query_object_type(); if (user->query_object_type() != "X") { string r, birthday, name; rnstr = (string)user->query_real_name(); pname = player->query_cap_name(); name = player->query_name(); if (rnstr && rnstr[0..0] == ":") if (!MASTER->valid_read("/save/players/"+name[0..0]+"/"+name, geteuid(this_user()))) rnstr = "-"; if (user->query_birthday()) birthday = handler(CALENDAR_HANDLER)->convert_birthday(user->query_birthday()); else birthday = ""; r = sprintf("%-12.12s %2.2s %-20.20s %-20.20s %-20.20s\n", (user->query_invis() ? "(" + player->query_cap_name() + ")" : "" + player->query_cap_name()), type, (rnstr?rnstr:" "), ((ret = user->query_location())?ret:" "), birthday); write(r); } else { string r; r = sprintf("%-12.12s %2.2s\n", "login", type); write(r); } } return 1; } str = (string)this_player()->expand_nickname(str); if ("/lib/core/secure/bastards.c"->query_banish_reason(str)) { string retval; retval = sprintf("%35-s%35-s\n", "Nombre : "+str, "(tiene prohibido el acceso)"); // retval += "No tiene muchos segundos reales de edad.\n"; // retval += "Nunca tuvo correo (ni lo tendra...).\n"; // retval += "Sin plan.\nSin futuro.\n"; ret = "/lib/core/secure/bastards.c"->query_banish_reason(str); write(retval + "Prohibido por: '" + capitalize(ret) + "'\n"); return 1; } ttl = "===] %^GREEN%^"+mud_name()+"%^RESET%^ [==="; ret = (string)"/lib/core/secure/finger"->finger_info(str, me); if (strlen(ret)) { ret = handler("frames")->frame(ret, ttl, this_user()->query_cols()); write(ret); return 1; } /* else if (me->query_coder() && sscanf(str, "%s@%s", mud, mud) == 2) { "/net/daemon/out_finger"->do_finger(str); return 1; } */ else { notify_fail("Nadie con el nombre " + str + " ha visitado "+mud_name()+".\n"); return 0; } }
string finger_group(string group) { int i, j; string msg; object link; mixed tmp1, tmp2, tmp3, tmp4, tmp5; string *group2; groups = master()->query_groups(); if (!group || undefinedp(groups[group])) return "Finger: There is no such group.\n"; /* * special case: filter root members out of admin group */ // if (group == "admin") // groups["admin"] = filter_array(groups["admin"], "filter_root", this_object()); group2 = groups[group]; j = group2 ? sizeof(group2) : 0; msg = LINE1; if (j == 0) { msg += "[" + capitalize(mud_name()) + "] No members of " + capitalize(group) + " group (" + ctime(time()) + ").\n"; } else { msg += "[" + capitalize(mud_name()) + "] " + j + (j == 1 ? " user" : " users") + " " + "in " + capitalize(group) + " group (" + ctime(time()) + ").\n"; msg += LINE2; msg += sprintf("%-12s%-20s%-14s%-28s", "Login", "Real Name", "Domain", "On\n"); msg += LINE2; group2 = sort_array(group2, "do_alpha", this_object()); for (i = 0; i < j; i++) { tmp1 = group2[i]; /* logid id */ link = find_player(tmp1); if (link) link = link->query_link(); else link = restore_data(tmp1); if (!link) continue; /* no such user */ tmp2 = (string)link->RNAME; /* real name */ tmp3 = DOMAIN_D->query_domain(link); if ((tmp3 == 0) || (tmp3 == "")) tmp3 = "None"; tmp4 = find_player(tmp1); if (!tmp4 || !filter_users(tmp4)) tmp5 = "Last "; else tmp5 = "Since "; if (!link->query("last_on")) tmp5 += "(Unavailable)"; else tmp5 += ctime((int)link->query("last_on")); msg += sprintf("%-12s%-20s%-14s%28s", capitalize((string)tmp1), capitalize(extract((string)tmp2, 0, 18)), capitalize((string)tmp3), (string)tmp5 + "\n"); if (!find_player(tmp1)) { link->remove(); } } } return msg + LINE1; }