Code:
src/oasis_list.c
@@ -246,6 +246,40 @@ void perform_obj_type_list(struct char_data * ch, char *arg)
page_string(ch->desc, buf, TRUE);
}
+void perform_obj_extra_list(struct char_data *ch, char *arg)
+{
+ int num, apply, found = 0;
+ size_t len = 0, tmp_len = 0;
+ obj_vnum ov;
+ char buf[MAX_STRING_LENGTH];
+
+ apply = atoi(arg);
+
+ if (apply < 0 || apply >= NUM_ITEM_FLAGS) {
+ send_to_char(ch, "Not a valid extra flag\r\n");
+ return;
+ }
+
+ len = snprintf(buf, sizeof(buf), "Objects with the extra flag '%s'\r\n"
+ "Index VNum Num Object Name Object Type\r\n"
+ "----- ------- ----- ------------------------------------------ ----------------\r\n", extra_bits[apply]);
+ for (num = 0; num <= top_of_objt; num++) {
+ if (IS_SET_AR((obj_proto[num].obj_flags.extra_flags), apply)) {
+ ov = obj_index[num].vnum;
+ tmp_len = snprintf(buf+len, sizeof(buf)-len, "%s%4d%s) %s[%s%5d%s] %s(%s%3d%s)%s %-*s%s [%s]%s%s\r\n",
+ QGRN, ++found, QNRM, QCYN, QYEL, ov, QCYN, QNRM,
+ QGRN, obj_index[num].number, QNRM, QCYN, 42+count_color_chars(obj_proto[num].short_description),
+ obj_proto[num].short_description, QYEL, item_types[obj_proto[num].obj_flags.type_flag], QNRM,
+ obj_proto[num].proto_script ? " [TRIG]" : "");
+ len += tmp_len;
+ if (len > sizeof(buf))
+ break;
+ }
+ }
+
+ page_string(ch->desc, buf, TRUE);
+}
+
void perform_obj_aff_list(struct char_data * ch, char *arg)
{
int num, i, apply, v1 = 0, found = 0;
@@ -439,9 +473,10 @@ ACMD(do_oasis_list)
send_to_char(ch, " %solist <name>%s - List all named objects with count\r\n", QYEL, QNRM);
send_to_char(ch, " %solist type <num>%s - List all objects of a specified type\r\n", QYEL, QNRM);
send_to_char(ch, " %solist affect <num>%s - List top %d objects with affect\r\n", QYEL, QNRM, MAX_OBJ_LIST);
+ send_to_char(ch, " %solist extra <num>%s - List top %d objects with extra flag\r\n", QYEL, QNRM, MAX_OBJ_LIST);
send_to_char(ch, "Just type %solist affect%s or %solist type%s to view available options\r\n", QYEL, QNRM, QYEL, QNRM);
return;
- } else if (is_abbrev(arg, "type") || is_abbrev(arg, "affect")) {
+ } else if (is_abbrev(arg, "type") || is_abbrev(arg, "affect") || is_abbrev(arg, "extra" )) {
if (is_abbrev(arg, "type")) {
if (!*arg2) {
send_to_char(ch, "Which object type do you want to list?\r\n");
@@ -457,6 +492,22 @@ ACMD(do_oasis_list)
return;
}
perform_obj_type_list(ch, arg2);
+ } else if (is_abbrev(arg, "extra")) {
+ if (!*arg2) {
+ send_to_char(ch, "Which object extra flag do you want to list?\r\n");
+ for (i = 0; i < NUM_ITEM_FLAGS; i++)
+ {
+ send_to_char(ch, "%s%2d%s-%s%-14s%s", QNRM, i, QNRM, QYEL, extra_bits[i], QNRM);
+ if (!(i%4)) send_to_char(ch, "\r\n");
+ }
+ send_to_char(ch, "\r\n");
+ send_to_char(ch, "Usage: %solist extra <num>%s\r\n", QYEL, QNRM);
+ send_to_char(ch, "Displays top %d objects, in order, with the selected extra flag.\r\n", MAX_OBJ_LIST);
+
+ return;
+ }
+ perform_obj_extra_list(ch, arg2);
+
} else { /* Assume arg = affect */
if (!*arg2) {
send_to_char(ch, "Which object affect do you want to list?\r\n");