// Just replace your old do_who with this one. It should work fine. You can remove the // color if you want, we put it in because we liked it this way.. // // 1. We don't want our names in bright, blinking letters on your login screen. // 2. We don't need a big line in your credits (you can do it if you want, but it is // not obligatory) // 3. All we ask, is to email us (impteam@planiamud.cjb.net) and let us know if you // are using it. We like to know if we are of any service to the MUD community! #define WHO_FORMAT \ "format: who [minlev[-maxlev]] [-n name] [-c classlist] [-s] [-o] [-q] [-r] [-z]\r\n" ACMD(do_who) { struct descriptor_data *d; struct char_data *tch; char name_search[MAX_INPUT_LENGTH]; char mode; size_t i; int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0; int showclass = 0, short_list = 0, outlaws = 0, num_can_see = 0; int who_room = 0; skip_spaces(&argument); strcpy(buf, argument); name_search[0] = '\0'; while (*buf) { half_chop(buf, arg, buf1); if (isdigit(*arg)) { sscanf(arg, "%d-%d", &low, &high); strcpy(buf, buf1); } else if (*arg == '-') { mode = *(arg + 1); /* just in case; we destroy arg in the switch */ switch (mode) { case 'o': case 'k': outlaws = 1; strcpy(buf, buf1); break; case 'z': localwho = 1; strcpy(buf, buf1); break; case 's': short_list = 1; strcpy(buf, buf1); break; case 'q': questwho = 1; strcpy(buf, buf1); break; case 'l': half_chop(buf1, arg, buf); sscanf(arg, "%d-%d", &low, &high); break; case 'n': half_chop(buf1, name_search, buf); break; case 'r': who_room = 1; strcpy(buf, buf1); break; case 'c': half_chop(buf1, arg, buf); for (i = 0; i < strlen(arg); i++) showclass |= find_class_bitvector(arg[i]); break; default: send_to_char(WHO_FORMAT, ch); return; } /* end of switch */ } else { /* endif */ send_to_char(WHO_FORMAT, ch); return; } } /* end while (parser) */ send_to_char("Players\r\n--------\r\n", ch); for (d = descriptor_list; d; d = d->next) { if ((STATE(d) != CON_PLAYING) && ((STATE(d) <= CON_DISCONNECT))) continue; if (d->original) tch = d->original; else if (!(tch = d->character)) continue; if (*name_search && str_cmp(GET_NAME(tch), name_search) && !strstr(GET_TITLE(tch), name_search)) continue; if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high) continue; if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF)) continue; if (questwho && !PRF_FLAGGED(tch, PRF_QUEST)) continue; if (localwho && world[ch->in_room].zone != world[tch->in_room].zone) continue; if (who_room && (tch->in_room != ch->in_room)) continue; if (showclass && !(showclass & (1 << GET_CLASS(tch)))) continue; *buf2 = '\0'; /* Normal Who display */ if (GET_LEVEL(tch) >= LVL_IMPL) /* We have 115 levels */ strcpy(buf2, "&R*IMPLEMENTOR*&y"); else if (GET_LEVEL(tch) >= 114) strcpy(buf2, "&RCOIMPLEMENTOR&y"); else if (GET_LEVEL(tch) >= 113) strcpy(buf2, "&RA-IMPLEMENTOR&y"); else if (GET_LEVEL(tch) >= 112) strcpy(buf2, "&rGREATER GOD&y"); else if (GET_LEVEL(tch) >= 111) strcpy(buf2, "&rDEITY&y"); else if (GET_LEVEL(tch) >= 110) strcpy(buf2, "&rGOD&y"); else if (GET_LEVEL(tch) >= 109) strcpy(buf2, "&YRULER&y"); else if (GET_LEVEL(tch) >= 108) strcpy(buf2, "&YCREATOR&y"); else if (GET_LEVEL(tch) >= 107) strcpy(buf2, "ANGEL&y"); else if (GET_LEVEL(tch) >= 106) strcpy(buf2, "IMMORTAL&y"); /* Lowest Immortal level */ else if (GET_LEVEL(tch) >= 105) strcpy(buf2, "LEGEND&n"); /* Legendary players */ else if (GET_LEVEL(tch) >= 104) strcpy(buf2, "&GWIZARD&n"); else if (GET_LEVEL(tch) >= 103) strcpy(buf2, "&GEMPEROR&n"); else if (GET_LEVEL(tch) >= 102) strcpy(buf2, "&GLORD&n"); else if (GET_LEVEL(tch) >= 101) strcpy(buf2, "&GHERO&n"); else if (GET_LEVEL(tch) >= 100) strcpy(buf2, "&GMASTER&n"); /* Legendary players */ else sprintf(buf2, "%s", pc_race_types[(int)GET_RACE(tch)]); *buf3 = '\0'; /* Short-list Who display */ if (GET_LEVEL(tch) >= LVL_IMPL) strcpy(buf3, "&R*IMP*&y"); else if (GET_LEVEL(tch) >= 114) strcpy(buf3, "&RCIMPL&y"); else if (GET_LEVEL(tch) >= 113) strcpy(buf3, "&RAIMPL&y"); else if (GET_LEVEL(tch) >= 112) strcpy(buf3, "&rGRGOD&y"); else if (GET_LEVEL(tch) >= 111) strcpy(buf3, "&rDEITY&y"); else if (GET_LEVEL(tch) >= 110) strcpy(buf3, "&r GOD &y"); else if (GET_LEVEL(tch) >= 109) strcpy(buf3, "&YRULER&y"); else if (GET_LEVEL(tch) >= 108) strcpy(buf3, "&YCREAT&y"); else if (GET_LEVEL(tch) >= 107) strcpy(buf3, "ANGEL"); else if (GET_LEVEL(tch) >= 106) strcpy(buf3, " IMM "); else if (GET_LEVEL(tch) >= 105) strcpy(buf3, "&G LEG &n"); else if (GET_LEVEL(tch) >= 104) strcpy(buf3, "&G WIZ &n"); else if (GET_LEVEL(tch) >= 103) strcpy(buf3, "&G EMP &n"); else if (GET_LEVEL(tch) >= 102) strcpy(buf3, "&G LOR &n"); else if (GET_LEVEL(tch) >= 101) strcpy(buf3, "&G HER &n"); else if (GET_LEVEL(tch) >= 100) strcpy(buf3, "&G MAS &n"); else sprintf(buf3, " %3d ", GET_LEVEL(tch)); if (short_list) { sprintf(buf, "%s[%5s] %-12.12s%s%s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), buf3, GET_NAME(tch), (GET_LEVEL(tch) >= LVL_IMMORT ? CCNRM(ch, C_SPR) : ""), ((!(++num_can_see % 4)) ? "\r\n" : "")); send_to_char(buf, ch); } else { num_can_see++; sprintf(buf, "%s[%-13s] %s %s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), buf2, GET_NAME(tch), GET_TITLE(tch)); if (GET_INVIS_LEV(tch)) sprintf(buf + strlen(buf), " (i%3d)", GET_INVIS_LEV(tch)); else if (AFF_FLAGGED(tch, AFF_INVISIBLE)) strcat(buf, " &G(invis)&n"); if (PLR_FLAGGED(tch, PLR_MAILING)) strcat(buf, " &W(mailing)&n"); else if (PLR_FLAGGED(tch, PLR_WRITING)) strcat(buf, " &W(writing)&n"); if (PLR_FLAGGED(tch, PLR_FROZEN)) strcat(buf, " (&CF&cR&CO&cZ&CE&CN&n)"); if (PRF_FLAGGED(tch, PRF_DEAF)) strcat(buf, " &b(deaf)&n"); if (PRF_FLAGGED(tch, PRF_NOTELL)) strcat(buf, " &b(notell)&n"); if (PRF_FLAGGED(tch, PRF_QUEST)) strcat(buf, " &Y(quest)&n"); if (PLR_FLAGGED(tch, PLR_THIEF)) strcat(buf, " &R(THIEF)&n"); if (PLR_FLAGGED(tch, PLR_KILLER)) strcat(buf, " &R(KILLER)&n"); if (GET_LEVEL(tch) >= LVL_IMMORT) strcat(buf, CCNRM(ch, C_SPR)); strcat(buf, "\r\n"); send_to_char(buf, ch); } /* endif shortlist */ } /* end of for */ if (short_list && (num_can_see % 4)) send_to_char("\r\n", ch); if (num_can_see == 0) sprintf(buf, "\r\nNo-one at all!\r\n"); else if (num_can_see == 1) sprintf(buf, "\r\nOne lonely character displayed.\r\n"); else sprintf(buf, "\r\n%d characters displayed.\r\n", num_can_see); send_to_char(buf, ch); } // That's it, easy huh? // // Muerioch // PlaniaMUD Implementor. (PlaniaMUD is in Alpha stage, and never online..) // Muerioch@planiamud.cjb.net or impteam@planiamud.cjb.net