void do_gripe(dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN]; if(Guest(player)) { anotify(player, CFAIL NOGUEST_MESG); return; } if (!message || !*message) { if (Mage(player)) { spit_file(player, LOG_GRIPE); } else { anotify(player, CINFO "What's wrong?"); } return; } loc = DBFETCH(player)->location; log_gripe("%s(%d) in %s(%d): %.3900s\n", NAME(player), player, NAME(loc), loc, message); anotify(player, CINFO "Your complaint has been filed."); sprintf(buf, MARK "Gripe from %s: %.3900s", NAME(player), message); wall_wizards(buf); }
void do_wall(dbref player, const char *message) { char buf[BUFFER_LEN]; if (Mage(player) && Typeof(player) == TYPE_PLAYER) { switch(message[0]) { case ':': case ';': sprintf(buf, MARK "%s %.3900s", NAME(player), message+1); break; case '@': sprintf(buf, MARK "%.3900s", message+1); break; case '\0': case '#': notify(player, "@wall help"); notify(player, "~~~~~"); notify(player, "@wall message -- Show all players 'message'"); notify(player, "@wall :message -- Pose message to all players"); notify(player, "@wall @message -- Spoof message to all players"); notify(player, "@wall # -- Show this help list"); return; default: sprintf(buf, MARK "%s shouts, \"%.3900s\"", NAME(player), message); } wall_all( buf ); /* log_status("WALL: %s: %.3900s\n", unparse_object(MAN, player), buf); */ } else { anotify(player, CFAIL NOPERM_MESG); } }
/* doesn't really belong here, but I couldn't figure out where else */ void do_page(dbref player, const char *arg1, const char *arg2) { int ignored; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; dbref target; if (!payfor(player, tp_lookup_cost)) { anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies); return; } if ( strcmp(arg1, "me") ) { if ((target = lookup_player(arg1)) == NOTHING) { anotify(player, CINFO WHO_MESG); return; } } else target = player; if(Guest(player)) { if(!Mage(target)) { anotify(player, CINFO "Guests can only page " NAMEWIZ "s, type 'wizzes'."); return; } } if (FLAGS(target) & HAVEN) { anotify(player, CFAIL "That player is haven."); return; } ignored = ignoring(target, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(page)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (!*buf2) { sprintf(buf, CGREEN "You sense that %s is looking for you in %s.", PNAME(player), NAME(DBFETCH(player)->location)); } else { if(buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%s %.3900s" CGREEN "\"", PNAME(player), PNAME(player), buf2); } else { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%.3900s" CGREEN "\"", PNAME(player), buf2); } } if (anotify_from(player, target, buf)) anotify(player, CSUCC "Your message has been sent."); else { sprintf(buf, CINFO "%s is not connected.", PNAME(target)); anotify(player, buf); } }
void do_password(dbref player, const char *old, const char *newobj) { if(Guest(player)) { anotify(player, CFAIL NOGUEST_MESG); return; } if ((!DBFETCH(player)->sp.player.password) || (!*DBFETCH(player)->sp.player.password) || strcmp(old, DBFETCH(player)->sp.player.password) ) { anotify(player, CFAIL "Sorry."); } else if (!ok_password(newobj)) { anotify(player, CFAIL "Bad new password."); } else { free((void *) DBFETCH(player)->sp.player.password); DBSTORE(player, sp.player.password, alloc_string(newobj)); ts_modifyobject(player); remove_property(player, PROP_PW); anotify(player, CSUCC "Password changed."); } }
void do_say(int descr, dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; tct(message, buf2); /* notify everybody */ sprintf(buf, "^SAY/POSE^You say, ^SAY/QUOTES^\"^SAY/TEXT^%s^SAY/QUOTES^\"", buf2); anotify(player, buf); sprintf(buf, "^SAY/POSE^%s says, ^SAY/QUOTES^\"^SAY/TEXT^%s^SAY/QUOTES^\"", PNAME(player), buf2); anotify_except(DBFETCH(loc)->contents, player, buf, player); }
void do_say(dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; do_parse_mesg(player, player, message, "(say)", buf, MPI_ISPRIVATE); tct(buf,buf2); /* Notify player */ sprintf(buf, CAQUA "You say, \"" CYELLOW "%.3900s" CAQUA "\"", buf2); anotify(player, buf); /* notify everybody else */ sprintf(buf, CAQUA "%s says, \"" CYELLOW "%.3900s" CAQUA "\"", PNAME(player), buf2); anotify_except(DBFETCH(loc)->contents, player, buf, player); }
void show_re_cache(dbref player) { muf_re* re; size_t tmp; int idx = 0; int patterns = 0; int studies = 0; size_t size_re = 0; size_t size_extra = 0; if (!Boy(OWNER(player))) { anotify_fmt(player, CFAIL "%s", tp_noperm_mesg); return; } anotify(player, SYSYELLOW "idx hits flags studied? pattern"); while (idx <= MUF_RE_CACHE_ITEMS) { re = &muf_re_cache[idx]; if (re->re) { patterns++; notify_fmt(player, "%3i %4i %5i %i \"%s\"", idx, re->hits, re->flags, (re->extra != NULL), DoNullInd(re->pattern)); pcre_fullinfo(re->re, NULL, PCRE_INFO_SIZE, &tmp); size_re = size_re + tmp; if (re->extra) { studies++; pcre_fullinfo(re->re, re->extra, PCRE_INFO_STUDYSIZE, &tmp); size_extra = size_extra + tmp; } } idx++; } anotify_fmt(player, SYSPURPLE "\n%i compiled patterns are using %zd bytes of RAM.", patterns, size_re); anotify_fmt(player, SYSGREEN "%i study instances are using are using %zd bytes of RAM.", studies, size_extra); }
void do_whisper(int descr, dbref player, const char *arg1, const char *arg2) { dbref who; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; struct match_data md; if (Guest(player)) { anotify_fmt(player, CFAIL "%s", tp_noguest_mesg); return; } init_match(descr, player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Mage(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: anotify_nolisten2(player, CINFO "Who?"); break; case AMBIGUOUS: anotify_nolisten2(player, CINFO "I don't know who you mean!"); break; default: if (Meeper(OWNER(player))) { do_parse_mesg(descr, player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE); tct(buf, buf2); } else { tct(arg2, buf2); } if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s %s" SYSBLUE "\"", PNAME(player), PNAME(player), buf2 + 1); if (!anotify_from(player, who, buf)) { sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who)); anotify_nolisten2(player, buf); break; } sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s %s" SYSBLUE "\" to %s.", PNAME(player), buf2 + 1, PNAME(who)); anotify(player, buf); break; } else { sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s" SYSBLUE "\"", PNAME(player), buf2); if (!anotify_from(player, who, buf)) { sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who)); anotify_nolisten2(player, buf); break; } sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s" SYSBLUE "\" to %s.", buf2, PNAME(who)); anotify(player, buf); break; } } }
void tune_display_parms(dbref player, char *name) { int total = 0; const char *lastname = NULL; char buf[BUFFER_LEN + 50], tbuf[BUFFER_LEN]; struct tune_str_entry *tstr = tune_str_list; struct tune_time_entry *ttim = tune_time_list; struct tune_val_entry *tval = tune_val_list; struct tune_ref_entry *tref = tune_ref_list; struct tune_bool_entry *tbool = tune_bool_list; while (tstr->name) { strcpy(buf, tstr->name); if ((MLevel(OWNER(player)) >= tstr->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSCYAN "(str) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSCYAN "%.4096s", (WLevel(OWNER(player)) >= tstr->writemlev) ? ' ' : '-', tstr->name, tct(*tstr->str, tbuf)); lastname = tstr->name; anotify_nolisten2(player, buf); total++; } tstr++; } while (ttim->name) { strcpy(buf, ttim->name); if ((MLevel(OWNER(player)) >= ttim->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSPURPLE "(time) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSPURPLE "%s", (WLevel(OWNER(player)) >= ttim->writemlev) ? ' ' : '-', ttim->name, timestr_full(*ttim->tim)); lastname = ttim->name; anotify_nolisten2(player, buf); total++; } ttim++; } while (tval->name) { strcpy(buf, tval->name); if ((MLevel(OWNER(player)) >= tval->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSGREEN "(int) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSYELLOW "%d", (WLevel(OWNER(player)) >= tval->writemlev) ? ' ' : '-', tval->name, *tval->val); lastname = tval->name; anotify_nolisten2(player, buf); total++; } tval++; } while (tref->name) { strcpy(buf, tref->name); if ((MLevel(OWNER(player)) >= tref->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSYELLOW "(ref) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = %s", (WLevel(OWNER(player)) >= tref->writemlev) ? ' ' : '-', tref->name, ansi_unparse_object(player, *tref->ref)); lastname = tref->name; anotify_nolisten2(player, buf); total++; } tref++; } while (tbool->name) { strcpy(buf, tbool->name); if ((MLevel(OWNER(player)) >= tbool->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSWHITE "(bool) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSBLUE "%s", (WLevel(OWNER(player)) >= tbool->writemlev) ? ' ' : '-', tbool->name, ((*tbool->boolv) ? "yes" : "no")); lastname = tbool->name; anotify_nolisten2(player, buf); total++; } tbool++; } if ((total == 1) && lastname && *lastname) { do_sysparm(player, lastname); } else { anotify_fmt(player, CINFO "%d sysparm%s listed.", total, (total == 1) ? "" : "s"); anotify(player, SYSYELLOW "@tune str, time, int, ref, or bool to list by data types."); } }
void do_whisper(dbref player, const char *arg1, const char *arg2) { int ignored; dbref who; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; struct match_data md; if(Guest(player)) { anotify(player, CFAIL NOGUEST_MESG); return; } init_match(player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Mage(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: case AMBIGUOUS: anotify(player, CINFO WHO_MESG); break; default: ignored = ignoring(who, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%s %.3900s" CBLUE "\"", PNAME(player), PNAME(player), buf2+1); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%s %.3900s" CBLUE "\" to %s.", PNAME(player), buf2+1, PNAME(who)); anotify(player, buf); break; } else { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%.3900s" CBLUE "\"", PNAME(player), buf2); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%.3900s" CBLUE "\" to %s.", buf2, PNAME(who)); anotify(player, buf); break; } } }