1 int gived; 2 id(string str)3int id(string str) { 4 return str == "stone" || str == "black stone"; 5 } 6 7 string short() { 8 return "A black stone"; 9 } 10 11 void long() { 12 write("The stone is completely black, and feels warm to the touch.\n"); 13 write("There seems to be somthing magic with it.\n"); 14 } 15 query_weight()16int query_weight() { return 1; } 17 18 /* Prevent giving away this object */ drop()19int drop() { 20 gived += 1; 21 if (gived == 2) 22 return 1; 23 else 24 return 0; 25 } 26 get()27int get() { return 1; } 28 init()29void init() { 30 add_action("list_peoples", "people"); 31 add_action("list_files", "ls"); 32 add_action("cat_file", "cat"); 33 add_action("drop_object", "drop"); 34 } 35 list_files(string path)36int list_files(string path) 37 { 38 ls(path); 39 return 1; 40 } 41 cat_file(string path)42int cat_file(string path) 43 { 44 if (!path) 45 return 0; 46 cat(path); 47 return 1; 48 } 49 list_peoples()50int list_peoples() { 51 object * list; 52 int i, a; 53 54 list = users(); 55 write("There are now " + sizeof(list) + " players"); 56 for (i=0, a=0; i < sizeof(list); i++) 57 if (query_idle(list[i]) >= 5 * 60) 58 a++; 59 if (a) 60 write(" (" + (sizeof(list) - a) + " active)"); 61 write(". " + query_load_average() + "\n"); 62 for(i=0; i<sizeof(list); i++) { 63 string name; 64 name = list[i]->query_real_name(); 65 if (!name) 66 name = list[i]->query_name(); 67 if (!name) 68 name = "logon"; 69 name = capitalize(name); 70 if (list[i]->short() == 0) 71 name = "(" + name + ")"; 72 if (strlen(name) < 8) 73 name = name + "\t"; 74 write(query_ip_number(list[i]) + "\t" + name + "\t" + 75 list[i]->query_level() + "\t"); 76 a = list[i]->query_age(); 77 if (a / 43200 > 9) 78 write(a / 43200 + " D"); 79 else if (a / 43200 > 0) 80 write(a / 43200 + " D"); 81 else if (a / 1800 > 9) 82 write(a / 1800 + " h"); 83 else if (a / 1800 > 0) 84 write(a / 1800 + " h"); 85 else if (a / 30 > 9) 86 write(a / 30 + " m"); 87 else 88 write(a / 30 + " m"); 89 if (query_idle(list[i]) >= 5 * 60) 90 write(" I\t"); 91 else 92 write("\t"); 93 if (environment(list[i])) 94 write(object_name(environment(list[i]))); 95 write("\n"); 96 } 97 return 1; 98 } 99 drop_object(string str)100int drop_object(string str) { 101 if (str == "all") { 102 drop_object("black stone"); 103 return 0; 104 } 105 if (!str || !id(str)) 106 return 0; 107 write("The stone dissapears.\n"); 108 say(this_player()->query_name() + " drops a black stone. It dissapears.\n"); 109 this_player()->add_weight(-1); 110 destruct(this_object()); 111 return 1; 112 } 113