int cmd_equip (string str, int silent) { object armor, *stuff; int num = 1, x, counter; // Initialization of variables num = 1; counter = 0; stuff = all_inventory(this_player()); if (!str) str="all"; // Silent equipping for monsters equipping from the create() // function. (04-06-98) Chronos.. if (sscanf(str, "%s SILENT", str)==1 && TP->query("npc")) silent = 1; // Support for format: equip all if (str=="all") { write("Equipping all valid armors.\n"); stuff = filter_array(stuff, "filter_equippable"); for (x=0; x<sizeof(stuff); x++) if (stuff[x]->query("armor_object")) counter += equip_func(stuff[x], silent); if (counter) write("You equip "+counter+" items.\n"); else write("You have nothing left to equip.\n"); return 1; } // Support for format: equip armour 3 // If no number argument is used, "num" defaults to 1. sscanf(str, "%s %d", str, num); while( (counter < num) && (x < sizeof(stuff)) ) { if (stuff[x]->id(str)) counter++; if (counter==num) equip_func(stuff[x], silent); x++; } if (!counter) write("You don't possess a "+str+".\n") ; return 1; }
// recursively search the help dir. // mon 2/26/98 int search_dir(string *dirs, string arg, object me, int wildcard, int wizp) { int i = sizeof(dirs), j; mixed *filenames, *sub_dir; while(i--) { filenames=get_dir(dirs[i] + arg, -1); if(pointerp(filenames) && sizeof(filenames)) { if(!wildcard && filenames[0][1]>0) { //without wildcard, filenames[0] must be the only match. //which should be the same as "dirs[i] + arg" me->start_more( read_file(dirs[i] + arg) ); return 1; } if(wildcard) { j=sizeof(filenames); while(j--) { if(filenames[j][1]>0) { write("help "+filenames[j][0]+ (wizp?" ("+dirs[i]+")":"")+ "\n"); found++; } } } } //check sub_directories if(pointerp(filenames=get_dir(dirs[i], -1))) { if(pointerp(sub_dir=filter_array(filenames, "find_sub"))) { string *dirs1=({}); j=sizeof(sub_dir); while(j--) { dirs1+=({dirs[i]+sub_dir[j][0]+"/"}); } if(search_dir(dirs1, arg, me, wildcard, wizp)==1 && !wildcard) return 1; } }
string living_description (object ob) { object *inv; int i; string a1, a2, tmp, reg, race, raceat, short, gender, genat; reg = (string)ob->query ("long"); if (!reg) reg = ""; race = (string)ob->query ("race"); raceat = article (race) + " " + race; gender = (string)ob->query ("gender"); genat = ((viewingOb == ob) ? "You are" : capitalize (subjective (gender)) + " is"); i = sizeof (inv = all_inventory(ob)); while (i--) if (tmp = inv[i]->query ("extra_look")) { while (sscanf(tmp, "%s$N%s", a1, a2) > 1) tmp = sprintf ("%s%s%s", a1, ob->query ("cap_name"), a2); reg += tmp; } if (stringp (race) && race != "") reg = sprintf ("%s%s %s.\n", reg, genat, raceat); #ifndef BLOCK_ATTACK if (!Attacking) { #endif inv = filter_array (inv, "can_see2", this_object(), viewingOb); i = sizeof (inv); if (i) { reg = sprintf ("%s %s carrying:\n", reg, genat); while (i--) { short = (string)inv[i]->query ("short"); if (short) reg = sprintf ("%s %s%s%s.\n", reg, short, (inv[i]->query ("equipped") ? " (equipped)" : ""), (inv[i]->query ("wielded") ? " (wielded)" : "")); } } else
int cmd_echo(string str) { object *admins; object here; if(!str) { return help(); } else { // can't fool an admin, folks if (here = environment(previous_object())) { if (sizeof(admins = filter_array(all_inventory(here), "filter_admins", this_object()))) message("write", sprintf(">>> %s echoes:\n", capitalize(geteuid(previous_object()))), admins, previous_object()); } say(sprintf("%-=75s", str+"\n")); printf("%-=75s", "You echo: "+str+"\n"); 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_news(string file) { string *dir; dir = get_dir(NEWS_DIR); if(!wizardp(this_player())) dir = filter_array(dir, "filter_news", this_object()); if( !file || file == "") { write("Topics are:\n\n"); write(display_dir(dir) + "\n"); write("Type news <topic> to see more specific information.\n"); } else { if(member_array(file, dir) == -1) { write("There is no such news article.\n"); return 1; } previous_object()->more(NEWS_DIR + "/" + file, 1); } return 1; }