#include "copyright.h"
#include "config.h"
#include "mudconf.h"
#include "file_c.h"
#include "db.h"
#include "interface.h"
#include "match.h"
#include "externs.h"
#include "command.h"
#include "htab.h"
#include "alloc.h"
#include "attrs.h"
#include "powers.h"
Include dependency graph for wiz.c:
Go to the source code of this file.
Functions | |
int | recursive_check_contents (dbref victim, dbref destination) |
char * | crypt (const char *, const char *) |
void | do_teleport (dbref player, dbref cause, int key, char *arg1, char *arg2) |
void | do_force_prefixed (dbref player, dbref cause, int key, char *command, char *args[], int nargs) |
void | do_force (dbref player, dbref cause, int key, char *what, char *command, char *args[], int nargs) |
void | do_toad (dbref player, dbref cause, int key, char *toad, char *newowner) |
void | do_newpassword (dbref player, dbref cause, int key, char *name, char *password) |
void | do_boot (dbref player, dbref cause, int key, char *name) |
void | do_poor (dbref player, dbref cause, int key, char *arg1) |
void | do_cut (dbref player, dbref cause, int key, char *thing) |
static int | count_quota (dbref player) |
static void | mung_quotas (dbref player, int key, int value) |
static void | show_quota (dbref player, dbref victim) |
void | do_quota (dbref player, dbref cause, int key, char *arg1, char *arg2) |
void | do_motd (dbref player, dbref cause, int key, char *message) |
void | do_global (dbref player, dbref cause, int key, char *flag) |
Variables | |
NAMETAB | enable_names [] |
static int count_quota | ( | dbref | player | ) | [static] |
count_quota, mung_quota, show_quota, do_quota: Manage quotas.
Definition at line 584 of file wiz.c.
References DO_WHOLE_DB, confdata::exit_quota, Going, isRoom, mudconf, Owner, confdata::player_quota, confdata::room_quota, confdata::thing_quota, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
Referenced by mung_quotas().
00585 { 00586 int i, q; 00587 00588 q = 0 - mudconf.player_quota; 00589 DO_WHOLE_DB(i) { 00590 if(Owner(i) != player) 00591 continue; 00592 if(Going(i) && (!isRoom(i))) 00593 continue; 00594 switch (Typeof(i)) { 00595 case TYPE_EXIT: 00596 q += mudconf.exit_quota; 00597 break; 00598 case TYPE_ROOM: 00599 q += mudconf.room_quota; 00600 break; 00601 case TYPE_THING: 00602 q += mudconf.thing_quota; 00603 break; 00604 case TYPE_PLAYER: 00605 q += mudconf.player_quota; 00606 break; 00607 } 00608 } 00609 return q; 00610 }
char* crypt | ( | const char * | , | |
const char * | ||||
) |
Definition at line 472 of file wiz.c.
References alloc_lbuf, alloc_sbuf, boot_by_port(), boot_off(), BOOT_PORT, BOOT_QUIET, Can_Boot, ENDLOG, free_lbuf, free_sbuf, God, init_match(), is_number(), isPlayer, log_name(), log_name_and_loc(), log_text(), LOG_WIZARD, match_absolute(), match_neighbor(), match_player(), Name(), noisy_match_result(), NOTHING, notify, notify_quiet, safe_str, STARTLOG, tprintf(), and TYPE_PLAYER.
00473 { 00474 dbref victim; 00475 char *buf, *bp; 00476 int count; 00477 00478 if(!(Can_Boot(player))) { 00479 notify(player, "Permission denied."); 00480 return; 00481 } 00482 if(key & BOOT_PORT) { 00483 if(is_number(name)) { 00484 victim = atoi(name); 00485 } else { 00486 notify_quiet(player, "That's not a number!"); 00487 return; 00488 } 00489 STARTLOG(LOG_WIZARD, "WIZ", "BOOT") { 00490 buf = alloc_sbuf("do_boot.port"); 00491 sprintf(buf, "Port %d", victim); 00492 log_text(buf); 00493 log_text((char *) " was @booted by "); 00494 log_name(player); 00495 free_sbuf(buf); 00496 ENDLOG; 00497 }} else { 00498 init_match(player, name, TYPE_PLAYER); 00499 match_neighbor(); 00500 match_absolute(); 00501 match_player(); 00502 if((victim = noisy_match_result()) == NOTHING) 00503 return; 00504 00505 if(God(victim)) { 00506 notify_quiet(player, "You cannot boot that player!"); 00507 return; 00508 } 00509 if((!isPlayer(victim) && !God(player)) || (player == victim)) { 00510 notify_quiet(player, "You can only boot off other players!"); 00511 return; 00512 } 00513 STARTLOG(LOG_WIZARD, "WIZ", "BOOT") { 00514 log_name_and_loc(victim); 00515 log_text((char *) " was @booted by "); 00516 log_name(player); 00517 ENDLOG; 00518 } 00519 notify_quiet(player, tprintf("You booted %s off!", Name(victim))); 00520 } 00521 if(key & BOOT_QUIET) { 00522 buf = NULL; 00523 } else { 00524 bp = buf = alloc_lbuf("do_boot.msg"); 00525 safe_str(Name(player), buf, &bp); 00526 safe_str((char *) " gently shows you the door.", buf, &bp); 00527 *bp = '\0'; 00528 } 00529 00530 if(key & BOOT_PORT) 00531 count = boot_by_port(victim, !God(player), buf); 00532 else 00533 count = boot_off(victim, buf); 00534 notify_quiet(player, tprintf("%d connection%s closed.", count, 00535 (count == 1 ? "" : "s"))); 00536 if(buf) 00537 free_lbuf(buf); 00538 }
Chop off a contents or exits chain after the named item.
Definition at line 563 of file wiz.c.
References AMBIGUOUS, match_controlled(), NOTHING, notify_quiet, and s_Next.
00564 { 00565 dbref object; 00566 00567 object = match_controlled(player, thing); 00568 switch (object) { 00569 case NOTHING: 00570 notify_quiet(player, "No match."); 00571 break; 00572 case AMBIGUOUS: 00573 notify_quiet(player, "I don't know which one"); 00574 break; 00575 default: 00576 s_Next(object, NOTHING); 00577 notify_quiet(player, "Cut."); 00578 } 00579 }
void do_force | ( | dbref | player, | |
dbref | cause, | |||
int | key, | |||
char * | what, | |||
char * | command, | |||
char * | args[], | |||
int | nargs | |||
) |
Force an object to do something.
Definition at line 199 of file wiz.c.
References statedata::global_regs, match_controlled(), mudstate, NOTHING, and wait_que().
Referenced by do_force_prefixed().
00201 { 00202 dbref victim; 00203 00204 if((victim = match_controlled(player, what)) == NOTHING) 00205 return; 00206 00207 /* 00208 * force victim to do command 00209 */ 00210 00211 wait_que(victim, player, 0, NOTHING, 0, command, args, nargs, 00212 mudstate.global_regs); 00213 }
void do_force_prefixed | ( | dbref | player, | |
dbref | cause, | |||
int | key, | |||
char * | command, | |||
char * | args[], | |||
int | nargs | |||
) |
Interlude to do_force for the # command
Definition at line 182 of file wiz.c.
References do_force(), and parse_to().
00184 { 00185 char *cp; 00186 00187 cp = parse_to(&command, ' ', 0); 00188 if(!command) 00189 return; 00190 while (*command && isspace(*command)) 00191 command++; 00192 if(*command) 00193 do_force(player, cause, key, cp, command, args, nargs); 00194 }
Definition at line 868 of file wiz.c.
References confdata::control_flags, enable_names, GLOB_DISABLE, GLOB_ENABLE, mudconf, notify_quiet, Quiet, and search_nametab().
00869 { 00870 int flagvalue; 00871 00872 /* 00873 * Set or clear the indicated flag 00874 */ 00875 00876 flagvalue = search_nametab(player, enable_names, flag); 00877 if(flagvalue < 0) { 00878 notify_quiet(player, "I don't know about that flag."); 00879 } else if(key == GLOB_ENABLE) { 00880 mudconf.control_flags |= flagvalue; 00881 if(!Quiet(player)) 00882 notify_quiet(player, "Enabled."); 00883 } else if(key == GLOB_DISABLE) { 00884 mudconf.control_flags &= ~flagvalue; 00885 if(!Quiet(player)) 00886 notify_quiet(player, "Disabled."); 00887 } else { 00888 notify_quiet(player, "Illegal combination of switches."); 00889 } 00890 }
Wizard-settable message of the day (displayed on connect)
Definition at line 790 of file wiz.c.
References confdata::downmotd_msg, FC_CONN_GUEST, FC_MOTD, FC_WIZMOTD, fcache_send(), confdata::fullmotd_msg, Guest, MOTD_ALL, MOTD_BRIEF, MOTD_DOWN, MOTD_FULL, MOTD_LIST, confdata::motd_msg, MOTD_WIZ, mudconf, notify_quiet, Quiet, StringCopy, tprintf(), Wizard, and confdata::wizmotd_msg.
00791 { 00792 int is_brief; 00793 00794 is_brief = 0; 00795 if(key & MOTD_BRIEF) { 00796 is_brief = 1; 00797 key = key & ~MOTD_BRIEF; 00798 if(key == MOTD_ALL) 00799 key = MOTD_LIST; 00800 else if(key != MOTD_LIST) 00801 key |= MOTD_BRIEF; 00802 } 00803 switch (key) { 00804 case MOTD_ALL: 00805 StringCopy(mudconf.motd_msg, message); 00806 if(!Quiet(player)) 00807 notify_quiet(player, "Set: MOTD."); 00808 break; 00809 case MOTD_WIZ: 00810 StringCopy(mudconf.wizmotd_msg, message); 00811 if(!Quiet(player)) 00812 notify_quiet(player, "Set: Wizard MOTD."); 00813 break; 00814 case MOTD_DOWN: 00815 StringCopy(mudconf.downmotd_msg, message); 00816 if(!Quiet(player)) 00817 notify_quiet(player, "Set: Down MOTD."); 00818 break; 00819 case MOTD_FULL: 00820 StringCopy(mudconf.fullmotd_msg, message); 00821 if(!Quiet(player)) 00822 notify_quiet(player, "Set: Full MOTD."); 00823 break; 00824 case MOTD_LIST: 00825 if(Wizard(player)) { 00826 if(!is_brief) { 00827 notify_quiet(player, "----- motd file -----"); 00828 fcache_send(player, FC_MOTD); 00829 notify_quiet(player, "----- wizmotd file -----"); 00830 fcache_send(player, FC_WIZMOTD); 00831 notify_quiet(player, "----- motd messages -----"); 00832 } 00833 notify_quiet(player, tprintf("MOTD: %s", mudconf.motd_msg)); 00834 notify_quiet(player, tprintf("Wizard MOTD: %s", 00835 mudconf.wizmotd_msg)); 00836 notify_quiet(player, tprintf("Down MOTD: %s", 00837 mudconf.downmotd_msg)); 00838 notify_quiet(player, tprintf("Full MOTD: %s", 00839 mudconf.fullmotd_msg)); 00840 } else { 00841 if(Guest(player)) 00842 fcache_send(player, FC_CONN_GUEST); 00843 else 00844 fcache_send(player, FC_MOTD); 00845 notify_quiet(player, mudconf.motd_msg); 00846 } 00847 break; 00848 default: 00849 notify_quiet(player, "Illegal combination of switches."); 00850 } 00851 }
Definition at line 433 of file wiz.c.
References alloc_lbuf, crypt(), ENDLOG, free_lbuf, God, log_name(), log_text(), LOG_WIZARD, lookup_player(), Name(), NOTHING, notify_quiet, ok_password(), s_Pass(), and STARTLOG.
00435 { 00436 dbref victim; 00437 char *buf; 00438 00439 if((victim = lookup_player(player, name, 0)) == NOTHING) { 00440 notify_quiet(player, "No such player."); 00441 return; 00442 } 00443 if(*password != '\0' && !ok_password(password)) { 00444 00445 /* 00446 * Can set null passwords, but not bad passwords 00447 */ 00448 notify_quiet(player, "Bad password"); 00449 return; 00450 } 00451 if(God(victim)) { 00452 notify_quiet(player, "You cannot change that player's password."); 00453 return; 00454 } 00455 STARTLOG(LOG_WIZARD, "WIZ", "PASS") { 00456 log_name(player); 00457 log_text((char *) " changed the password of "); 00458 log_name(victim); 00459 ENDLOG; 00460 } 00461 /* 00462 * it's ok, do it 00463 */ 00464 s_Pass(victim, crypt((const char *) password, "XX")); 00465 buf = alloc_lbuf("do_newpassword"); 00466 notify_quiet(player, "Password changed."); 00467 sprintf(buf, "Your password has been changed by %s.", Name(player)); 00468 notify_quiet(victim, buf); 00469 free_lbuf(buf); 00470 }
Reduce the wealth of anyone over a specified amount.
Definition at line 543 of file wiz.c.
References DO_WHOLE_DB, is_number(), isPlayer, Pennies(), and s_Pennies().
00544 { 00545 dbref a; 00546 int amt, curamt; 00547 00548 if(!is_number(arg1)) 00549 return; 00550 amt = atoi(arg1); 00551 DO_WHOLE_DB(a) { 00552 if(isPlayer(a)) { 00553 curamt = Pennies(a); 00554 if(amt < curamt) 00555 s_Pennies(a, amt); 00556 } 00557 } 00558 }
Definition at line 699 of file wiz.c.
References DO_WHOLE_DB, ENDLOG, Good_obj, isPlayer, log_name(), log_text(), LOG_WIZARD, lookup_player(), mudconf, mung_quotas(), notify_quiet, Owner, Quota, QUOTA_ALL, QUOTA_FIX, QUOTA_REM, QUOTA_SET, QUOTA_TOT, confdata::quotas, show_quota(), and STARTLOG.
00700 { 00701 dbref who; 00702 int set, value, i; 00703 00704 if(!(mudconf.quotas | Quota(player))) { 00705 notify_quiet(player, "Quotas are not enabled."); 00706 return; 00707 } 00708 if((key & QUOTA_TOT) && (key & QUOTA_REM)) { 00709 notify_quiet(player, "Illegal combination of switches."); 00710 return; 00711 } 00712 /* 00713 * Show or set all quotas if requested 00714 */ 00715 00716 value = 0; 00717 set = 0; 00718 if(key & QUOTA_ALL) { 00719 if(arg1 && *arg1) { 00720 value = atoi(arg1); 00721 set = 1; 00722 } else if(key & (QUOTA_SET | QUOTA_FIX)) { 00723 value = 0; 00724 set = 1; 00725 } 00726 if(set) { 00727 STARTLOG(LOG_WIZARD, "WIZ", "QUOTA") { 00728 log_name(player); 00729 log_text((char *) " changed everyone's quota"); 00730 ENDLOG; 00731 }} 00732 DO_WHOLE_DB(i) { 00733 if(isPlayer(i)) { 00734 if(set) 00735 mung_quotas(i, key, value); 00736 show_quota(player, i); 00737 } 00738 } 00739 return; 00740 } 00741 /* 00742 * Find out whose quota to show or set 00743 */ 00744 00745 if(!arg1 || *arg1 == '\0') { 00746 who = Owner(player); 00747 } else { 00748 who = lookup_player(player, arg1, 1); 00749 if(!Good_obj(who)) { 00750 notify_quiet(player, "Not found."); 00751 return; 00752 } 00753 } 00754 00755 /* 00756 * Make sure we have permission to do it 00757 */ 00758 00759 if(!Quota(player)) { 00760 if(arg2 && *arg2) { 00761 notify_quiet(player, "Permission denied."); 00762 return; 00763 } 00764 if(Owner(player) != who) { 00765 notify_quiet(player, "Permission denied."); 00766 return; 00767 } 00768 } 00769 if(arg2 && *arg2) { 00770 set = 1; 00771 value = atoi(arg2); 00772 } else if(key & QUOTA_FIX) { 00773 set = 1; 00774 value = 0; 00775 } 00776 if(set) { 00777 STARTLOG(LOG_WIZARD, "WIZ", "QUOTA") { 00778 log_name(player); 00779 log_text((char *) " changed the quota of "); 00780 log_name(who); 00781 ENDLOG; 00782 } mung_quotas(who, key, value); 00783 } 00784 show_quota(player, who); 00785 }
Definition at line 40 of file wiz.c.
References A_ATFAIL, A_LTPORT, A_OTFAIL, A_TFAIL, AMBIGUOUS, Controls, could_doit(), Dark, did_it(), Exits, confdata::fascist_tport, Fixed, confdata::fixed_tel_msg, Good_obj, Has_contents, Has_location, HOME, HUSH_ENTER, HUSH_LEAVE, init_match(), insert_first(), isExit, isRoom, Jump_ok, loc, Location, match_everything(), match_result(), move_exit(), move_via_teleport(), mudconf, noisy_match_result(), NOTHING, notify, notify_quiet, NOTYPE, Owner, Quiet, remove_first(), s_Exits, string_compare(), Tel_Anything, Tel_Anywhere, TELEPORT_QUIET, TYPE_EXIT, Typeof, and where_room().
Referenced by fun_tel().
00041 { 00042 dbref victim, destination, loc, exitloc; 00043 char *to; 00044 int hush = 0; 00045 00046 if(((Fixed(player)) || (Fixed(Owner(player)))) && !(Tel_Anywhere(player))) { 00047 notify(player, mudconf.fixed_tel_msg); 00048 return; 00049 } 00050 /* 00051 * get victim 00052 */ 00053 00054 if(*arg2 == '\0') { 00055 victim = player; 00056 to = arg1; 00057 } else { 00058 init_match(player, arg1, NOTYPE); 00059 match_everything(0); 00060 victim = noisy_match_result(); 00061 00062 if(victim == NOTHING) 00063 return; 00064 to = arg2; 00065 } 00066 00067 /* 00068 * Validate type of victim 00069 */ 00070 00071 if(!Has_location(victim) && Typeof(victim) != TYPE_EXIT) { 00072 notify_quiet(player, "You can't teleport that."); 00073 return; 00074 } 00075 /* 00076 * Fail if we don't control the victim or the victim's location 00077 */ 00078 00079 if(!Controls(player, victim) && !Controls(player, Location(victim)) && 00080 !Tel_Anything(player)) { 00081 notify_quiet(player, "Permission denied."); 00082 return; 00083 } 00084 /* 00085 * Check for teleporting home 00086 * Also, can't teleport exits 'home' 00087 */ 00088 00089 if(!string_compare(to, "home") && Typeof(victim) != TYPE_EXIT) { 00090 (void) move_via_teleport(victim, HOME, cause, 0); 00091 return; 00092 } 00093 /* 00094 * Find out where to send the victim 00095 */ 00096 00097 init_match(player, to, NOTYPE); 00098 match_everything(0); 00099 destination = match_result(); 00100 00101 switch (destination) { 00102 case NOTHING: 00103 notify_quiet(player, "No match."); 00104 return; 00105 case AMBIGUOUS: 00106 notify_quiet(player, "I don't know which destination you mean!"); 00107 return; 00108 default: 00109 if(victim == destination) { 00110 notify_quiet(player, "Bad destination."); 00111 return; 00112 } 00113 } 00114 00115 /* 00116 * If fascist teleport is on, you must control the victim's ultimate 00117 * location (after LEAVEing any objects) or it must be JUMP_OK. 00118 */ 00119 00120 if(mudconf.fascist_tport) { 00121 loc = where_room(victim); 00122 if(!Good_obj(loc) || !isRoom(loc) || (((!Controls(player, loc) && 00123 !Jump_ok(loc))) 00124 && !Tel_Anywhere(player))) { 00125 notify_quiet(player, "Permission denied."); 00126 return; 00127 } 00128 } 00129 if(Has_contents(destination)) { 00130 00131 /* 00132 * You must control the destination, or it must be a JUMP_OK 00133 * room where you pass its TELEPORT lock. 00134 */ 00135 00136 if(((!Controls(player, destination) && !Jump_ok(destination)) && 00137 !Tel_Anywhere(player)) || 00138 !could_doit(player, destination, A_LTPORT)) { 00139 00140 /* 00141 * Nope, report failure 00142 */ 00143 00144 if(player != victim) 00145 notify_quiet(player, "Permission denied."); 00146 did_it(victim, destination, A_TFAIL, 00147 "You can't teleport there!", A_OTFAIL, 0, A_ATFAIL, 00148 (char **) NULL, 0); 00149 return; 00150 } 00151 /* 00152 * We're OK, do the teleport 00153 */ 00154 00155 if((key & TELEPORT_QUIET) || Dark(victim)) 00156 hush = HUSH_ENTER | HUSH_LEAVE; 00157 00158 if(Typeof(victim) == TYPE_EXIT) { 00159 exitloc = Exits(victim); 00160 s_Exits(exitloc, remove_first(Exits(exitloc), victim)); 00161 s_Exits(destination, insert_first(Exits(destination), victim)); 00162 s_Exits(victim, destination); 00163 00164 if(!Quiet(player)) 00165 notify_quiet(player, "Exit teleported."); 00166 } else if(move_via_teleport(victim, destination, cause, hush)) { 00167 if(player != victim && !Quiet(player)) 00168 notify_quiet(player, "Teleported."); 00169 } 00170 } else if(isExit(destination)) { 00171 if(Exits(destination) == Location(victim)) { 00172 move_exit(victim, destination, 0, "You can't go that way.", 0); 00173 } else { 00174 notify_quiet(player, "I can't find that exit."); 00175 } 00176 } 00177 }
Turn a player into an object.
Definition at line 344 of file wiz.c.
References A_ALIAS, alloc_mbuf, atr_pget(), boot_off(), chown_all(), delete_player_name(), ENDLOG, free_lbuf, free_mbuf, HALT, init_match(), isPlayer, loc, Location, log_name(), log_name_and_loc(), log_text(), LOG_WIZARD, match_absolute(), match_neighbor(), match_player(), Name(), No_Destroy, noisy_match_result(), NOTHING, notify_except2(), notify_quiet, s_Flags, s_Flags2, s_Flags3, s_Name(), s_Owner, s_Pennies(), STARTLOG, TOAD_NO_CHOWN, tprintf(), TYPE_PLAYER, and TYPE_THING.
00345 { 00346 dbref victim, recipient, loc, aowner; 00347 char *buf; 00348 int count, aflags; 00349 00350 init_match(player, toad, TYPE_PLAYER); 00351 match_neighbor(); 00352 match_absolute(); 00353 match_player(); 00354 if((victim = noisy_match_result()) == NOTHING) 00355 return; 00356 00357 if(!isPlayer(victim)) { 00358 notify_quiet(player, "Try @destroy instead."); 00359 return; 00360 } 00361 if(No_Destroy(victim)) { 00362 notify_quiet(player, "You can't toad that player."); 00363 return; 00364 } 00365 if((newowner != NULL) && *newowner) { 00366 init_match(player, newowner, TYPE_PLAYER); 00367 match_neighbor(); 00368 match_absolute(); 00369 match_player(); 00370 if((recipient = noisy_match_result()) == NOTHING) 00371 return; 00372 } else { 00373 recipient = player; 00374 } 00375 00376 STARTLOG(LOG_WIZARD, "WIZ", "TOAD") { 00377 log_name_and_loc(victim); 00378 log_text((char *) " was @toaded by "); 00379 log_name(player); 00380 ENDLOG; 00381 } 00382 /* 00383 * Clear everything out 00384 */ 00385 if(key & TOAD_NO_CHOWN) { 00386 count = -1; 00387 } else { 00388 count = chown_all(victim, recipient); 00389 s_Owner(victim, recipient); /* 00390 * you get it 00391 */ 00392 } 00393 s_Flags(victim, TYPE_THING | HALT); 00394 s_Flags2(victim, 0); 00395 s_Flags3(victim, 0); 00396 s_Pennies(victim, 1); 00397 00398 /* 00399 * notify people 00400 */ 00401 00402 loc = Location(victim); 00403 buf = alloc_mbuf("do_toad"); 00404 sprintf(buf, "%s has been turned into a slimy toad!", Name(victim)); 00405 notify_except2(loc, player, victim, player, buf); 00406 sprintf(buf, "You toaded %s! (%d objects @chowned)", Name(victim), 00407 count + 1); 00408 notify_quiet(player, buf); 00409 00410 /* 00411 * Zap the name from the name hash table 00412 */ 00413 00414 delete_player_name(victim, Name(victim)); 00415 sprintf(buf, "a slimy toad named %s", Name(victim)); 00416 s_Name(victim, buf); 00417 free_mbuf(buf); 00418 00419 /* 00420 * Zap the alias too 00421 */ 00422 00423 buf = atr_pget(victim, A_ALIAS, &aowner, &aflags); 00424 delete_player_name(victim, buf); 00425 free_lbuf(buf); 00426 00427 count = 00428 boot_off(victim, (char *) "You have been turned into a slimy toad!"); 00429 notify_quiet(player, tprintf("%d connection%s closed.", count, 00430 (count == 1 ? "" : "s"))); 00431 }
static void mung_quotas | ( | dbref | player, | |
int | key, | |||
int | value | |||
) | [static] |
Definition at line 612 of file wiz.c.
References A_QUOTA, A_RQUOTA, atr_add_raw(), atr_get(), count_quota(), free_lbuf, QUOTA_FIX, QUOTA_REM, QUOTA_TOT, and tprintf().
Referenced by do_quota().
00613 { 00614 dbref aowner; 00615 int aq, rq, xq, aflags; 00616 char *buff; 00617 00618 if(key & QUOTA_FIX) { 00619 00620 /* 00621 * Get value of stuff owned and good value, set other value 00622 * from that. 00623 */ 00624 00625 xq = count_quota(player); 00626 if(key & QUOTA_TOT) { 00627 buff = atr_get(player, A_RQUOTA, &aowner, &aflags); 00628 aq = atoi(buff) + xq; 00629 atr_add_raw(player, A_QUOTA, tprintf("%d", aq)); 00630 free_lbuf(buff); 00631 } else { 00632 buff = atr_get(player, A_QUOTA, &aowner, &aflags); 00633 rq = atoi(buff) - xq; 00634 atr_add_raw(player, A_RQUOTA, tprintf("%d", rq)); 00635 free_lbuf(buff); 00636 } 00637 } else { 00638 00639 /* 00640 * Obtain (or calculate) current relative and absolute quota 00641 */ 00642 00643 buff = atr_get(player, A_QUOTA, &aowner, &aflags); 00644 if(!*buff) { 00645 free_lbuf(buff); 00646 buff = atr_get(player, A_RQUOTA, &aowner, &aflags); 00647 rq = atoi(buff); 00648 free_lbuf(buff); 00649 aq = rq + count_quota(player); 00650 } else { 00651 aq = atoi(buff); 00652 free_lbuf(buff); 00653 buff = atr_get(player, A_RQUOTA, &aowner, &aflags); 00654 rq = atoi(buff); 00655 free_lbuf(buff); 00656 } 00657 00658 /* 00659 * Adjust values 00660 */ 00661 00662 if(key & QUOTA_REM) { 00663 aq += (value - rq); 00664 rq = value; 00665 } else { 00666 rq += (value - aq); 00667 aq = value; 00668 } 00669 00670 /* 00671 * Set both abs and relative quota 00672 */ 00673 00674 atr_add_raw(player, A_QUOTA, tprintf("%d", aq)); 00675 atr_add_raw(player, A_RQUOTA, tprintf("%d", rq)); 00676 } 00677 }
Definition at line 679 of file wiz.c.
References A_QUOTA, A_RQUOTA, atr_get(), free_lbuf, Free_Quota, Name(), notify_quiet, and tprintf().
Referenced by do_quota().
00680 { 00681 dbref aowner; 00682 int aq, rq, aflags; 00683 char *buff; 00684 00685 buff = atr_get(victim, A_QUOTA, &aowner, &aflags); 00686 aq = atoi(buff); 00687 free_lbuf(buff); 00688 buff = atr_get(victim, A_RQUOTA, &aowner, &aflags); 00689 rq = aq - atoi(buff); 00690 free_lbuf(buff); 00691 if(!Free_Quota(victim)) 00692 notify_quiet(player, tprintf("%-16s Quota: %9d Used: %9d", 00693 Name(victim), aq, rq)); 00694 else 00695 notify_quiet(player, tprintf("%-16s Quota: UNLIMITED Used: %9d", 00696 Name(victim), rq)); 00697 }
Initial value:
{ {(char *) "building", 1, CA_PUBLIC, CF_BUILD}, {(char *) "checkpointing", 2, CA_PUBLIC, CF_CHECKPOINT}, {(char *) "cleaning", 2, CA_PUBLIC, CF_DBCHECK}, {(char *) "dequeueing", 1, CA_PUBLIC, CF_DEQUEUE}, {(char *) "idlechecking", 2, CA_PUBLIC, CF_IDLECHECK}, {(char *) "interpret", 2, CA_PUBLIC, CF_INTERP}, {(char *) "logins", 3, CA_PUBLIC, CF_LOGIN}, {(char *) "eventchecking", 2, CA_PUBLIC, CF_EVENTCHECK}, {NULL, 0, 0, 0} }
Definition at line 856 of file wiz.c.
Referenced by do_global(), and do_list().