mux/src/wiz.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "attrs.h"
#include "command.h"
#include "file_c.h"
#include "powers.h"

Include dependency graph for wiz.cpp:

Go to the source code of this file.

Functions

static void do_teleport_single (dbref executor, dbref caller, dbref enactor, int key, dbref victim, char *to)
void do_teleport (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *arg1, char *arg2)
void do_force_prefixed (dbref executor, dbref caller, dbref enactor, int key, char *command, char *args[], int nargs)
void do_force (dbref executor, dbref caller, dbref enactor, int key, char *what, char *command, char *args[], int nargs)
void do_toad (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *toad, char *newowner)
void do_newpassword (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *name, char *password)
void do_boot (dbref executor, dbref caller, dbref enactor, int key, char *name)
void do_poor (dbref executor, dbref caller, dbref enactor, int key, char *arg1)
void do_cut (dbref executor, dbref caller, dbref enactor, int key, char *thing)
void do_motd (dbref executor, dbref caller, dbref enactor, int key, char *message)
void do_global (dbref executor, dbref caller, dbref enactor, int key, char *flag)

Variables

NAMETAB enable_names []


Function Documentation

void do_boot ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  name 
)

Definition at line 502 of file wiz.cpp.

References boot_by_port(), boot_off(), BOOT_PORT, BOOT_QUIET, Can_Boot, ENDLOG, God, init_match(), is_integer(), isPlayer, log_name(), log_name_and_loc(), log_text(), LOG_WIZARD, match_absolute(), match_neighbor(), match_player(), mux_atol(), Name, noisy_match_result(), NOPERM_MESSAGE, NOTHING, notify, notify_quiet, STARTLOG, tprintf(), TYPE_PLAYER, and UNUSED_PARAMETER.

00503 {
00504     UNUSED_PARAMETER(caller);
00505     UNUSED_PARAMETER(enactor);
00506 
00507     if (!Can_Boot(executor))
00508     {
00509         notify(executor, NOPERM_MESSAGE);
00510         return;
00511     }
00512 
00513     dbref victim;
00514     int count;
00515     if (key & BOOT_PORT)
00516     {
00517         if (is_integer(name, NULL))
00518         {
00519             victim = mux_atol(name);
00520         }
00521         else
00522         {
00523             notify_quiet(executor, "That's not a number!");
00524             return;
00525         }
00526         STARTLOG(LOG_WIZARD, "WIZ", "BOOT");
00527         log_text(tprintf("Port %d", victim));
00528         log_text(" was @booted by ");
00529         log_name(executor);
00530         ENDLOG;
00531     }
00532     else
00533     {
00534         init_match(executor, name, TYPE_PLAYER);
00535         match_neighbor();
00536         match_absolute();
00537         match_player();
00538         if ((victim = noisy_match_result()) == NOTHING)
00539         {
00540             return;
00541         }
00542 
00543         if (God(victim))
00544         {
00545             notify_quiet(executor, "You cannot boot that player!");
00546             return;
00547         }
00548         if (  (  !isPlayer(victim)
00549               && !God(executor))
00550            || executor == victim)
00551         {
00552             notify_quiet(executor, "You can only boot off other players!");
00553             return;
00554         }
00555         STARTLOG(LOG_WIZARD, "WIZ", "BOOT");
00556         log_name_and_loc(victim);
00557         log_text(" was @booted by ");
00558         log_name(executor);
00559         ENDLOG;
00560         notify_quiet(executor, tprintf("You booted %s off!", Name(victim)));
00561     }
00562 
00563     const char *buf;
00564     if (key & BOOT_QUIET)
00565     {
00566         buf = NULL;
00567     }
00568     else
00569     {
00570         buf = tprintf("%s gently shows you the door.", Name(executor));
00571     }
00572 
00573     if (key & BOOT_PORT)
00574     {
00575         count = boot_by_port(victim, God(executor), buf);
00576     }
00577     else
00578     {
00579         count = boot_off(victim, buf);
00580     }
00581     notify_quiet(executor, tprintf("%d connection%s closed.", count, (count == 1 ? "" : "s")));
00582 }

void do_cut ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  thing 
)

Definition at line 618 of file wiz.cpp.

References Good_obj, match_controlled, NOTHING, notify_quiet, s_Next, and UNUSED_PARAMETER.

00619 {
00620     UNUSED_PARAMETER(caller);
00621     UNUSED_PARAMETER(enactor);
00622     UNUSED_PARAMETER(key);
00623 
00624     dbref object = match_controlled(executor, thing);
00625     if (Good_obj(object))
00626     {
00627         s_Next(object, NOTHING);
00628         notify_quiet(executor, "Cut.");
00629     }
00630 }

void do_force ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  what,
char *  command,
char *  args[],
int  nargs 
)

Definition at line 287 of file wiz.cpp.

References statedata::global_regs, match_controlled, mudstate, NOTHING, UNUSED_PARAMETER, and wait_que().

Referenced by do_force_prefixed().

00289 {
00290     UNUSED_PARAMETER(enactor);
00291     UNUSED_PARAMETER(key);
00292 
00293     dbref victim = match_controlled(executor, what);
00294     if (victim != NOTHING)
00295     {
00296         // Force victim to do command.
00297         //
00298         CLinearTimeAbsolute lta;
00299         wait_que(victim, caller, executor, false, lta, NOTHING, 0, command,
00300             args, nargs, mudstate.global_regs);
00301     }
00302 }

void do_force_prefixed ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  command,
char *  args[],
int  nargs 
)

Definition at line 266 of file wiz.cpp.

References do_force(), mux_isspace, and parse_to().

00268 {
00269     char *cp = parse_to(&command, ' ', 0);
00270     if (!command)
00271     {
00272         return;
00273     }
00274     while (mux_isspace(*command))
00275     {
00276         command++;
00277     }
00278     if (*command)
00279     {
00280         do_force(executor, caller, enactor, key, cp, command, args, nargs);
00281     }
00282 }

void do_global ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  flag 
)

Definition at line 753 of file wiz.cpp.

References CF_DEQUEUE, confdata::control_flags, enable_names, ENDLOG, GLOB_DISABLE, GLOB_ENABLE, LOG_CONFIGMODS, log_name(), log_text(), mudconf, notify_quiet, PRIORITY_CF_DEQUEUE_DISABLED, PRIORITY_CF_DEQUEUE_ENABLED, Quiet, scheduler, search_nametab(), CScheduler::SetMinPriority(), STARTLOG, and UNUSED_PARAMETER.

00754 {
00755     UNUSED_PARAMETER(caller);
00756     UNUSED_PARAMETER(enactor);
00757 
00758     // Set or clear the indicated flag.
00759     //
00760     int flagvalue;
00761     if (!search_nametab(executor, enable_names, flag, &flagvalue))
00762     {
00763         notify_quiet(executor, "I don't know about that flag.");
00764     }
00765     else if (key == GLOB_ENABLE)
00766     {
00767         // Check for CF_DEQUEUE
00768         //
00769         if (flagvalue == CF_DEQUEUE)
00770         {
00771             scheduler.SetMinPriority(PRIORITY_CF_DEQUEUE_ENABLED);
00772         }
00773         mudconf.control_flags |= flagvalue;
00774         STARTLOG(LOG_CONFIGMODS, "CFG", "GLOBAL");
00775         log_name(executor);
00776         log_text(" enabled: ");
00777         log_text(flag);
00778         ENDLOG;
00779         if (!Quiet(executor))
00780         {
00781             notify_quiet(executor, "Enabled.");
00782         }
00783     }
00784     else if (key == GLOB_DISABLE)
00785     {
00786         if (flagvalue == CF_DEQUEUE)
00787         {
00788             scheduler.SetMinPriority(PRIORITY_CF_DEQUEUE_DISABLED);
00789         }
00790         mudconf.control_flags &= ~flagvalue;
00791         STARTLOG(LOG_CONFIGMODS, "CFG", "GLOBAL");
00792         log_name(executor);
00793         log_text(" disabled: ");
00794         log_text(flag);
00795         ENDLOG;
00796         if (!Quiet(executor))
00797         {
00798             notify_quiet(executor, "Disabled.");
00799         }
00800     }
00801     else
00802     {
00803         notify_quiet(executor, "Illegal combination of switches.");
00804     }
00805 }

void do_motd ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  message 
)

Definition at line 635 of file wiz.cpp.

References confdata::downmotd_msg, FC_CONN_GUEST, FC_MOTD, FC_WIZMOTD, fcache_send(), confdata::fullmotd_msg, GBUF_SIZE, Guest, MOTD_ALL, MOTD_BRIEF, MOTD_DOWN, MOTD_FULL, MOTD_LIST, confdata::motd_msg, MOTD_WIZ, mudconf, notify_quiet, Quiet, tprintf(), UNUSED_PARAMETER, Wizard, and confdata::wizmotd_msg.

00636 {
00637     UNUSED_PARAMETER(caller);
00638     UNUSED_PARAMETER(enactor);
00639 
00640     bool is_brief = false;
00641 
00642     if (key & MOTD_BRIEF)
00643     {
00644         is_brief = true;
00645         key = key & ~MOTD_BRIEF;
00646         if (key == MOTD_ALL)
00647             key = MOTD_LIST;
00648         else if (key != MOTD_LIST)
00649             key |= MOTD_BRIEF;
00650     }
00651     switch (key)
00652     {
00653     case MOTD_ALL:
00654 
00655         strncpy(mudconf.motd_msg, message, GBUF_SIZE-1);
00656         mudconf.motd_msg[GBUF_SIZE-1] = '\0';
00657         if (!Quiet(executor))
00658         {
00659             notify_quiet(executor, "Set: MOTD.");
00660         }
00661         break;
00662 
00663     case MOTD_WIZ:
00664 
00665         strncpy(mudconf.wizmotd_msg, message, GBUF_SIZE-1);
00666         mudconf.wizmotd_msg[GBUF_SIZE-1] = '\0';
00667         if (!Quiet(executor))
00668         {
00669             notify_quiet(executor, "Set: Wizard MOTD.");
00670         }
00671         break;
00672 
00673     case MOTD_DOWN:
00674 
00675         strncpy(mudconf.downmotd_msg, message, GBUF_SIZE-1);
00676         mudconf.downmotd_msg[GBUF_SIZE-1] = '\0';
00677         if (!Quiet(executor))
00678         {
00679             notify_quiet(executor, "Set: Down MOTD.");
00680         }
00681         break;
00682 
00683     case MOTD_FULL:
00684 
00685         strncpy(mudconf.fullmotd_msg, message, GBUF_SIZE-1);
00686         mudconf.fullmotd_msg[GBUF_SIZE-1] = '\0';
00687         if (!Quiet(executor))
00688         {
00689             notify_quiet(executor, "Set: Full MOTD.");
00690         }
00691         break;
00692 
00693     case MOTD_LIST:
00694 
00695         if (Wizard(executor))
00696         {
00697             if (!is_brief)
00698             {
00699                 notify_quiet(executor, "----- motd file -----");
00700                 fcache_send(executor, FC_MOTD);
00701                 notify_quiet(executor, "----- wizmotd file -----");
00702                 fcache_send(executor, FC_WIZMOTD);
00703                 notify_quiet(executor, "----- motd messages -----");
00704             }
00705             notify_quiet(executor, tprintf("MOTD: %s", mudconf.motd_msg));
00706             notify_quiet( executor,
00707                           tprintf("Wizard MOTD: %s", mudconf.wizmotd_msg) );
00708             notify_quiet( executor,
00709                           tprintf("Down MOTD: %s", mudconf.downmotd_msg) );
00710             notify_quiet( executor,
00711                           tprintf("Full MOTD: %s", mudconf.fullmotd_msg) );
00712         }
00713         else
00714         {
00715             if (Guest(executor))
00716             {
00717                 fcache_send(executor, FC_CONN_GUEST);
00718             }
00719             else
00720             {
00721                 fcache_send(executor, FC_MOTD);
00722             }
00723             notify_quiet(executor, mudconf.motd_msg);
00724         }
00725         break;
00726 
00727     default:
00728 
00729         notify_quiet(executor, "Illegal combination of switches.");
00730     }
00731 }

void do_newpassword ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  name,
char *  password 
)

Definition at line 429 of file wiz.cpp.

References A_PASS, alloc_lbuf, atr_get, ChangePassword(), ENDLOG, free_lbuf, God, log_name(), log_text(), LOG_WIZARD, lookup_player(), Name, NOTHING, notify_quiet, ok_password(), safe_tprintf_str(), STARTLOG, and UNUSED_PARAMETER.

00438 {
00439     UNUSED_PARAMETER(caller);
00440     UNUSED_PARAMETER(enactor);
00441     UNUSED_PARAMETER(key);
00442     UNUSED_PARAMETER(nargs);
00443 
00444     dbref victim = lookup_player(executor, name, false);
00445     if (victim == NOTHING)
00446     {
00447         notify_quiet(executor, "No such player.");
00448         return;
00449     }
00450     const char *pmsg;
00451     if (  *password != '\0'
00452        && !ok_password(password, &pmsg))
00453     {
00454         // Can set null passwords, but not bad passwords.
00455         //
00456         notify_quiet(executor, pmsg);
00457         return;
00458     }
00459     if (God(victim))
00460     {
00461         bool bCan = true;
00462         if (God(executor))
00463         {
00464             // God can change her own password if it's missing.
00465             //
00466             int   aflags;
00467             dbref aowner;
00468             char *target = atr_get(executor, A_PASS, &aowner, &aflags);
00469             if (target[0] != '\0')
00470             {
00471                 bCan = false;
00472             }
00473             free_lbuf(target);
00474         }
00475         else
00476         {
00477             bCan = false;
00478         }
00479         if (!bCan)
00480         {
00481             notify_quiet(executor, "You cannot change that player's password.");
00482             return;
00483         }
00484     }
00485     STARTLOG(LOG_WIZARD, "WIZ", "PASS");
00486     log_name(executor);
00487     log_text(" changed the password of ");
00488     log_name(victim);
00489     ENDLOG;
00490 
00491     // It's ok, do it.
00492     //
00493     ChangePassword(victim, password);
00494     notify_quiet(executor, "Password changed.");
00495     char *buf = alloc_lbuf("do_newpassword");
00496     char *bp = buf;
00497     safe_tprintf_str(buf, &bp, "Your password has been changed by %s.", Name(executor));
00498     notify_quiet(victim, buf);
00499     free_lbuf(buf);
00500 }

void do_poor ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  arg1 
)

Definition at line 587 of file wiz.cpp.

References DO_WHOLE_DB, is_rational(), isPlayer, mux_atol(), Pennies(), s_Pennies(), and UNUSED_PARAMETER.

00588 {
00589     UNUSED_PARAMETER(executor);
00590     UNUSED_PARAMETER(caller);
00591     UNUSED_PARAMETER(enactor);
00592     UNUSED_PARAMETER(key);
00593 
00594     if (!is_rational(arg1))
00595     {
00596         return;
00597     }
00598 
00599     int amt = mux_atol(arg1);
00600     int curamt;
00601     dbref a;
00602     DO_WHOLE_DB(a)
00603     {
00604         if (isPlayer(a))
00605         {
00606             curamt = Pennies(a);
00607             if (amt < curamt)
00608             {
00609                 s_Pennies(a, amt);
00610             }
00611         }
00612     }
00613 }

void do_teleport ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  arg1,
char *  arg2 
)

Definition at line 197 of file wiz.cpp.

References do_teleport_single(), Fixed, confdata::fixed_tel_msg, Good_obj, init_match(), match_everything(), mudconf, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), noisy_match_result(), notify, NOTYPE, Owner, Tel_Anywhere, and TELEPORT_LIST.

Referenced by FUNCTION().

00206 {
00207     if (  (  Fixed(executor)
00208           || Fixed(Owner(executor)))
00209        && !Tel_Anywhere(executor))
00210     {
00211         notify(executor, mudconf.fixed_tel_msg);
00212         return;
00213     }
00214 
00215     // Get victim.
00216     //
00217     if (nargs == 1)
00218     {
00219         // Teleport executor to given destination.
00220         //
00221         do_teleport_single(executor, caller, enactor, key, executor, arg1);
00222     }
00223     else if (nargs == 2)
00224     {
00225         // Teleport 3rd part(y/ies) to given destination.
00226         //
00227         if (key & TELEPORT_LIST)
00228         {
00229             // We have a space-delimited list of victims.
00230             //
00231             char *p;
00232             MUX_STRTOK_STATE tts;
00233             mux_strtok_src(&tts, arg1);
00234             mux_strtok_ctl(&tts, " ");
00235             for (p = mux_strtok_parse(&tts); p; p = mux_strtok_parse(&tts))
00236             {
00237                 init_match(executor, p, NOTYPE);
00238                 match_everything(0);
00239                 dbref victim = noisy_match_result();
00240 
00241                 if (Good_obj(victim))
00242                 {
00243                     do_teleport_single(executor, caller, enactor, key, victim,
00244                         arg2);
00245                 }
00246             }
00247         }
00248         else
00249         {
00250             init_match(executor, arg1, NOTYPE);
00251             match_everything(0);
00252             dbref victim = noisy_match_result();
00253 
00254             if (Good_obj(victim))
00255             {
00256                 do_teleport_single(executor, caller, enactor, key, victim,
00257                     arg2);
00258             }
00259         }
00260     }
00261 }

static void do_teleport_single ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
dbref  victim,
char *  to 
) [static]

Definition at line 17 of file wiz.cpp.

References A_ATFAIL, A_LTPORT, A_OTFAIL, A_TFAIL, AMBIGUOUS, Controls, could_doit(), did_it(), Exits, confdata::fascist_tport, God, Good_obj, Has_contents, Has_location, Home, HOME, HUSH_ENTER, HUSH_LEAVE, init_match(), isExit, isGarbage, isRoom, Jump_ok, Location, match_everything(), match_result(), move_exit(), move_via_teleport(), mudconf, NOPERM_MESSAGE, NOTHING, notify_quiet, NOTYPE, Quiet, string_compare(), Tel_Anything, Tel_Anywhere, TELEPORT_QUIET, UNUSED_PARAMETER, and where_room().

Referenced by do_teleport().

00025 {
00026     UNUSED_PARAMETER(caller);
00027     UNUSED_PARAMETER(enactor);
00028 
00029     dbref loc;
00030     int   hush = 0;
00031 
00032     // Validate type of victim.
00033     //
00034     if (  !Good_obj(victim)
00035        || isRoom(victim))
00036     {
00037         notify_quiet(executor, "You can't teleport that.");
00038         return;
00039     }
00040 
00041     // Fail if we don't control the victim or the victim's location.
00042     //
00043     if (  !Controls(executor, victim)
00044        && !Controls(executor, isExit(victim) ? Exits(victim) : Location(victim))
00045        && !Tel_Anything(executor))
00046     {
00047         notify_quiet(executor, NOPERM_MESSAGE);
00048         return;
00049     }
00050 
00051     // Check for teleporting home
00052     //
00053     if (!string_compare(to, "home"))
00054     {
00055         if (isExit(victim))
00056         {
00057             notify_quiet(executor, "Bad destination.");
00058         }
00059         else
00060         {
00061             move_via_teleport(victim, HOME, enactor, 0);
00062         }
00063         return;
00064     }
00065 
00066     // Find out where to send the victim.
00067     //
00068     init_match(executor, to, NOTYPE);
00069     match_everything(0);
00070     dbref destination = match_result();
00071 
00072     switch (destination)
00073     {
00074     case NOTHING:
00075 
00076         notify_quiet(executor, "No match.");
00077         return;
00078 
00079     case AMBIGUOUS:
00080 
00081         notify_quiet(executor, "I don't know which destination you mean!");
00082         return;
00083 
00084     default:
00085 
00086         if (victim == destination)
00087         {
00088             notify_quiet(executor, "Bad destination.");
00089             return;
00090         }
00091     }
00092 
00093     // If fascist teleport is on, you must control the victim's ultimate
00094     // location (after LEAVEing any objects) or it must be JUMP_OK.
00095     //
00096     if (mudconf.fascist_tport)
00097     {
00098         if (isExit(victim))
00099         {
00100             loc = where_room(Home(victim));
00101         }
00102         else
00103         {
00104             loc = where_room(victim);
00105         }
00106 
00107         if (  !Good_obj(loc)
00108            || !isRoom(loc)
00109            || !( Controls(executor, loc)
00110               || Jump_ok(loc)
00111               || Tel_Anywhere(executor)))
00112         {
00113             notify_quiet(executor, NOPERM_MESSAGE);
00114             return;
00115         }
00116     }
00117     if (  isGarbage(destination)
00118        || (  Has_location(destination)
00119           && isGarbage(Location(destination))))
00120     {
00121         // @Teleporting into garbage is never permitted.
00122         //
00123         notify_quiet(executor, "Bad destination.");
00124         return;
00125     }
00126     else if (Has_contents(destination))
00127     {
00128         // You must control the destination, or it must be a JUMP_OK
00129         // room where you pass its TELEPORT lock.
00130         //
00131         if (  !(  Controls(executor, destination)
00132                || Jump_ok(destination)
00133                || Tel_Anywhere(executor))
00134            || !could_doit(executor, destination, A_LTPORT)
00135            || (  isExit(victim)
00136               && God(destination)
00137               && !God(executor)))
00138         {
00139             // Nope, report failure.
00140             //
00141             if (executor != victim)
00142             {
00143                 notify_quiet(executor, NOPERM_MESSAGE);
00144             }
00145             did_it(victim, destination,
00146                    A_TFAIL, "You can't teleport there!",
00147                    A_OTFAIL, 0, A_ATFAIL, (char **)NULL, 0);
00148             return;
00149         }
00150 
00151         // We're OK, do the teleport.
00152         //
00153         if (key & TELEPORT_QUIET)
00154         {
00155             hush = HUSH_ENTER | HUSH_LEAVE;
00156         }
00157 
00158         if (move_via_teleport(victim, destination, enactor, hush))
00159         {
00160             if (executor != victim)
00161             {
00162                 if (!Quiet(executor))
00163                 {
00164                     notify_quiet(executor, "Teleported.");
00165                 }
00166             }
00167         }
00168     }
00169     else if (isExit(destination))
00170     {
00171         if (isExit(victim))
00172         {
00173             if (executor != victim)
00174             {
00175                 notify_quiet(executor, "Bad destination.");
00176             }
00177             did_it(victim, destination,
00178                    A_TFAIL, "You can't teleport there!",
00179                    A_OTFAIL, 0, A_ATFAIL, (char **)NULL, 0);
00180             return;
00181         }
00182         else
00183         {
00184             if (Exits(destination) == Location(victim))
00185             {
00186                 move_exit(victim, destination, false, "You can't go that way.", 0);
00187             }
00188             else
00189             {
00190                 notify_quiet(executor, "I can't find that exit.");
00191             }
00192         }
00193     }
00194 }

void do_toad ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  toad,
char *  newowner 
)

Definition at line 308 of file wiz.cpp.

References A_ALIAS, alloc_mbuf, atr_pget, boot_off(), chown_all(), CHOWN_NOZONE, delete_player_name(), ENDLOG, FLAG_WORD1, FLAG_WORD2, FLAG_WORD3, free_lbuf, free_mbuf, Good_obj, HALT, init_match(), isPlayer, Location, log_name(), log_name_and_loc(), log_text(), LOG_WIZARD, match_absolute(), match_neighbor(), match_player(), mudconf, Name, No_Destroy, noisy_match_result(), NOTHING, notify_except2(), notify_quiet, ReleaseAllResources(), s_Flags, s_Name(), s_Owner, s_Pennies(), s_Zone, STARTLOG, TOAD_NO_CHOWN, confdata::toad_recipient, tprintf(), TYPE_PLAYER, TYPE_THING, and UNUSED_PARAMETER.

00317 {
00318     UNUSED_PARAMETER(caller);
00319     UNUSED_PARAMETER(enactor);
00320 
00321     dbref victim, recipient, loc, aowner;
00322     char *buf;
00323     int count, aflags;
00324 
00325     init_match(executor, toad, TYPE_PLAYER);
00326     match_neighbor();
00327     match_absolute();
00328     match_player();
00329     if (!Good_obj(victim = noisy_match_result()))
00330     {
00331         return;
00332     }
00333 
00334     if (!isPlayer(victim))
00335     {
00336         notify_quiet(executor, "Try @destroy instead.");
00337         return;
00338     }
00339     if (No_Destroy(victim))
00340     {
00341         notify_quiet(executor, "You can't toad that player.");
00342         return;
00343     }
00344     if (  nargs == 2
00345        && *newowner )
00346     {
00347         init_match(executor, newowner, TYPE_PLAYER);
00348         match_neighbor();
00349         match_absolute();
00350         match_player();
00351         if ((recipient = noisy_match_result()) == NOTHING)
00352         {
00353             return;
00354         }
00355     }
00356     else
00357     {
00358         if (mudconf.toad_recipient == NOTHING)
00359         {
00360             recipient = executor;
00361         }
00362         else
00363         {
00364             recipient = mudconf.toad_recipient;
00365         }
00366     }
00367 
00368     STARTLOG(LOG_WIZARD, "WIZ", "TOAD");
00369     log_name_and_loc(victim);
00370     log_text(" was @toaded by ");
00371     log_name(executor);
00372     ENDLOG;
00373 
00374     // Clear everything out.
00375     //
00376     if (key & TOAD_NO_CHOWN)
00377     {
00378         count = -1;
00379     }
00380     else
00381     {
00382         // You get it.
00383         //
00384         count = chown_all(victim, recipient, executor, CHOWN_NOZONE);
00385         s_Owner(victim, recipient);
00386         s_Zone(victim, NOTHING);
00387     }
00388     s_Flags(victim, FLAG_WORD1, TYPE_THING | HALT);
00389     s_Flags(victim, FLAG_WORD2, 0);
00390     s_Flags(victim, FLAG_WORD3, 0);
00391     s_Pennies(victim, 1);
00392 
00393     // Notify people.
00394     //
00395     loc = Location(victim);
00396     buf = alloc_mbuf("do_toad");
00397     const char *pVictimName = Name(victim);
00398     sprintf(buf, "%s has been turned into a slimy toad!", pVictimName);
00399     notify_except2(loc, executor, victim, executor, buf);
00400     sprintf(buf, "You toaded %s! (%d objects @chowned)", pVictimName, count + 1);
00401     notify_quiet(executor, buf);
00402 
00403     // Zap the name from the name hash table.
00404     //
00405     sprintf(buf, "a slimy toad named %s", pVictimName);
00406     delete_player_name(victim, pVictimName);
00407     s_Name(victim, buf);
00408     free_mbuf(buf);
00409 
00410     // Zap the alias, too.
00411     //
00412     buf = atr_pget(victim, A_ALIAS, &aowner, &aflags);
00413     delete_player_name(victim, buf);
00414     free_lbuf(buf);
00415 
00416     // Boot off.
00417     //
00418     count = boot_off(victim, "You have been turned into a slimy toad!");
00419 
00420     // Release comsys and @mail resources.
00421     //
00422     ReleaseAllResources(victim);
00423 
00424     buf = tprintf("%d connection%s closed.", count, (count == 1 ? "" : "s"));
00425     notify_quiet(executor, buf);
00426 }


Variable Documentation

NAMETAB enable_names[]

Initial value:

{
    {"building",        1,  CA_PUBLIC,  CF_BUILD},
    {"checkpointing",   2,  CA_PUBLIC,  CF_CHECKPOINT},
    {"cleaning",        2,  CA_PUBLIC,  CF_DBCHECK},
    {"dequeueing",      1,  CA_PUBLIC,  CF_DEQUEUE},


 
    {"idlechecking",    2,  CA_PUBLIC,  CF_IDLECHECK},
    {"interpret",       2,  CA_PUBLIC,  CF_INTERP},
    {"logins",          3,  CA_PUBLIC,  CF_LOGIN},
    {"guests",          2,  CA_PUBLIC,  CF_GUEST},
    {"eventchecking",   2,  CA_PUBLIC,  CF_EVENTCHECK},
    { NULL,             0,  0,          0}
}

Definition at line 736 of file wiz.cpp.

Referenced by do_global(), and do_list().


Generated on Mon May 28 04:40:23 2007 for MUX by  doxygen 1.4.7