act.wizard.cc
AwakeMUD-0.51Beta/src/act.wizard.cc · 120.8 KB
From the archive AwakeMUD-0.51_Beta.tar.gz
Download the archive « Back to the archive contents
/* ************************************************************************
* File: act.wizard.c Part of CircleMUD *
* Usage: Player-level god commands and other goodies *
* *
* All rights reserved. See license.doc for complete information. *
* *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include "structs.h"
#include "awake.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "dblist.h"
#include "spells.h"
#include "house.h"
#include "memory.h"
#include "newmagic.h"
#include "shop.h"
#include "quest.h"
#if defined(__CYGWIN__)
#include <crypt.h>
#endif
extern class memoryClass *Mem;
extern class objList ObjList;
/* external vars */
extern FILE *player_fl;
extern struct room_data *world;
extern struct char_data *character_list;
extern struct descriptor_data *descriptor_list;
extern struct index_data *mob_index;
extern struct index_data *obj_index;
extern struct shop_data *shop_table;
extern struct quest_data *quest_table;
extern struct int_app_type int_app[36];
extern struct wis_app_type wis_app[36];
extern struct zone_data *zone_table;
extern int top_of_zone_table;
extern int restrict;
extern int top_of_world;
extern int top_of_mobt;
extern int top_of_objt;
extern int top_of_shopt;
extern int top_of_questt;
extern int top_of_p_table;
extern int max_npc_corpse_time;
extern const char *allergy_names[];
extern const char *severity_names[];
extern const char *elements[];
extern const char *wear_bits[];
extern const char *extra_bits[];
extern const char *drinks[];
extern const char *item_types[];
extern const char *gear_name[];
extern const char *npc_classes[];
extern const char *composition_names[];
extern const char *matrix_modes[];
extern char *spells[];
// for olc
extern int top_of_mob_array;
extern int top_of_world_array;
extern int top_of_obj_array;
extern int world_chunk_size;
extern int mob_chunk_size;
extern int obj_chunk_size;
extern int olc_state;
/* for rooms */
extern const char *dirs[];
extern const char *room_bits[];
extern const char *exit_bits[];
extern const char *sector_types[];
/* for chars */
extern const char *attack_types[];
extern const char *equipment_types[];
extern const char *program_types[];
extern const char *cyberware_names[];
extern const char *affected_bits[];
extern const char *attack_types[];
extern const char *apply_types[];
extern const char *action_bits[];
extern const char *player_bits[];
extern const char *preference_bits[];
extern const char *position_types[];
extern const char *connected_types[];
extern const char *totem_types[];
extern const char *pc_race_types[];
extern const char *short_where[];
extern const char *status_ratings[];
extern const char *patch_names[];
extern struct time_info_data time_info;
extern struct obj_data *obj_proto;
extern struct char_data *mob_proto;
extern int mortal_start_room;
extern int immort_start_room;
extern int newbie_start_room;
extern int frozen_start_room;
extern int last;
extern int real_zone(int virt);
extern int real_shop(int virt);
extern int max_ability(int i);
// from newmagic.cc
extern const char *spell_category[];
extern const char *spell_combat[];
extern const char *spell_target[];
extern const char *wound_arr[];
extern const char *spell_detection[];
extern const char *spell_illusion[];
extern const char *spell_manipulation[];
extern const char *spell_health[];
extern const char *material_names[];
extern int ViolencePulse;
extern void list_detailed_shop(struct char_data *ch, int shop_nr);
extern void list_detailed_quest(struct char_data *ch, int rnum);
bool check_lar( char_data *ch, char *str, int channel );
// this lists global vars
ACMD(do_vars)
{
if (!*argument) {
send_to_char(ch, "Violence Pulse: %d\r\n", ViolencePulse);
send_to_char(ch, "NPC Corpse Time: %d\r\n", max_npc_corpse_time);
return;
}
int num;
char *temp = any_one_arg(argument, arg);
if (!strcmp(arg, "violence")) {
any_one_arg(temp, arg);
num = atoi(arg);
num = num RL_SEC;
ViolencePulse = num;
send_to_char(ch, "Violence Pulse set to %d.\r\n", ViolencePulse);
} else if (!strcmp(arg, "npc")) {
any_one_arg(temp, arg);
num = atoi(arg);
max_npc_corpse_time = num;
send_to_char(ch, "NPC Corpse Time set to %d.\r\n", max_npc_corpse_time);
}
}
ACMD(do_olcon)
{
if (olc_state == 0)
olc_state = 1;
else olc_state = 0;
sprintf(buf, "OLC turned %s by %s.", (olc_state ? "ON" : "OFF"), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
}
/* ANTI-LAR code */
extern int ANTI_LAR;
ACMD(do_antilar)
{
if ( ANTI_LAR == 0 )
ANTI_LAR = 1;
else
ANTI_LAR = 0;
sprintf(buf,"Anti-Lar %s by %s.", (ANTI_LAR ? "enabled" : "disabled"), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
}
ACMD(do_echo)
{
skip_spaces(&argument);
if (!*argument)
send_to_char("Yes.. but what?\r\n", ch);
else {
if ( check_lar( ch, argument, CHAN_EMOTE ) )
return;
switch (subcmd) {
case SCMD_EMOTE: sprintf(buf, "$n %s", argument); break;
case SCMD_ECHO: sprintf(buf, "%s", argument); break;
case SCMD_XEMOTE: sprintf(buf, "# $n %s", argument); break;
case SCMD_XECHO: sprintf(buf, "# %s", argument); break;
}
act(buf, FALSE, ch, 0, 0, TO_ROOM);
if (PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(OK, ch);
else act(buf, FALSE, ch, 0, 0, TO_CHAR);
sprintf(buf2, "%s echoed %s at #%d", GET_NAME(ch), buf, world[ch->in_room].number);
if (!access_level(ch, LVL_PRESIDENT) && subcmd == SCMD_ECHO)
mudlog(buf2, ch, LOG_WIZLOG, FALSE);
}
}
ACMD(do_send)
{
struct char_data *vict;
half_chop(argument, arg, buf);
if (!*arg) {
send_to_char("Send what to who?\r\n", ch);
return;
}
if (!(vict = get_char_vis(ch, arg))) {
send_to_char(NOPERSON, ch);
return;
}
if (PLR_FLAGGED(vict, PLR_WRITING | PLR_MAILING) && !access_level(ch, LVL_PRESIDENT)) {
send_to_char(ch, "You can't send to someone who's writing a message.\r\n");
return;
} else if (PLR_FLAGGED(vict, PLR_EDITING | PLR_SPELL_CREATE | PLR_CUSTOMIZE) &&
!access_level(ch, LVL_PRESIDENT)) {
send_to_char(ch, "You can't send to someone who's editing.\r\n");
return;
}
send_to_char(buf, vict);
send_to_char("\r\n", vict);
if (PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char("Sent.\r\n", ch);
else {
sprintf(buf2, "You send '%s' to %s.\r\n", buf, GET_NAME(vict));
send_to_char(buf2, ch);
sprintf(buf2, "%s sent %s to %s", GET_NAME(ch), buf, GET_NAME(vict));
if (!access_level(ch, LVL_PRESIDENT))
mudlog(buf2, ch, LOG_WIZLOG, FALSE);
}
}
ACMD(do_gecho)
{
struct descriptor_data *d;
skip_spaces(&argument);
if (!*argument)
send_to_char("That must be a mistake...\r\n", ch);
else {
for (d = descriptor_list; d; d = d->next)
if (!d->connected && d->character && d->character != ch)
act(argument, FALSE, d->character, 0, 0, TO_CHAR);
if (PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(OK, ch);
else act(argument, FALSE, ch, 0, 0, TO_CHAR);
}
}
/* take a string, and return an rnum.. used for goto, at, etc. -je 4/6/93 */
sh_int find_target_room(struct char_data * ch, char *rawroomstr)
{
int tmp;
sh_int location;
struct char_data *target_mob, *tch;
struct obj_data *target_obj;
char roomstr[MAX_INPUT_LENGTH];
one_argument(rawroomstr, roomstr);
if (!*roomstr) {
send_to_char("You must supply a room number or name.\r\n", ch);
return NOWHERE;
}
if (isdigit(*roomstr) && !strchr((const char *)roomstr, '.')) {
tmp = atoi(roomstr);
if ((location = real_room(tmp)) < 0) {
send_to_char("No room exists with that number.\r\n", ch);
return NOWHERE;
}
} else if ((target_mob = get_char_vis(ch, roomstr)))
location = target_mob->in_room;
else if ((target_obj = get_obj_vis(ch, roomstr))) {
if (target_obj->in_room != NOWHERE)
location = target_obj->in_room;
else {
send_to_char("That object is not available.\r\n", ch);
return NOWHERE;
}
} else {
send_to_char("No such creature or object around.\r\n", ch);
return NOWHERE;
}
/* a location has been found -- if you're < GRGOD, check restrictions. */
if (ROOM_FLAGGED(location, ROOM_BUILDERROOM) && GET_LEVEL(ch) < LVL_BUILDER) {
send_to_char("You are not important enough to use that room!\r\n", ch);
return NOWHERE;
} else if (ROOM_FLAGGED(location, ROOM_MGRROOM) && GET_LEVEL(ch) < LVL_MANAGER) {
send_to_char("You are not important enough to use that room!\r\n", ch);
return NOWHERE;
} else if (ROOM_FLAGGED(location, ROOM_DIRECTORROOM) && !access_level(ch, LVL_DIRECTOR)) {
send_to_char("You ^rdon't^n want to incur the wrath of the owners.\r\n", ch);
return NOWHERE;
} else if (ROOM_FLAGGED(location, ROOM_PRESROOM) && !access_level(ch, LVL_PRESIDENT)) {
send_to_char("You ^rDON'T^n want to incur the wrath of the owners.\r\n", ch);
return NOWHERE;
}
if (!access_level(ch, LVL_DIRECTOR)) {
if (ROOM_FLAGGED(location, ROOM_PRIVATE))
for (tch = world[location].people; tch; tch = tch->next)
if (!IS_NPC(tch)) {
send_to_char("You can't teleport into there!\r\n", ch);
return NOWHERE;
}
if (ROOM_FLAGGED(location, ROOM_HOUSE) &&
!House_can_enter(ch, world[location].number)) {
send_to_char("That's private property -- no trespassing!\r\n", ch);
return NOWHERE;
}
}
return location;
}
ACMD(do_at)
{
char command[MAX_INPUT_LENGTH];
int location, original_loc;
half_chop(argument, buf, command);
if (!*buf) {
send_to_char("You must supply a room number or a name.\r\n", ch);
return;
}
if (!*command) {
send_to_char("What do you want to do there?\r\n", ch);
return;
}
if ((location = find_target_room(ch, buf)) < 0)
return;
/* a location has been found. */
original_loc = ch->in_room;
char_from_room(ch);
char_to_room(ch, location);
command_interpreter(ch, command);
/* check if the char is still there */
if (ch->in_room == location) {
char_from_room(ch);
char_to_room(ch, original_loc);
}
}
ACMD(do_goto)
{
sh_int location;
if ((location = find_target_room(ch, argument)) < 0)
return;
if (POOFOUT(ch))
act(POOFOUT(ch), TRUE, ch, 0, 0, TO_ROOM);
else act("$n disappears in a puff of smoke.", TRUE, ch, 0, 0, TO_ROOM);
char_from_room(ch);
char_to_room(ch, location);
if (POOFIN(ch))
act(POOFIN(ch), TRUE, ch, 0, 0, TO_ROOM);
else act("$n appears with an ear-splitting bang.", TRUE, ch, 0, 0, TO_ROOM);
look_at_room(ch, 0);
}
ACMD(do_trans)
{
ACMD(do_transfer);
if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_BUILDER) {
do_transfer(ch, argument, 0, 0);
return;
}
struct descriptor_data *i;
struct char_data *victim;
any_one_arg(argument, buf);
if (!*buf)
send_to_char("Whom do you wish to transfer?\r\n", ch);
else if (str_cmp("all", buf)) {
if (!(victim = get_char_vis(ch, buf)))
send_to_char(NOPERSON, ch);
else if (victim == ch)
send_to_char("That doesn't make much sense, does it?\r\n", ch);
else {
if ((GET_LEVEL(ch) < GET_LEVEL(victim)) && !IS_NPC(victim)) {
send_to_char("Go transfer someone your own size.\r\n", ch);
return;
}
if (PLR_FLAGGED(victim, PLR_EDITING)) {
act("Not while $E's editing!", FALSE, ch, 0, victim, TO_CHAR);
return;
} else if (PLR_FLAGGED(victim, PLR_SWITCHED)) {
act("Not while $E's switched!", FALSE, ch, 0, victim, TO_CHAR);
return;
}
act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
char_to_room(victim, ch->in_room);
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT);
look_at_room(victim, 0);
sprintf(buf2, "%s transferred %s to %s", GET_NAME(ch), GET_NAME(victim), world[ch->in_room].name);
if (!access_level(ch, LVL_OWNER))
mudlog(buf2, ch, LOG_WIZLOG, TRUE);
}
} else { /* Trans All */
if (!access_level(ch, LVL_PRESIDENT)) {
send_to_char("I think not.\r\n", ch);
return;
}
for (i = descriptor_list; i; i = i->next)
if (!i->connected && i->character && i->character != ch) {
victim = i->character;
if (GET_LEVEL(victim) >= GET_LEVEL(ch))
continue;
act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
char_from_room(victim);
char_to_room(victim, ch->in_room);
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT);
look_at_room(victim, 0);
}
send_to_char(OK, ch);
}
}
ACMD(do_teleport)
{
struct char_data *victim;
sh_int target;
two_arguments(argument, buf, buf2);
if (!*buf)
send_to_char("Whom do you wish to teleport?\r\n", ch);
else if (!(victim = get_char_vis(ch, buf)))
send_to_char(NOPERSON, ch);
else if (victim == ch)
send_to_char("Use 'goto' to teleport yourself.\r\n", ch);
else if (GET_LEVEL(victim) >= GET_LEVEL(ch))
send_to_char("Maybe you shouldn't do that.\r\n", ch);
else if (PLR_FLAGGED(victim, PLR_EDITING))
act("Not while $E's editing!", FALSE, ch, 0, victim, TO_CHAR);
else if (PLR_FLAGGED(victim, PLR_SWITCHED))
act("Not while $E's switched!", FALSE, ch, 0, victim, TO_CHAR);
else if (!*buf2)
send_to_char("Where do you wish to send this person?\r\n", ch);
else if ((target = find_target_room(ch, buf2)) >= 0) {
send_to_char(OK, ch);
act("$n disappears in a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
char_to_room(victim, target);
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has teleported you!", FALSE, ch, 0, (char *) victim, TO_VICT);
look_at_room(victim, 0);
sprintf(buf2, "%s teleported %s to %s", GET_NAME(ch), GET_NAME(victim), world[target].name);
if (!access_level(ch, LVL_OWNER))
mudlog(buf2, ch, LOG_WIZLOG, TRUE);
}
}
ACMD(do_vnum)
{
argument = one_argument(argument, buf);
strcpy(buf2, argument);
if (!*buf || !*buf2 || (!is_abbrev(buf, "mob") && !is_abbrev(buf, "obj"))) {
send_to_char("Usage: vnum { obj | mob } <name>\r\n", ch);
return;
}
if (is_abbrev(buf, "mob"))
if (!vnum_mobile(buf2, ch))
send_to_char("No mobiles by that name.\r\n", ch);
if (is_abbrev(buf, "obj"))
if (!vnum_object(buf2, ch))
send_to_char("No objects by that name.\r\n", ch);
}
void do_stat_room(struct char_data * ch)
{
struct extra_descr_data *desc;
struct room_data *rm = &world[ch->in_room];
int i, found = 0;
struct obj_data *j = 0;
struct char_data *k = 0;
sprintf(buf, "Room name: ^c%s\r\n", rm->name);
send_to_char(buf, ch);
sprinttype(rm->sector_type, sector_types, buf2);
sprintf(buf, "Zone: [%3d], VNum: [^g%5d^n], RNum: [%5d], Rating: [%2d], Type: %s\r\n",
rm->zone, rm->number, ch->in_room, rm->rating, buf2);
send_to_char(buf, ch);
sprintbit((long) rm->room_flags, room_bits, buf2);
sprintf(buf, "Extra: [%4d], SpecProc: %s, Flags: %s\r\n", rm->spec,
(rm->func == NULL) ? "None" : "^CExists^n", buf2);
send_to_char(buf, ch);
send_to_char("Description:\r\n", ch);
if (rm->description)
send_to_char(rm->description, ch);
else send_to_char(" None.\r\n", ch);
if (rm->ex_description) {
strcpy(buf, "Extra descs:^c");
for (desc = rm->ex_description; desc; desc = desc->next) {
strcat(buf, " ");
strcat(buf, desc->keyword);
}
send_to_char(strcat(buf, "\r\n"), ch);
}
strcpy(buf, "Chars present:^y");
for (found = 0, k = rm->people; k; k = k->next_in_room) {
if (!CAN_SEE(ch, k))
continue;
sprintf(buf2, "%s %s(%s)", found++ ? "," : "", GET_NAME(k),
(!IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")));
strcat(buf, buf2);
if (strlen(buf) >= 62) {
if (k->next_in_room)
send_to_char(strcat(buf, ",\r\n"), ch);
else
send_to_char(strcat(buf, "\r\n"), ch);
*buf = found = 0;
}
}
if (*buf)
send_to_char(strcat(buf, "\r\n"), ch);
if (rm->contents) {
strcpy(buf, "Contents:^g");
for (found = 0, j = rm->contents; j; j = j->next_content) {
if (!CAN_SEE_OBJ(ch, j))
continue;
sprintf(buf2, "%s %s", found++ ? "," : "", j->short_description);
strcat(buf, buf2);
if (strlen(buf) >= 62) {
if (j->next_content)
send_to_char(strcat(buf, ",\r\n"), ch);
else
send_to_char(strcat(buf, "\r\n"), ch);
*buf = found = 0;
}
}
if (*buf)
send_to_char(strcat(buf, "\r\n"), ch);
}
if (rm->msp_trigger)
send_to_char(ch, "MSP trigger: ^b%s^n\r\n", rm->msp_trigger);
for (i = 0; i < NUM_OF_DIRS; i++) {
if (rm->dir_option[i]) {
if (rm->dir_option[i]->to_room == NOWHERE)
strcpy(buf1, " ^cNONE^n");
else sprintf(buf1, "^c%5d^n", world[rm->dir_option[i]->to_room].number);
sprintbit(rm->dir_option[i]->exit_info, exit_bits, buf2);
sprintf(buf, "Exit ^c%-5s^n: To: [^c%s^n], Key: [^c%5d^n], Keyword: "
"^c%s^n, Type: ^c%s^n\r\n ", dirs[i], buf1, rm->dir_option[i]->key,
rm->dir_option[i]->keyword ? rm->dir_option[i]->keyword : "None", buf2);
send_to_char(buf, ch);
if (rm->dir_option[i]->general_description)
strcpy(buf, rm->dir_option[i]->general_description);
else strcpy(buf, " No exit description.\r\n");
send_to_char(buf, ch);
}
}
}
void do_stat_object(struct char_data * ch, struct obj_data * j)
{
int i, virt, found;
struct obj_data *j2;
struct extra_descr_data *desc;
virt = GET_OBJ_VNUM(j);
sprintf(buf, "Name: '^y%s^n', Aliases: %s\r\n",
((j->short_description) ? j->short_description : "<None>"),
j->name);
send_to_char(buf, ch);
sprinttype(GET_OBJ_TYPE(j), item_types, buf1);
if (GET_OBJ_RNUM(j) >= 0) {
if (GET_OBJ_TYPE(j) == ITEM_WEAPON)
strcpy(buf2, (obj_index[GET_OBJ_RNUM(j)].wfunc ? "^cExists^n" : "None"));
else strcpy(buf2, (obj_index[GET_OBJ_RNUM(j)].func ? "^cExists^n" : "None"));
} else strcpy(buf2, "None");
sprintf(buf, "VNum: [^g%5d^n], RNum: [%5d], Type: %s, SpecProc: %s\r\n",
virt, GET_OBJ_RNUM(j), buf1, buf2);
send_to_char(buf, ch);
sprintf(buf, "L-Des: %s\r\n", ((j->description) ? j->description : "None"));
send_to_char(buf, ch);
if (j->ex_description) {
strcpy(buf, "Extra descs:^c");
for (desc = j->ex_description; desc; desc = desc->next) {
strcat(buf, " ");
strcat(buf, desc->keyword);
}
send_to_char(strcat(buf, "\r\n"), ch);
}
send_to_char("Can be worn on: ", ch);
sprintbit(j->obj_flags.wear_flags, wear_bits, buf);
strcat(buf, "\r\n");
send_to_char(buf, ch);
send_to_char("Set char bits : ", ch);
sprintbit(j->obj_flags.bitvector, affected_bits, buf);
strcat(buf, "\r\n");
send_to_char(buf, ch);
send_to_char("Extra flags : ", ch);
sprintbit(GET_OBJ_EXTRA(j), extra_bits, buf);
strcat(buf, "\r\n");
send_to_char(buf, ch);
sprintf(buf, "Weight: %d, Value: %d, Composition: %s, Timer: %d\r\n",
GET_OBJ_WEIGHT(j), GET_OBJ_COST(j),
composition_names[(GET_OBJ_RENT(j) >= 0 && GET_OBJ_RENT(j) <= 3 ? GET_OBJ_RENT(j) : 0)], GET_OBJ_TIMER(j));
send_to_char(buf, ch);
strcpy(buf, "In room: ");
if (j->in_room == NOWHERE)
strcat(buf, "Nowhere");
else {
sprintf(buf2, "%d", world[j->in_room].number);
strcat(buf, buf2);
}
strcat(buf, ", In object: ");
strcat(buf, j->in_obj ? j->in_obj->short_description : "None");
strcat(buf, ", Carried by: ");
strcat(buf, j->carried_by ? GET_NAME(j->carried_by) : "Nobody");
strcat(buf, ", Worn by: ");
strcat(buf, j->worn_by ? GET_NAME(j->worn_by) : "Nobody");
strcat(buf, "\r\n");
send_to_char(buf, ch);
send_to_char(ch, "Material: %s, Rating: %d, Condition: %d\r\n",
material_names[GET_OBJ_MATERIAL(j)], GET_OBJ_BARRIER(j),
GET_OBJ_CONDITION(j));
switch (GET_OBJ_TYPE(j)) {
case ITEM_LIGHT:
sprintf(buf, "Color: [%d], Type: [%d], Hours: [%d]",
GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2));
break;
case ITEM_SCROLL: case ITEM_POTION:
sprintf(buf, "Force: %d, Spell: %s", GET_OBJ_VAL(j, 0), spells[GET_OBJ_VAL(j, 3)]);
break;
case ITEM_WAND: case ITEM_STAFF:
sprintf(buf, "Force: %d, Max: %d, Remaining: %d, Spell: %s", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1),
GET_OBJ_VAL(j, 2), spells[GET_OBJ_VAL(j, 3)]);
break;
case ITEM_FIREWEAPON:
sprintf(buf, "Str Min: %d, Str+: %d, Power: %d, Wound: %s, Skill: %s, Type: %s\r\n",
GET_OBJ_VAL(j, 6), GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 0), wound_arr[GET_OBJ_VAL(j, 1)],
spells[GET_OBJ_VAL(j, 4)], (GET_OBJ_VAL(j, 5) == 0 ? "Bow" : "Crossbow"));
break;
case ITEM_WEAPON:
sprintf(buf, "Power: %d, Wound: %s, Str+: %d, DamType: %s, Skill: %s\r\nMax Ammo: %d, Ammo: %d",
GET_OBJ_VAL(j, 0), wound_arr[GET_OBJ_VAL(j, 1)], GET_OBJ_VAL(j, 2),
attack_types[GET_OBJ_VAL(j, 3) - TYPE_HIT],
spells[GET_OBJ_VAL(j, 4)], GET_OBJ_VAL(j, 5), GET_OBJ_VAL(j, 6));
if (GET_OBJ_VAL(j, 3) >= TYPE_PISTOL) {
sprintf(buf2, ", Top: %d, Barrel: %d, Under: %d", GET_OBJ_VAL(j, 7), GET_OBJ_VAL(j, 8), GET_OBJ_VAL(j, 9));
strcat(buf, buf2);
} else if (GET_OBJ_VAL(j, 3) > TYPE_HIT && GET_OBJ_VAL(j, 3) < TYPE_TASER) {
sprintf(buf2, ", Focus: %d, Rating: %d, By: %d", GET_OBJ_VAL(j, 7), GET_OBJ_VAL(j, 8), GET_OBJ_VAL(j, 9));
strcat(buf, buf2);
}
break;
case ITEM_MISSILE:
sprintf(buf, "Missile type: %s", (GET_OBJ_VAL(j, 0) == 0 ? "Arrow" : "Bolt"));
break;
case ITEM_ARMOR:
sprintf(buf, "Ballistic: %d, Impact: %d", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1));
break;
case ITEM_DOCWAGON:
sprintf(buf, "Contract: %s, Owner: %d", (GET_OBJ_VAL(j, 0) == 1 ? "basic" :
(GET_OBJ_VAL(j, 0) == 2 ? "gold" : "platinum")), GET_OBJ_VAL(j, 1));
break;
case ITEM_CONTAINER:
sprintf(buf, "Max-contains: %d, Locktype: %d, Key: %d, Lock level: %d, Corpse: %s",
GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2),
GET_OBJ_VAL(j, 3), GET_OBJ_VAL(j, 4) ? "Yes" : "No");
break;
case ITEM_DRINKCON: case ITEM_FOUNTAIN:
sprinttype(GET_OBJ_VAL(j, 2), drinks, buf2);
sprintf(buf, "Max-contains: %d, Contains: %d, Poisoned: %s, Liquid: %s",
GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1),
GET_OBJ_VAL(j, 3) ? "Yes" : "No", buf2);
break;
case ITEM_MONEY:
if (!GET_OBJ_VAL(j, 1))
sprintf(buf, "Value: %d, Type: nuyen", GET_OBJ_VAL(j, 0));
else sprintf(buf, "Value: %d, Type: credstick, Security: %s", GET_OBJ_VAL(j, 0),
(GET_OBJ_VAL(j, 2) == 1 ? "6-digit" : (GET_OBJ_VAL(j, 2) == 2 ?
"thumbprint" : "retina")));
break;
case ITEM_KEY:
sprintf(buf, "Keytype: %d", GET_OBJ_VAL(j, 0));
break;
case ITEM_FOOD:
sprintf(buf, "Makes full: %d, Poisoned: %d", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 3));
break;
case ITEM_QUIVER:
sprintf(buf, "Max-contains: %d, Type contains: %s", GET_OBJ_VAL(j, 0), (GET_OBJ_VAL(j, 1) == 0 ? "Arrow" :
(GET_OBJ_VAL(j, 1) == 1 ? "Bolt" : (GET_OBJ_VAL(j, 1) == 2 ? "Shuriken" :
(GET_OBJ_VAL(j, 1) == 3 ? "Throwing knife" : "Undefined")))));
break;
case ITEM_SPELL_FORMULA:
sprintf(buf, "(%s) Category: %s, Force: %d, Target: %s, Drain %d%s\r\n"
"Damage: %s, Type: %s, Effect: %s, For: %s",
(GET_OBJ_VAL(j, 0) ? "Physical" : "Mana"),
spell_category[GET_OBJ_VAL(j, 1)], GET_OBJ_VAL(j, 2),
spell_target[GET_OBJ_VAL(j, 3)],
((GET_OBJ_VAL(j, 2) >> 1) + (int)(GET_OBJ_VAL(j, 4) / 10)),
wound_arr[GET_OBJ_VAL(j, 4) % 10], wound_arr[GET_OBJ_VAL(j, 5)],
spells[GET_OBJ_VAL(j, 6)], elements[GET_OBJ_VAL(j, 8)],
(GET_OBJ_VAL(j, 7) ? "Shaman" : "Mage"));
break;
case ITEM_WORKING_GEAR:
sprintf(buf, "Type: %s", gear_name[GET_OBJ_VAL(j, 0)]);
break;
case ITEM_PATCH:
sprintf(buf, "Type: %s, Rating: %d", patch_names[GET_OBJ_VAL(j, 0)],
GET_OBJ_VAL(j, 1));
break;
case ITEM_CYBERDECK:
sprintf(buf, "MPCP: %d, Hardening: %d, Active: %d, Storage: %d, Load: %d",
GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2),
GET_OBJ_VAL(j, 3), GET_OBJ_VAL(j, 4));
break;
case ITEM_PROGRAM:
if (GET_PROG_TYPE(j) == PROG_ATTACK)
sprintf(buf2, " DamType: %s, ", attack_types[GET_OBJ_VAL(j, 3) - TYPE_HIT]);
else sprintf(buf2, " ");
sprintf(buf, "Type: %s, Rating: %d, Size: %d,%sInstalled?: %s",
program_types[GET_OBJ_VAL(j, 0)], GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2), buf2,
(GET_OBJ_VAL(j, 6) ? "yes" : "no"));
break;
case ITEM_CYBERWARE:
sprintf(buf, "Rating: %d, Essence: %d, Type: %s", GET_OBJ_VAL(j, 0),
GET_OBJ_VAL(j, 1), cyberware_names[GET_OBJ_VAL(j, 2)]);
break;
case ITEM_FOCUS:
if (GET_OBJ_VAL(j, 0) == FOCI_LOCK)
sprintf(buf, "Type: Spell lock, Spell: %s, By: %s", (!GET_OBJ_VAL(j, 8) ? "None" :
spells[GET_OBJ_VAL(j, 8)]), GET_OBJ_VAL(j, 9) > 0 ? get_name_by_id(GET_OBJ_VAL(j, 9)) :
"No one");
else sprintf(buf, "Type: %d, Rating: %d, Spec.: %d, By: %s", GET_OBJ_VAL(j, 0),
GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 8), GET_OBJ_VAL(j, 9) > 0 ?
get_name_by_id(GET_OBJ_VAL(j, 9)) : "No one");
break;
default:
break;
}
send_to_char(buf, ch);
sprintf(buf, "\r\nValues 0-9: [%d] [%d] [%d] [%d] [%d] [%d] [%d] [%d] [%d] [%d]",
GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1),
GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 3), GET_OBJ_VAL(j, 4),
GET_OBJ_VAL(j, 5), GET_OBJ_VAL(j, 6), GET_OBJ_VAL(j, 7),
GET_OBJ_VAL(j, 8), GET_OBJ_VAL(j, 9));
send_to_char(buf, ch);
/*
* I deleted the "equipment status" code from here because it seemed
* more or less useless and just takes up valuable screen space.
*/
if (j->contains) {
strcpy(buf, "\r\nContents:^g");
for (found = 0, j2 = j->contains; j2; j2 = j2->next_content) {
sprintf(buf2, "%s %s", found++ ? "," : "", j2->short_description);
strcat(buf, buf2);
if (strlen(buf) >= 62) {
if (j2->next_content)
send_to_char(strcat(buf, ",\r\n"), ch);
else send_to_char(strcat(buf, "\r\n"), ch);
*buf = found = 0;
}
}
if (*buf)
send_to_char(strcat(buf, "\r\n"), ch);
}
found = 0;
send_to_char("\r\nAffections:", ch);
for (i = 0; i < MAX_OBJ_AFFECT; i++)
if (j->affected[i].modifier) {
sprinttype(j->affected[i].location, apply_types, buf2);
sprintf(buf, "%s %+d to %s", found++ ? "," : "", j->affected[i].modifier, buf2);
send_to_char(buf, ch);
}
if (!found)
send_to_char(" None", ch);
send_to_char("\r\n", ch);
}
void do_stat_character(struct char_data * ch, struct char_data * k)
{
int i, i2, found = 0;
struct obj_data *j;
struct follow_type *fol;
struct affected_type *aff;
extern struct attack_hit_type attack_hit_text[];
if (!access_level(ch, LVL_MANAGER)) {
send_to_char("You're not quite erudite enough to do that!\r\n", ch);
return;
} else if (PLR_FLAGGED(k, PLR_NOSTAT) && !access_level(ch, LVL_PRESIDENT) &&
GET_LEVEL(ch) <= GET_LEVEL(k)) {
send_to_char("Sorry, you can't do that.\r\n", ch);
return;
}
switch (GET_SEX(k)) {
case SEX_NEUTRAL: strcpy(buf, "NEUTRAL-SEX"); break;
case SEX_MALE: strcpy(buf, "MALE"); break;
case SEX_FEMALE: strcpy(buf, "FEMALE"); break;
default: strcpy(buf, "ILLEGAL-SEX!!"); break;
}
sprintf(buf2, " PC '%s' IDNum: [%5ld], In room [%5d]\r\n",
GET_NAME(k), GET_IDNUM(k), world[k->in_room].number);
send_to_char(strcat(buf, buf2), ch);
sprintf(buf, "Title: %s\r\n", (k->player.title ? k->player.title : "<None>"));
send_to_char(buf, ch);
switch (GET_TRADITION(k)) {
case TRAD_ADEPT:
strcpy(buf, "Tradition: Adept");
break;
case TRAD_HERMETIC:
strcpy(buf, "Tradition: Hermetic");
break;
case TRAD_SHAMANIC:
sprinttype(GET_TOTEM(k), totem_types, buf2);
sprintf(buf, "Tradition: Shamanic, Totem: %s", buf2);
break;
case TRAD_MUNDANE:
strcpy(buf, "Tradition: Mundane");
break;
}
strcat(buf, ", Race: ");
sprinttype(k->player.race, pc_race_types, buf2);
strcat(buf, buf2);
if (GET_LEVEL(k) >= LVL_LEGEND)
sprintf(buf2, ", Status: %s\r\n", status_ratings[GET_LEVEL(k)]);
else sprintf(buf2, ", Status: Mortal, Rep: [^y%3d^n], Align: [%4d]\r\n",
GET_REP(k), GET_ALIGNMENT(k));
strcat(buf, buf2);
if (GET_ALLERGY(k) != ALLERGIC_NONE &&
(!PLR_FLAGGED(k, PLR_NEWBIE) || access_level(ch, LVL_PRESIDENT)))
{
sprintf(buf2, "Allergy: %s, Severity: %s\r\n", allergy_names[GET_ALLERGY(k)],
severity_names[GET_SEVERITY(k)]);
strcat(buf, buf2);
}
send_to_char(buf, ch);
strcpy(buf1, (char *) asctime(localtime(&(k->player.time.birth))));
strcpy(buf2, (char *) asctime(localtime(&(k->player.time.logon))));
buf1[10] = buf2[10] = '\0';
sprintf(buf, "Created: [%s], Last Logon: [%s], Played [%dh %dm], Age [%d]\r\n",
buf1, buf2, k->player.time.played / 3600,
((k->player.time.played / 3600) % 60), age(k).year);
send_to_char(buf, ch);
sprintf(buf, "Last room: [%d], Start room: [%d], Speaking: [%d]\r\n",
k->player.last_room, GET_LOADROOM(k), GET_LANGUAGE(k));
send_to_char(buf, ch);
if (GET_LEVEL(k) < LVL_LEGEND && GET_QUEST(k) != 0) {
sprintf(buf, "Quest: [%d], Time: [%d]\r\n", GET_QUEST(k), GET_QTIMELEFT(k));
if (access_level(ch, LVL_PRESIDENT) && k->desc)
send_to_char(buf, ch);
}
sprintf(buf, "Bod: [^c%d^n] Qui: [^c%d^n] Str: [^c%d^n] Cha: [^c%d^n] Int: [^c%d^n]"
" Wil: [^c%d^n] Mag: [^c%0.2f^n]\r\nRea: [^c%d^n] Ess: [^c%0.2f^n] Ast[^c%d^n] Com[^c%d^n] Mag[^c%d^n] Hak[^c%d^n] Def/Off[^c%d/%d^n]\r\n",
GET_BOD(k), GET_QUI(k), GET_STR(k), GET_CHA(k), GET_INT(k),
GET_WIL(k), ((float)GET_MAG(k) / 100), GET_REA(k), ((float)GET_ESS(k) / 100), GET_ASTRAL(k),
GET_COMBAT(k), GET_MAGIC(k), GET_HACKING(k), GET_DEFENSE(k), GET_OFFENSE(k));
send_to_char(buf, ch);
sprintf(buf, "Physical p.:[^G%d/%d^n] Mental p.:[^G%d/%d^n] Body Index:[^c%0.2f^n]\r\n",
(int)(GET_PHYSICAL(k) / 100), (int)(GET_MAX_PHYSICAL(k) / 100),
(int)(GET_MENTAL(k) / 100), (int)(GET_MAX_MENTAL(k) / 100),
((float)GET_INDEX(k) / 100));
send_to_char(buf, ch);
sprintf(buf, "Nuyen: [%9d], Bank: [%9d] (Total: %d), Karma: [%0.2f]\r\n",
GET_NUYEN(k), GET_BANK(k), GET_NUYEN(k) + GET_BANK(k),
((float)GET_KARMA(k) / 100));
send_to_char(buf, ch);
sprintf(buf, "B: %d, I: %d, I-Dice: %d, I-Roll: %d, Sus: %d, Foci: %d, TargMod: %d\r\n",
GET_BALLISTIC(k), GET_IMPACT(k), GET_INIT_DICE(k), GET_INIT_ROLL(k),
GET_SUSTAINED(k), GET_FOCI(k), GET_TARGET_MOD(k));
send_to_char(buf, ch);
sprinttype(GET_POS(k), position_types, buf2);
sprintf(buf, "Current Zone: %d, Pos: %s, Fighting: %s",
k->player_specials->saved.zonenum, buf2,
(FIGHTING(k) ? GET_NAME(FIGHTING(k)) : "Nobody"));
if (k->desc) {
sprinttype(k->desc->connected, connected_types, buf2);
strcat(buf, ", Connected: ");
strcat(buf, buf2);
}
send_to_char(strcat(buf, "\r\n"), ch);
strcpy(buf, "Default position: ");
sprinttype((k->mob_specials.default_pos), position_types, buf2);
strcat(buf, buf2);
sprintf(buf2, ", Idle Timer: [%d]\r\n", k->char_specials.timer);
strcat(buf, buf2);
send_to_char(buf, ch);
sprintbit(PLR_FLAGS(k), player_bits, buf2);
sprintf(buf, "PLR: ^c%s\r\n", buf2);
send_to_char(buf, ch);
sprintbit(PRF_FLAGS(k), preference_bits, buf2);
sprintf(buf, "PRF: ^g%s\r\n", buf2);
send_to_char(buf, ch);
sprintf(buf, "Height: %d cm, Weight: %d kg\n", GET_HEIGHT(k), GET_WEIGHT(k));
send_to_char(buf, ch);
sprintf(buf, "Carried: weight: %d, items: %d; ",
IS_CARRYING_W(k), IS_CARRYING_N(k));
for (i = 0, j = k->carrying; j; j = j->next_content, i++);
sprintf(buf, "%sItems in: inventory: %d, ", buf, i);
for (i = 0, i2 = 0; i < NUM_WEARS; i++)
if (k->equipment[i])
i2++;
sprintf(buf2, "eq: %d\r\n", i2);
strcat(buf, buf2);
send_to_char(buf, ch);
sprintf(buf, "Hunger: %d, Thirst: %d, Drunk: %d\r\n",
GET_COND(k, FULL), GET_COND(k, THIRST), GET_COND(k, DRUNK));
send_to_char(buf, ch);
sprintf(buf, "Master is: %s, Followers are:",
((k->master) ? GET_NAME(k->master) : "<none>"));
for (fol = k->followers; fol; fol = fol->next) {
sprintf(buf2, "%s %s", found++ ? "," : "", PERS(fol->follower, ch));
strcat(buf, buf2);
if (strlen(buf) >= 62) {
if (fol->next)
send_to_char(strcat(buf, ",\r\n"), ch);
else
send_to_char(strcat(buf, "\r\n"), ch);
*buf = found = 0;
}
}
if (*buf)
send_to_char(strcat(buf, "\r\n"), ch);
/* Showing the bitvector */
sprintbit(AFF_FLAGS(k), affected_bits, buf2);
sprintf(buf, "AFF: ^y%s\r\n", buf2);
send_to_char(buf, ch);
/* Routine to show what spells a char is affected by */
if (k->affected) {
for (aff = k->affected; aff; aff = aff->next) {
*buf2 = '\0';
sprintf(buf, "SPL: (%s - %ld) ^c%-21s ", (aff->caster ? "Cast" : "Sust"),
aff->sustained_by, spells[aff->type]);
if (aff->modifier) {
sprintf(buf2, "%+d to %s", aff->modifier, apply_types[(int) aff->location]);
strcat(buf, buf2);
}
if (aff->bitvector) {
if (*buf2)
strcat(buf, ", sets ");
else
strcat(buf, "sets ");
sprintbit(aff->bitvector, affected_bits, buf2);
strcat(buf, buf2);
}
send_to_char(strcat(buf, "\r\n"), ch);
}
}
}
void do_stat_mobile(struct char_data * ch, struct char_data * k)
{
if (MOB_FLAGGED(k, MOB_PRIVATE) && !access_level(ch, LVL_PRESIDENT)) {
send_to_char("You can't.\r\n", ch);
return;
}
int i, i2, found = 0, base;
struct obj_data *j;
struct follow_type *fol;
struct affected_type *aff;
extern struct attack_hit_type attack_hit_text[];
extern int calc_karma(struct char_data *ch, struct char_data *vict);
switch (GET_SEX(k)) {
case SEX_NEUTRAL: strcpy(buf, "NEUTRAL-SEX"); break;
case SEX_MALE: strcpy(buf, "MALE"); break;
case SEX_FEMALE: strcpy(buf, "FEMALE"); break;
default: strcpy(buf, "ILLEGAL-SEX!!"); break;
}
sprintf(buf2, " %s '%s', In room [%5d]\r\n", (!IS_MOB(k) ? "NPC" : "MOB"),
GET_NAME(k), world[k->in_room].number);
send_to_char(strcat(buf, buf2), ch);
sprintf(buf, "Alias: %s, VNum: [%5d], RNum: [%5d]\r\n", k->player.name,
GET_MOB_VNUM(k), GET_MOB_RNUM(k));
send_to_char(buf, ch);
sprintf(buf, "L-Des: %s", (k->player.long_descr ? k->player.long_descr : "<None>\r\n"));
send_to_char(buf, ch);
strcpy(buf, "Class: ");
sprinttype(GET_RACE(k), npc_classes, buf2);
strcat(buf, buf2);
sprintf(buf2, ", Lev: [^y%d^n], Align: [%4d]\r\n", GET_LEVEL(k), GET_ALIGNMENT(k));
strcat(buf, buf2);
send_to_char(buf, ch);
sprintf(buf, "Bod: [^c%d^n] Qui: [^c%d^n] Str: [^c%d^n] Cha: [^c%d^n] Int: [^c%d^n]"
" Wil: [^c%d^n] Mag: [^c%d^n]\r\nRea: [^c%d^n] Ess: [^c%0.2f^n] Ast[^c%d^n] Com[^c%d^n] Mag[^c%d^n] Hak[^c%d^n] Def/Off[^c%d/%d^n]\r\n",
GET_BOD(k), GET_QUI(k), GET_STR(k), GET_CHA(k), GET_INT(k),
GET_WIL(k), GET_MAG(k) / 100, GET_REA(k), ((float)GET_ESS(k) / 100), GET_ASTRAL(k),
GET_COMBAT(k), GET_MAGIC(k), GET_HACKING(k), GET_DEFENSE(k), GET_OFFENSE(k));
send_to_char(buf, ch);
sprintf(buf, "Physical p.:[^G%d/%d^n] Mental p.:[^G%d/%d^n]\r\n",
(int)(GET_PHYSICAL(k) / 100), (int)(GET_MAX_PHYSICAL(k) / 100),
(int)(GET_MENTAL(k) / 100), (int)(GET_MAX_MENTAL(k) / 100));
send_to_char(buf, ch);
base = calc_karma(NULL, k);
sprintf(buf, "Nuyen: [%5d], Credstick: [%5d], Bonus karma: [%4d], Total karma: [%4d]\r\n",
GET_NUYEN(k), GET_BANK(k), GET_KARMA(k), GET_KARMA(k) + base);
send_to_char(buf, ch);
sprintf(buf, "B: %d, I: %d, I-Dice: %d, I-Roll: %d, Sus: %d, TargMod: %d\r\n",
GET_BALLISTIC(k), GET_IMPACT(k), GET_INIT_DICE(k), GET_INIT_ROLL(k),
GET_SUSTAINED(k), GET_TARGET_MOD(k));
send_to_char(buf, ch);
sprinttype(GET_POS(k), position_types, buf2);
sprintf(buf, "Position: %s, Fighting: %s", buf2,
(FIGHTING(k) ? GET_NAME(FIGHTING(k)) : "Nobody"));
strcat(buf, ", Attack type: ");
// gotta subtract TYPE_HIT for the array to work properly
strcat(buf, attack_hit_text[k->mob_specials.attack_type - TYPE_HIT].singular);
send_to_char(strcat(buf, "\r\n"), ch);
strcpy(buf, "Default position: ");
sprinttype((k->mob_specials.default_pos), position_types, buf2);
strcat(buf, buf2);
sprintf(buf2, " Mob Spec-Proc: ");
strcat(buf, buf2);
if(mob_index[GET_MOB_RNUM(k)].func)
{
int index;
for (index = 0; index < top_of_shopt; index++)
if (GET_MOB_VNUM(k) == SHOP_KEEPER(index))
break;
if (index < top_of_shopt)
sprintf(buf2, "%s : Shop %d\r\n", "^CExists^n", SHOP_NUM(index));
else
sprintf(buf2, "%s\r\n", "^CExists^n");
}
else
sprintf(buf2, "None\r\n");
strcat(buf, buf2);
send_to_char(buf, ch);
sprintbit(MOB_FLAGS(k), action_bits, buf2);
sprintf(buf, "NPC flags: ^c%s\r\n", buf2);
send_to_char(buf, ch);
sprintf(buf, "Height: %d cm, Weight: %d kg\n", GET_HEIGHT(k), GET_WEIGHT(k));
send_to_char(buf, ch);
sprintf(buf, "Carried: weight: %d, items: %d; ",
IS_CARRYING_W(k), IS_CARRYING_N(k));
for (i = 0, j = k->carrying; j; j = j->next_content, i++);
sprintf(buf, "%sItems in: inventory: %d, ", buf, i);
for (i = 0, i2 = 0; i < NUM_WEARS; i++)
if (k->equipment[i])
i2++;
sprintf(buf2, "eq: %d\r\n", i2);
strcat(buf, buf2);
send_to_char(buf, ch);
sprintf(buf, "Active: %d, Storage: %d, Load: %d, IO: %d\r\n", GET_ACTIVE(k),
GET_STORAGE(k), GET_LOAD_SPEED(k), GET_IO_SPEED(k));
send_to_char(buf, ch);
sprintf(buf, "Master is: %s, Followers are:",
((k->master) ? GET_NAME(k->master) : "<none>"));
for (fol = k->followers; fol; fol = fol->next) {
sprintf(buf2, "%s %s", found++ ? "," : "", PERS(fol->follower, ch));
strcat(buf, buf2);
if (strlen(buf) >= 62) {
if (fol->next)
send_to_char(strcat(buf, ",\r\n"), ch);
else
send_to_char(strcat(buf, "\r\n"), ch);
*buf = found = 0;
}
}
if (*buf)
send_to_char(strcat(buf, "\r\n"), ch);
/* Showing the bitvector */
sprintbit(AFF_FLAGS(k), affected_bits, buf2);
sprintf(buf, "AFF: ^y%s\r\n", buf2);
send_to_char(buf, ch);
/* Routine to show what spells a char is affected by */
if (k->affected) {
for (aff = k->affected; aff; aff = aff->next) {
*buf2 = '\0';
sprintf(buf, "SPL: (%s - %ld) ^c%-21s ", (aff->caster ? "Cast" : "Sust"),
aff->sustained_by, spells[aff->type]);
if (aff->modifier) {
sprintf(buf2, "%+d to %s", aff->modifier, apply_types[(int) aff->location]);
strcat(buf, buf2);
}
if (aff->bitvector) {
if (*buf2)
strcat(buf, ", sets ");
else
strcat(buf, "sets ");
sprintbit(aff->bitvector, affected_bits, buf2);
strcat(buf, buf2);
}
send_to_char(strcat(buf, "\r\n"), ch);
}
}
}
ACMD(do_stat)
{
struct char_data *victim = NULL;
struct obj_data *object = NULL;
struct char_file_u tmp_store;
int tmp;
half_chop(argument, buf1, buf2);
if (!*buf1) {
send_to_char("Stats on who or what?\r\n", ch);
return;
} else if (is_abbrev(buf1, "room")) {
do_stat_room(ch);
} else if (is_abbrev(buf1, "mob")) {
if (!*buf2)
send_to_char("Stats on which mobile?\r\n", ch);
else {
if ((victim = get_char_vis(ch, buf2)) && !IS_NPC(victim))
do_stat_mobile(ch, victim);
else send_to_char("No such mobile around.\r\n", ch);
}
} else if (is_abbrev(buf1, "player")) {
if (!*buf2) {
send_to_char("Stats on which player?\r\n", ch);
} else {
if ((victim = get_player_vis(ch, buf2, 0)))
do_stat_character(ch, victim);
else send_to_char("No such player around.\r\n", ch);
}
} else if (is_abbrev(buf1, "file")) {
if (!*buf2)
send_to_char("Stats on which player?\r\n", ch);
else {
if (load_char(buf2, &tmp_store) > -1) {
victim = new char_data;
clear_char(victim);
store_to_char(&tmp_store, victim);
do_stat_character(ch, victim);
free_char(victim);
delete victim;
} else {
send_to_char("There is no such player.\r\n", ch);
}
}
} else if (is_abbrev(buf1, "object")) {
if (!*buf2)
send_to_char("Stats on which object?\r\n", ch);
else {
if ((object = get_obj_vis(ch, buf2)))
do_stat_object(ch, object);
else send_to_char("No such object around.\r\n", ch);
}
} else {
if ((object = get_object_in_equip_vis(ch, buf1, ch->equipment, &tmp)))
do_stat_object(ch, object);
else if ((object = get_obj_in_list_vis(ch, buf1, ch->carrying)))
do_stat_object(ch, object);
else if ((victim = get_char_room_vis(ch, buf1)))
if (IS_NPC(victim))
do_stat_mobile(ch, victim);
else do_stat_character(ch, victim);
else if ((object = get_obj_in_list_vis(ch, buf1, world[ch->in_room].contents)))
do_stat_object(ch, object);
else if ((victim = get_char_vis(ch, buf1)))
if (IS_NPC(victim))
do_stat_mobile(ch, victim);
else do_stat_character(ch, victim);
else if ((object = get_obj_vis(ch, buf1)))
do_stat_object(ch, object);
else
send_to_char("Nothing around by that name.\r\n", ch);
}
}
ACMD(do_shutdown)
{
extern int circle_shutdown, circle_reboot;
ACMD(do_not_here);
if (IS_NPC(ch) || !access_level(ch, LVL_PRESIDENT)) {
do_not_here(ch, "", 0, 0);
return;
}
if (subcmd != SCMD_SHUTDOWN) {
send_to_char("If you want to shut something down, say so!\r\n", ch);
return;
}
one_argument(argument, arg);
if (!*arg) {
sprintf(buf, "Shutdown by %s.", GET_NAME(ch));
log(buf);
send_to_all("Shutting down.\r\n");
circle_shutdown = 1;
} else if (!str_cmp(arg, "reboot")) {
sprintf(buf, "Reboot by %s.", GET_NAME(ch));
log(buf);
send_to_all("Rebooting.. come back in a minute or two.\r\n");
touch("../.fastboot");
circle_shutdown = circle_reboot = 1;
} else if (!str_cmp(arg, "die")) {
sprintf(buf, "Shutdown by %s.", GET_NAME(ch));
log(buf);
send_to_all("Shutting down for maintenance.\r\n");
touch("../.killscript");
circle_shutdown = 1;
} else if (!str_cmp(arg, "pause")) {
sprintf(buf, "Shutdown by %s.", GET_NAME(ch));
log(buf);
send_to_all("Shutting down for maintenance.\r\n");
touch("../pause");
circle_shutdown = 1;
} else
send_to_char("Unknown shutdown option.\r\n", ch);
Crash_save_all();
House_save_all();
}
void stop_snooping(struct char_data * ch)
{
char buf[100]; /* wizlog buffer */
if (!ch->desc->snooping)
send_to_char("You aren't snooping anyone.\r\n", ch);
else {
send_to_char("You stop snooping.\r\n", ch);
if ( ch->desc->snooping->original )
sprintf(buf,"%s stops snooping %s.",GET_NAME(ch),GET_NAME((ch->desc->snooping->original)));
else
sprintf(buf,"%s stops snooping %s.",GET_NAME(ch),GET_NAME((ch->desc->snooping->character)));
ch->desc->snooping->snoop_by = NULL;
ch->desc->snooping = NULL;
mudlog(buf, ch, LOG_WIZLOG, FALSE);
}
}
ACMD(do_snoop)
{
struct char_data *victim, *tch;
char buf[100]; /* wizlog buffer */
if (!ch->desc)
return;
one_argument(argument, arg);
if (!*arg)
stop_snooping(ch);
else if (!(victim = get_char_vis(ch, arg)))
send_to_char("No such person around.\r\n", ch);
else if (!victim->desc)
send_to_char("There's no link.. nothing to snoop.\r\n", ch);
else if (victim == ch)
stop_snooping(ch);
else if (victim->desc->snoop_by)
send_to_char("Busy already. \r\n", ch);
else if (victim->desc->snooping == ch->desc)
send_to_char("Don't be stupid.\r\n", ch);
else if ( IS_SET(PLR_FLAGS(victim), PLR_NOSNOOP) )
send_to_char("You can't snoop an unsnoopable person.\n\r",ch);
else {
if (victim->desc->original)
tch = victim->desc->original;
else
tch = victim;
if (GET_LEVEL(tch) >= GET_LEVEL(ch)) {
send_to_char("You can't.\r\n", ch);
return;
}
send_to_char(OK, ch);
if (ch->desc->snooping)
ch->desc->snooping->snoop_by = NULL;
ch->desc->snooping = victim->desc;
victim->desc->snoop_by = ch->desc;
sprintf(buf,"%s now being snooped by %s.",GET_NAME(victim),GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, FALSE);
}
}
ACMD(do_switch)
{
struct char_data *victim;
one_argument(argument, arg);
if (ch->desc->original)
send_to_char("You're already switched.\r\n", ch);
else if (!*arg)
send_to_char("Switch with who?\r\n", ch);
else if (!(victim = get_char_vis(ch, arg)))
send_to_char("No such character.\r\n", ch);
else if (ch == victim)
send_to_char("Hee hee... we are jolly funny today, eh?\r\n", ch);
else if (victim->desc)
send_to_char("You can't do that, the body is already in use!\r\n", ch);
else if ((!access_level(ch, LVL_PRESIDENT)) && !IS_NPC(victim))
send_to_char("You aren't holy enough to use a mortal's body.\r\n", ch);
else {
send_to_char(OK, ch);
SET_BIT(PLR_FLAGS(ch), PLR_SWITCHED);
ch->desc->character = victim;
ch->desc->original = ch;
victim->desc = ch->desc;
ch->desc = NULL;
}
}
ACMD(do_return)
{
struct char_data *vict;
if (IS_PERSONA(ch))
return;
if (ch->desc && ch->desc->original) {
send_to_char("You return to your original body.\r\n", ch);
if (PLR_FLAGGED(ch->desc->original, PLR_MATRIX))
REMOVE_BIT(PLR_FLAGS(ch->desc->original), PLR_MATRIX);
if (PLR_FLAGGED(ch->desc->original, PLR_PROJECT))
REMOVE_BIT(PLR_FLAGS(ch->desc->original), PLR_PROJECT);
if (PLR_FLAGGED(ch->desc->original, PLR_SWITCHED))
REMOVE_BIT(PLR_FLAGS(ch->desc->original), PLR_SWITCHED);
/* JE 2/22/95 */
/* if someone switched into your original body, disconnect them */
if (ch->desc->original->desc)
close_socket(ch->desc->original->desc);
vict = ch;
ch->desc->character = ch->desc->original;
ch->desc->original = NULL;
ch->desc->character->desc = ch->desc;
ch->desc = NULL;
if (IS_NPC(vict) && GET_MOB_VNUM(vict) >= 50 && GET_MOB_VNUM(vict) < 70 &&
PLR_FLAGGED(ch, PLR_PROJECT)) {
extract_char(vict);
char_from_room(ch);
char_to_room(ch, GET_WAS_IN(ch));
GET_WAS_IN(ch) = NOWHERE;
}
}
}
ACMD(do_iload)
{
struct obj_data *obj;
int number, r_num, counter, i;
bool found = FALSE;
one_argument(argument, buf2);
if (!PLR_FLAGGED(ch, PLR_OLC)) {
send_to_char("Privileged operation.\r\n", ch);
return;
}
if (!*buf2 || !isdigit(*buf2)) {
send_to_char("Usage: iload <number>\r\n", ch);
return;
}
if ((number = atoi(buf2)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
if (obj_proto[r_num].obj_flags.type_flag == ITEM_MONEY) {
send_to_char("You can't iload credsticks!\r\n", ch);
return;
}
for (counter = 0; counter <= top_of_zone_table; counter++)
if ((number >= (zone_table[counter].number * 100)) && (number <= (zone_table[counter].top))) {
found = TRUE;
break;
}
if (!found) {
send_to_char ("Sorry, that number is not part of any zone!\r\n", ch);
return;
}
for (i = 0; i < 5; i++)
if (zone_table[counter].editor_ids[i] == GET_IDNUM(ch))
break;
if ((i >= 5) && (!access_level(ch, LVL_PRESIDENT))) {
send_to_char("Sorry, you don't have access to edit this zone.\r\n", ch);
return;
}
obj = read_object(r_num, REAL);
obj_to_char(obj, ch);
GET_OBJ_TIMER(obj) = 2;
SET_BIT(obj->obj_flags.extra_flags, ITEM_IMMLOAD);
act("$n makes a strange magical gesture.", TRUE, ch, 0, 0, TO_ROOM);
act("$n has created $p!", FALSE, ch, obj, 0, TO_ROOM);
act("You create $p.", FALSE, ch, obj, 0, TO_CHAR);
}
ACMD(do_wizload)
{
struct char_data *mob;
struct obj_data *obj;
int number, r_num;
two_arguments(argument, buf, buf2);
if (!*buf || !*buf2 || !isdigit(*buf2)) {
send_to_char("Usage: load { obj | mob } <number>\r\n", ch);
return;
}
if ((number = atoi(buf2)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if (is_abbrev(buf, "mob")) {
if ((r_num = real_mobile(number)) < 0) {
send_to_char("There is no monster with that number.\r\n", ch);
return;
}
mob = read_mobile(r_num, REAL);
char_to_room(mob, ch->in_room);
act("$n makes a quaint, magical gesture with one hand.", TRUE, ch,
0, 0, TO_ROOM);
act("$n has created $N!", FALSE, ch, 0, mob, TO_ROOM);
act("You create $N.", FALSE, ch, 0, mob, TO_CHAR);
} else if (is_abbrev(buf, "obj")) {
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
/* if ((number == 1203) && (!access_level(ch, LVL_OWNER))) {
send_to_char("You better ask Flynn to load that!\r\n", ch);
return;
}
if ((number == 1204) && (!access_level(ch, LVL_OWNER))) {
send_to_char("You better ask FlyGuy to load that!\r\n", ch);
return;
} */
obj = read_object(r_num, REAL);
obj_to_char(obj, ch);
act("$n makes a strange magical gesture.", TRUE, ch, 0, 0, TO_ROOM);
act("$n has created $p!", FALSE, ch, obj, 0, TO_ROOM);
act("You create $p.", FALSE, ch, obj, 0, TO_CHAR);
} else
send_to_char("That'll have to be either 'obj' or 'mob'.\r\n", ch);
}
ACMD(do_vstat)
{
struct char_data *mob;
struct obj_data *obj;
int number, r_num;
two_arguments(argument, buf, buf2);
if (!*buf || !*buf2 || !isdigit(*buf2)) {
send_to_char("Usage: vstat { obj | mob | qst | shp} <number>\r\n", ch);
return;
}
if ((number = atoi(buf2)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if (is_abbrev(buf, "mob")) {
if ((r_num = real_mobile(number)) < 0) {
send_to_char("There is no monster with that number.\r\n", ch);
return;
}
mob = read_mobile(r_num, REAL);
char_to_room(mob, 0);
do_stat_mobile(ch, mob);
extract_char(mob);
} else if (is_abbrev(buf, "obj")) {
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
obj = read_object(r_num, REAL);
do_stat_object(ch, obj);
extract_obj(obj);
} else if (is_abbrev(buf, "qst")) {
if ((r_num = real_quest(number)) < 0) {
send_to_char("There is no quest with that number.\r\n", ch);
return;
}
list_detailed_quest(ch, r_num);
} else if (is_abbrev(buf, "shp")) {
if ((r_num = real_shop(number)) < 0) {
send_to_char("There is no shop with that number.\r\n", ch);
return;
}
list_detailed_shop(ch, r_num);
} else send_to_char("That'll have to be either 'mob', 'obj', 'qst', or 'shp'.\r\n", ch);
}
/* clean a room of all mobiles and objects */
ACMD(do_purge)
{
struct char_data *vict, *next_v;
struct obj_data *obj, *next_o;
extern void die_follower(struct char_data * ch);
if ((GET_LEVEL(ch) < LVL_MANAGER) && (ch->player_specials->saved.zonenum !=
zone_table[world[ch->in_room].zone].number)) {
send_to_char("You can only purge in your zone.\r\n", ch);
return;
}
one_argument(argument, buf);
if (*buf) { /* argument supplied. destroy single object
* or char */
if ((vict = get_char_room_vis(ch, buf))) {
if (!IS_NPC(vict) && ((GET_LEVEL(ch) <= GET_LEVEL(vict)) || (!access_level(ch, LVL_PRESIDENT)))) {
send_to_char("Fuuuuuuuuu!\r\n", ch);
return;
}
act("$n disintegrates $N.", FALSE, ch, 0, vict, TO_NOTVICT);
if (!IS_NPC(vict)) {
sprintf(buf, "%s has purged %s.", GET_NAME(ch), GET_NAME(vict));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
if (vict->desc) {
close_socket(vict->desc);
vict->desc = NULL;
}
}
extract_char(vict);
} else if ((obj = get_obj_in_list_vis(ch, buf, world[ch->in_room].contents))) {
act("$n destroys $p.", FALSE, ch, obj, 0, TO_ROOM);
extract_obj(obj);
} else {
send_to_char("Nothing here by that name.\r\n", ch);
return;
}
send_to_char(OK, ch);
} else { /* no argument. clean out the room */
act("$n gestures... You are surrounded by scorching flames!",
FALSE, ch, 0, 0, TO_ROOM);
send_to_room("The world seems a little cleaner.\r\n", ch->in_room);
for (vict = world[ch->in_room].people; vict; vict = next_v) {
next_v = vict->next_in_room;
if (IS_PERSONA(vict)) {
REMOVE_BIT(PLR_FLAGS(vict->desc->original), PLR_MATRIX);
do_return(vict, "", 0, 0);
}
if (IS_NPC(vict))
extract_char(vict);
}
for (obj = world[ch->in_room].contents; obj; obj = next_o) {
next_o = obj->next_content;
extract_obj(obj);
}
}
}
ACMD(do_advance)
{
struct char_data *victim;
struct obj_data *obj, *cyber;
char *name = arg, *level = buf2;
int newlevel, i;
void do_start(struct char_data *ch);
extern void check_autowiz(struct char_data * ch);
int gain_exp(struct char_data * ch, int gain);
two_arguments(argument, name, level);
if (*name) {
if (!(victim = get_char_vis(ch, name))) {
send_to_char("That player is not here.\r\n", ch);
return;
}
} else {
send_to_char("Advance who?\r\n", ch);
return;
}
if (GET_LEVEL(ch) <= GET_LEVEL(victim)) {
send_to_char("Maybe that's not such a great idea.\r\n", ch);
return;
}
if (IS_NPC(victim)) {
send_to_char("NO! Not on NPC's.\r\n", ch);
return;
}
if (!*level || (newlevel = atoi(level)) <= 0) {
send_to_char("That's not a level!\r\n", ch);
return;
}
if (newlevel > LVL_OWNER) {
sprintf(buf, "%d is the highest possible level.\r\n", LVL_OWNER);
send_to_char(buf, ch);
return;
}
if (newlevel > GET_LEVEL(ch)) {
send_to_char("Yeah, right.\r\n", ch);
return;
}
if (newlevel < GET_LEVEL(victim)) {
do_start(victim);
GET_LEVEL(victim) = newlevel;
} else {
act("$n makes some strange gestures.\r\n"
"A strange feeling comes upon you,\r\n"
"Like a giant hand, light comes down\r\n"
"from above, grabbing your body, that\r\n"
"begins to pulse with colored lights\r\n"
"from inside.\r\n\r\n"
"Your head seems to be filled with demons\r\n"
"from another plane as your body dissolves\r\n"
"to the elements of time and space itself.\r\n"
"Suddenly a silent explosion of light\r\n"
"snaps you back to reality.\r\n\r\n"
"You feel slightly different.", FALSE, ch, 0, victim, TO_VICT);
}
send_to_char(OK, ch);
sprintf(buf, "%s has advanced %s to %s (from %s)",
GET_NAME(ch), GET_NAME(victim), status_ratings[newlevel],
status_ratings[GET_LEVEL(victim)]);
GET_LEVEL(victim) = newlevel;
check_autowiz(victim);
if (GET_LEVEL(victim) >= LVL_LEGEND) {
for (i = 0; i < 3; i++)
GET_COND(victim, i) = (char) -1;
GET_KARMA(victim) = 0;
GET_REP(victim) = 0;
if (IS_SET(PLR_FLAGS(victim), PLR_NEWBIE)) {
REMOVE_BIT(PLR_FLAGS(victim), PLR_NEWBIE);
for (cyber = ch->cyberware; cyber; cyber = cyber->next_content)
if (IS_OBJ_STAT(cyber, ITEM_STARTER))
REMOVE_BIT(GET_OBJ_EXTRA(cyber), ITEM_STARTER);
for (obj = ch->carrying; obj; obj = obj->next_content) {
for (cyber = obj->contains; cyber; cyber = cyber->next_content)
if (IS_OBJ_STAT(cyber, ITEM_STARTER))
REMOVE_BIT(GET_OBJ_EXTRA(cyber), ITEM_STARTER);
if (IS_OBJ_STAT(obj, ITEM_STARTER))
REMOVE_BIT(GET_OBJ_EXTRA(obj), ITEM_STARTER);
}
for (i = 0; i < (NUM_WEARS - 1); i++)
if (GET_EQ(ch, i)) {
for (obj = GET_EQ(ch, i)->contains; obj; obj = obj->next_content)
if (IS_OBJ_STAT(obj, ITEM_STARTER))
REMOVE_BIT(GET_OBJ_EXTRA(obj), ITEM_STARTER);
if (IS_OBJ_STAT(GET_EQ(ch, i), ITEM_STARTER))
REMOVE_BIT(GET_OBJ_EXTRA(GET_EQ(ch, i)), ITEM_STARTER);
}
}
SET_BIT(PRF_FLAGS(victim), PRF_HOLYLIGHT);
SET_BIT(PRF_FLAGS(victim), PRF_CONNLOG);
SET_BIT(PRF_FLAGS(victim), PRF_ROOMFLAGS);
SET_BIT(PRF_FLAGS(victim), PRF_NOHASSLE);
SET_BIT(PRF_FLAGS(victim), PRF_AUTOINVIS);
}
mudlog(buf, ch, LOG_WIZLOG, TRUE);
save_char(victim, NOWHERE);
}
ACMD(do_restore)
{
struct char_data *vict;
int i, val;
extern spell_a grimoire[];
one_argument(argument, buf);
if (!*buf)
send_to_char("Whom do you wish to restore?\r\n", ch);
else if (!(vict = get_char_vis(ch, buf)))
send_to_char(NOPERSON, ch);
else {
GET_PHYSICAL(vict) = GET_MAX_PHYSICAL(vict);
GET_MENTAL(vict) = GET_MAX_MENTAL(vict);
if ((access_level(ch, LVL_PRESIDENT)) && (GET_LEVEL(vict) >= LVL_LEGEND) && !IS_NPC(vict)) {
for (i = SKILL_STEALTH; i <= SKILL_BACKSTAB; i++)
SET_SKILL(vict, i, 100);
for (i = SKILL_CLIMBING; i <= SKILL_RESISTANCE; i++) {
val = 100;
if (i > SKILL_CLIMBING) {
if (GET_TRADITION(vict) == TRAD_ADEPT)
val = max_ability(i);
else val = 0;
}
SET_SKILL(vict, i, val);
}
if (GET_LEVEL(vict) >= LVL_LEGEND && GET_LEVEL(vict) < LVL_MANAGER) {
vict->real_abils.intel = 15;
vict->real_abils.wil = 15;
vict->real_abils.qui = 15;
vict->real_abils.str = 15;
vict->real_abils.bod = 15;
vict->real_abils.cha = 15;
vict->real_abils.ess = 600;
vict->real_abils.mag = 1500;
vict->real_abils.rea = 15;
} else if (GET_LEVEL(vict) >= LVL_MANAGER) {
vict->real_abils.intel = 50;
vict->real_abils.wil = 50;
vict->real_abils.qui = 50;
vict->real_abils.str = 50;
vict->real_abils.bod = 50;
vict->real_abils.cha = 50;
vict->real_abils.ess = 600;
vict->real_abils.mag = 5000;
vict->real_abils.rea = 50;
}
affect_total(vict);
}
update_pos(vict);
send_to_char(OK, ch);
act("You have been fully healed by $N!", FALSE, vict, 0, ch, TO_CHAR);
}
}
void perform_immort_vis(struct char_data *ch)
{
void appear(struct char_data *ch);
if (GET_INVIS_LEV(ch) == 0 && !IS_AFFECTED(ch, AFF_HIDE) &&
!IS_AFFECTED(ch, AFF_INVISIBLE)) {
send_to_char("You are already fully visible.\r\n", ch);
return;
}
GET_INVIS_LEV(ch) = 0;
appear(ch);
send_to_char("You are now fully visible.\r\n", ch);
}
void perform_immort_invis(struct char_data *ch, int level)
{
struct char_data *tch;
if (STATE(ch->desc) == CON_PLAYING) {
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch == ch)
continue;
if (GET_LEVEL(tch) >= GET_INVIS_LEV(ch) && GET_LEVEL(tch) < level)
act("You blink and suddenly realize that $n is gone.",
FALSE, ch, 0, tch, TO_VICT);
if (GET_LEVEL(tch) < GET_INVIS_LEV(ch) && GET_LEVEL(tch) >= level)
act("You suddenly realize that $n is standing beside you.",
FALSE, ch, 0, tch, TO_VICT);
}
sprintf(buf, "Your invisibility level is %d.\r\n", level);
send_to_char(buf, ch);
}
GET_INVIS_LEV(ch) = level;
}
ACMD(do_invis)
{
int level;
if (IS_NPC(ch)) {
send_to_char("You can't do that!\r\n", ch);
return;
}
one_argument(argument, arg);
if (!*arg) {
if (GET_INVIS_LEV(ch) > 0)
perform_immort_vis(ch);
else perform_immort_invis(ch, GET_LEVEL(ch));
} else {
level = atoi(arg);
if (level > GET_LEVEL(ch))
send_to_char("You can't go invisible above your own level.\r\n", ch);
else if (level < 1)
perform_immort_vis(ch);
else perform_immort_invis(ch, level);
}
}
ACMD(do_poofset)
{
char **msg;
switch (subcmd) {
case SCMD_POOFIN: msg = &(POOFIN(ch)); break;
case SCMD_POOFOUT: msg = &(POOFOUT(ch)); break;
default: return; break;
}
skip_spaces(&argument);
if (!*argument) {
if (subcmd == SCMD_POOFIN)
sprintf(buf, "Your current poofin is: ^m%s^n\r\n", POOFIN(ch));
else sprintf(buf, "Your current poofout is: ^m%s^n\r\n", POOFOUT(ch));
send_to_char(buf, ch);
return;
} else if (strlen(argument) >= LINE_LENGTH) {
send_to_char(ch, "Line too long (max %d characters); function aborted.\r\n",
LINE_LENGTH - 1);
return;
}
if (*msg)
delete [] *msg;
*msg = str_dup(argument);
send_to_char(OK, ch);
}
ACMD(do_dc)
{
struct descriptor_data *d;
struct char_data *vict;
one_argument(argument, arg);
if (atoi(arg)) {
send_to_char("Usage: dc <name>\r\n"" dc *\r\n", ch);
return;
}
if (*arg == '*') {
send_to_char("All non-playing connections closed.\r\n", ch);
sprintf(buf, "Non-playing connections closed by %s.", GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, FALSE);
for (d = descriptor_list; d; d = d->next)
if ((d->connected > 0 && d->connected < CON_SPELL_CREATE) || d->connected > CON_ZEDIT)
close_socket(d);
return;
}
if (!(vict = get_player_vis(ch, arg, 0))) {
send_to_char(ch, "You can't see anyone named '%s'.\r\n", arg);
return;
}
if (GET_LEVEL(vict) >= GET_LEVEL(ch)) {
send_to_char("Maybe that's not such a good idea...\r\n", ch);
return;
}
if (!vict->desc) {
act("It seems $E's already linkdead...", FALSE, ch, 0, vict, TO_CHAR);
return;
}
sprintf(buf, "%s's connection closed.\r\n", GET_NAME(vict));
send_to_char(buf, ch);
sprintf(buf, "%s's connection closed by %s.", GET_NAME(vict),
GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, FALSE);
close_socket(vict->desc);
}
ACMD(do_wizlock)
{
int value;
char *when;
one_argument(argument, arg);
if (*arg) {
value = atoi(arg);
if (value < 0 || value > GET_LEVEL(ch)) {
send_to_char("Invalid wizlock value.\r\n", ch);
return;
}
restrict = value;
when = "now";
} else when = "currently";
switch (restrict) {
case 0:
sprintf(buf, "The game is %s completely open.\r\n", when);
break;
case 1:
sprintf(buf, "The game is %s closed to new players.\r\n", when);
break;
default:
sprintf(buf, "Only level %d and above may enter the game %s.\r\n",
restrict, when);
break;
}
send_to_char(buf, ch);
}
ACMD(do_date)
{
char *tmstr;
time_t mytime;
int d, h, m;
extern time_t boot_time;
if (subcmd == SCMD_DATE)
mytime = time(0);
else
mytime = boot_time;
tmstr = (char *) asctime(localtime(&mytime));
*(tmstr + strlen(tmstr) - 1) = '\0';
if (subcmd == SCMD_DATE)
sprintf(buf, "Current machine time: %s\r\n", tmstr);
else {
mytime = time(0) - boot_time;
d = mytime / 86400;
h = (mytime / 3600) % 24;
m = (mytime / 60) % 60;
sprintf(buf, "Up since %s: %d day%s, %d:%02d\r\n", tmstr, d,
((d == 1) ? "" : "s"), h, m);
}
send_to_char(buf, ch);
}
ACMD(do_last)
{
struct char_file_u chdata;
one_argument(argument, arg);
if (!*arg) {
send_to_char("For whom do you wish to search?\r\n", ch);
return;
}
if (load_char(arg, &chdata) < 0) {
send_to_char("There is no such player.\r\n", ch);
return;
}
if ((chdata.level > GET_LEVEL(ch)) && (!access_level(ch, LVL_DIRECTOR))) {
if (subcmd == SCMD_FINGER)
send_to_char("You cannot finger someone whose level is higher than yours.\r\n", ch);
else send_to_char("You are not sufficiently erudite for that!\r\n", ch);
return;
}
if (subcmd == SCMD_FINGER)
sprintf(buf, "[%5s] %s%s%s %s\r\nLast logon: %-20s\r\n", chdata.whotitle,
(strlen(chdata.pretitle) ? chdata.pretitle : ""),
(strlen(chdata.pretitle) ? " " : ""), chdata.name, chdata.title,
ctime(&chdata.last_logon));
else sprintf(buf, "[%5ld] [%2d] %-12s : %-18s : %-20s\r\n",
chdata.char_specials_saved.idnum, (int) chdata.level,
chdata.name, chdata.host, ctime(&chdata.last_logon));
send_to_char(buf, ch);
}
ACMD(do_force)
{
struct descriptor_data *i, *next_desc;
struct char_data *vict, *next_force;
char to_force[MAX_INPUT_LENGTH + 2];
half_chop(argument, arg, to_force);
sprintf(buf1, "$n has forced you to '%s'.", to_force);
if (!*arg || !*to_force)
send_to_char("Whom do you wish to force do what?\r\n", ch);
else if ((!access_level(ch, LVL_DIRECTOR)) || (str_cmp("all", arg) && str_cmp("room", arg))) {
if (!(vict = get_char_vis(ch, arg)))
send_to_char(NOPERSON, ch);
else if (PLR_FLAGGED(ch, PLR_WRITING) || PLR_FLAGGED(ch, PLR_EDITING) ||
PLR_FLAGGED(ch, PLR_MAILING) || PLR_FLAGGED(ch, PLR_SPELL_CREATE) ||
PLR_FLAGGED(ch, PLR_CUSTOMIZE))
send_to_char("Not now!\r\n", ch);
else if (GET_LEVEL(ch) <= GET_LEVEL(vict))
send_to_char("No, no, no!\r\n", ch);
else {
send_to_char(OK, ch);
act(buf1, TRUE, ch, NULL, vict, TO_VICT);
sprintf(buf, "%s forced %s to %s", GET_NAME(ch), GET_NAME(vict), to_force);
mudlog(buf, ch, LOG_WIZLOG, TRUE);
command_interpreter(vict, to_force);
}
} else if (!str_cmp("room", arg)) {
send_to_char(OK, ch);
sprintf(buf, "%s forced room %d to %s", GET_NAME(ch), world[ch->in_room].number, to_force);
mudlog(buf, ch, LOG_WIZLOG, TRUE);
for (vict = world[ch->in_room].people; vict; vict = next_force) {
next_force = vict->next_in_room;
if (GET_LEVEL(vict) >= GET_LEVEL(ch))
continue;
act(buf1, TRUE, ch, NULL, vict, TO_VICT);
command_interpreter(vict, to_force);
}
} else { /* force all */
send_to_char(OK, ch);
sprintf(buf, "%s forced all to %s", GET_NAME(ch), to_force);
mudlog(buf, ch, LOG_WIZLOG, TRUE);
for (i = descriptor_list; i; i = next_desc) {
next_desc = i->next;
if (i->connected || !(vict = i->character) || GET_LEVEL(vict) >= GET_LEVEL(ch))
continue;
act(buf1, TRUE, ch, NULL, vict, TO_VICT);
command_interpreter(vict, to_force);
}
}
}
ACMD(do_wiztell)
{
struct descriptor_data *d;
skip_spaces(&argument);
delete_doubledollar(argument);
if (!*argument) {
send_to_char("Don't bother the gods like that!\r\n", ch);
return;
}
/* Twink check */
if ( check_lar( ch, argument, CHAN_WT ) )
return;
sprintf(buf1, "^c[%s]: %s\r\n", GET_NAME(ch), argument);
sprintf(buf2, "^c[Someone]: %s\r\n", argument);
for (d = descriptor_list; d; d = d->next) {
if ((!d->connected) && d->character && ((!IS_NPC(d->character) && GET_LEVEL(d->character) >= LVL_LEGEND) ||
(IS_NPC(d->character) && d->original && GET_LEVEL(d->original) >= LVL_LEGEND)) &&
(!PRF_FLAGGED(d->character, PRF_NOWIZ)) &&
(!PLR_FLAGGED(d->character, PLR_WRITING | PLR_MAILING | PLR_EDITING))
&& (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) {
if (CAN_SEE(d->character, ch))
send_to_char(buf1, d->character);
else send_to_char(buf2, d->character);
}
}
if (PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(OK, ch);
}
ACMD(do_wizwho)
{
struct descriptor_data *d;
struct char_data *tch;
char line[MAX_INPUT_LENGTH];
int immos = 0;
send_to_char("\r\n", ch);
for (d = descriptor_list; d; d = d->next) {
if (!d->connected || (d->connected >= CON_SPELL_CREATE && d->connected <= CON_ZEDIT)) {
if (d->original)
tch = d->original;
else if (!(tch = d->character))
continue;
if (GET_LEVEL(tch) < LVL_LEGEND || !CAN_SEE(ch, tch))
continue;
if (!PRF_FLAGGED(tch, PRF_AFK))
sprintf(line, " [^c%5.5s^n] ^b%-30s^n Room: [^c%5d^n] Idle: [^c%4d^n]", GET_WHOTITLE(tch),
GET_NAME(tch), world[tch->in_room].number, tch->char_specials.timer);
else sprintf(line, " [^c%5.5s^n] ^b%-30s^n Room: [^c%5d^n] Idle: [^c-AFK^n]", GET_WHOTITLE(tch),
GET_NAME(tch), world[tch->in_room].number);
if (d->connected)
sprintf(buf, " ^r(Editing)^n\r\n");
else if (d->character && IS_PERSONA(d->character))
sprintf(buf, " ^r(Decking)^n\r\n");
else if (tch == d->original)
sprintf(buf, " ^r(Switched)^n\r\n");
else if (GET_INVIS_LEV(d->character))
sprintf(buf, " ^m(i%d)^n\r\n", GET_INVIS_LEV(d->character));
else sprintf(buf, "\r\n");
strcat(line, buf);
send_to_char(line, ch);
immos++;
}
}
sprintf(buf, "\r\nTotal : %d\r\n", immos);
send_to_char(buf, ch);
}
ACMD(do_zreset)
{
void reset_zone(int zone, int reboot);
int i;
one_argument(argument, arg);
if (!*arg) {
send_to_char("You must specify a zone.\r\n", ch);
return;
}
if (*arg == '*') {
if (!access_level(ch, LVL_PRESIDENT)) {
send_to_char("You can't reset the entire world.\r\n", ch);
return;
}
for (i = 0; i <= top_of_zone_table; i++)
reset_zone(i, 0);
sprintf(buf, "%s reset world.", GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
send_to_char("Reset world.\r\n", ch);
return;
} else if (*arg == '.')
i = world[ch->in_room].zone;
else i = real_zone(atoi(arg));
if (i >= 0 && i <= top_of_zone_table) {
if ((!access_level(ch, LVL_PRESIDENT)) && (zone_table[i].number != ch->player_specials->saved.zonenum)) {
send_to_char("You can only zreset your zone.\r\n", ch);
return;
}
reset_zone(i, 0);
sprintf(buf, "Reset zone %d (#%d): %s.\r\n", i, zone_table[i].number, zone_table[i].name);
send_to_char(buf, ch);
sprintf(buf, "%s reset zone %d (%s)", GET_NAME(ch), i, zone_table[i].name);
if (!access_level(ch, LVL_OWNER))
mudlog(buf, ch, LOG_WIZLOG, TRUE);
} else send_to_char("Invalid zone number.\r\n", ch);
}
ACMD(do_wiztitle)
{
if (IS_NPC(ch))
send_to_char("Your title is fine... go away.\r\n", ch);
else if (PLR_FLAGGED(ch, PLR_NOTITLE))
send_to_char("You can't title yourself.\r\n", ch);
else if (subcmd == SCMD_WHOTITLE) {
skip_spaces(&argument);
if (strstr((const char *)argument, "^"))
send_to_char("Whotitles can't contain the ^ character.\r\n", ch);
else if (strlen(argument) > 5) {
sprintf(buf, "Sorry, whotitles can't be longer than 5 characters.\r\n");
send_to_char(buf, ch);
} else {
set_whotitle(ch, argument);
sprintf(buf, "Okay, your whotitle is now [%5s].\r\n", GET_WHOTITLE(ch));
send_to_char(buf, ch);
}
} else if (subcmd == SCMD_PRETITLE) {
skip_spaces(&argument);
if (strlen(argument) > (MAX_TITLE_LENGTH -2)) {
sprintf(buf, "Sorry, pretitles can't be longer than %d characters.\r\n", MAX_TITLE_LENGTH - 2);
send_to_char(buf, ch);
} else {
set_pretitle(ch, argument);
sprintf(buf, "Okay, you're now %s %s %s.\r\n", GET_PRETITLE(ch), GET_NAME(ch), GET_TITLE(ch));
send_to_char(buf, ch);
}
}
}
/*
* General fn for wizcommands of the sort: cmd <player>
*/
ACMD(do_wizutil)
{
struct char_data *vict;
long result;
one_argument(argument, arg);
if (!*arg)
send_to_char("Yes, but for whom?!?\r\n", ch);
else if (!(vict = get_char_vis(ch, arg)))
send_to_char("There is no such player.\r\n", ch);
else if (IS_NPC(vict))
send_to_char("You can't do that to a mob!\r\n", ch);
else if ((GET_LEVEL(vict) >= GET_LEVEL(ch)) && (ch != vict))
send_to_char("Hmmm...you'd better not.\r\n", ch);
else {
switch (subcmd) {
case SCMD_REROLL:
send_to_char("Rerolled...\r\n", ch);
sprintf(buf, "%s has rerolled %s.", GET_NAME(ch), GET_NAME(vict));
mudlog(buf, ch, LOG_WIZLOG, FALSE);
sprintf(buf, "New stats: Str %d, Int %d, Wil %d, Qui %d, Bod %d, Cha %d\r\n",
GET_STR(vict), GET_INT(vict), GET_WIL(vict),
GET_QUI(vict), GET_BOD(vict), GET_CHA(vict));
send_to_char(buf, ch);
break;
case SCMD_PARDON:
if (!PLR_FLAGGED(vict, PLR_THIEF | PLR_KILLER)) {
send_to_char("Your victim is not flagged.\r\n", ch);
return;
}
REMOVE_BIT(PLR_FLAGS(vict), PLR_THIEF | PLR_KILLER);
send_to_char("Pardoned.\r\n", ch);
send_to_char("You have been pardoned by the Gods!\r\n", vict);
sprintf(buf, "%s pardoned by %s", GET_NAME(vict), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
break;
case SCMD_NOTITLE:
result = PLR_TOG_CHK(vict, PLR_NOTITLE);
sprintf(buf, "Notitle %s for %s by %s.", ONOFF(result),
GET_NAME(vict), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
strcat(buf, "\r\n");
send_to_char(buf, ch);
break;
case SCMD_SQUELCH:
result = PLR_TOG_CHK(vict, PLR_NOSHOUT);
sprintf(buf, "Squelch %s for %s by %s.", ONOFF(result),
GET_NAME(vict), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
strcat(buf, "\r\n");
send_to_char(buf, ch);
break;
case SCMD_FREEZE:
if (ch == vict) {
send_to_char("Oh, yeah, THAT'S real smart...\r\n", ch);
return;
}
if (PLR_FLAGGED(vict, PLR_FROZEN)) {
send_to_char("Your victim is already pretty cold.\r\n", ch);
return;
}
SET_BIT(PLR_FLAGS(vict), PLR_FROZEN);
GET_FREEZE_LEV(vict) = GET_LEVEL(ch);
send_to_char("A bitter wind suddenly rises and drains every erg of heat from your body!\r\nYou feel frozen!\r\n", vict);
send_to_char("Frozen.\r\n", ch);
act("A sudden cold wind conjured from nowhere freezes $n!", FALSE, vict, 0, 0, TO_ROOM);
sprintf(buf, "%s frozen by %s.", GET_NAME(vict), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
break;
case SCMD_THAW:
if (!PLR_FLAGGED(vict, PLR_FROZEN)) {
send_to_char("Sorry, your victim is not morbidly encased in ice at the moment.\r\n", ch);
return;
}
if (!access_level(ch, GET_FREEZE_LEV(vict))) {
sprintf(buf, "Sorry, a level %d God froze %s... you can't unfreeze %s.\r\n",
GET_FREEZE_LEV(vict), GET_NAME(vict), HMHR(vict));
send_to_char(buf, ch);
return;
}
sprintf(buf, "%s un-frozen by %s.", GET_NAME(vict), GET_NAME(ch));
mudlog(buf, ch, LOG_WIZLOG, TRUE);
REMOVE_BIT(PLR_FLAGS(vict), PLR_FROZEN);
send_to_char("A fireball suddenly explodes in front of you, melting the ice!\r\nYou feel thawed.\r\n", vict);
send_to_char("Thawed.\r\n", ch);
act("A sudden fireball conjured from nowhere thaws $n!", FALSE, vict, 0, 0, TO_ROOM);
break;
case SCMD_UNAFFECT:
if (vict->affected) {
while (vict->affected)
affect_remove(vict, vict->affected, 1);
send_to_char("There is a brief flash of light!\r\n"
"You feel slightly different.\r\n", vict);
send_to_char("All spells removed.\r\n", ch);
} else {
send_to_char("Your victim does not have any affections!\r\n", ch);
return;
}
break;
default:
log("SYSERR: Unknown subcmd passed to do_wizutil (act.wizard.c)");
break;
}
save_char(vict, NOWHERE);
}
}
/* single zone printing fn used by "show zone" so it's not repeated in the
code 3 times ... -je, 4/6/93 */
void print_zone_to_buf(char *bufptr, int zone, int detailed)
{
int i, color = 0, first = 1;
for (i = 0; zone_table[zone].name[i]; i++)
if (zone_table[zone].name[i] == '^' && (i < 1 || zone_table[zone].name[i-1] != '^') &&
zone_table[zone].name[i+1]) {
switch (LOWER(zone_table[zone].name[i+1])) {
case 'b': case 'c': case 'g': case 'l': case 'm':
case 'n': case 'r': case 'w': case 'y':
color += 2;
break;
case '^':
color++;
break;
}
}
if (!detailed) {
sprintf(bufptr, "%s%3d %-30.30s^n ", bufptr, zone_table[zone].number,
zone_table[zone].name);
for (i = 0; i < color; i++)
strcat(bufptr, " ");
sprintf(bufptr, "%s%sAge: %3d; Res: %3d (%1d); Top: %5d; Sec: %2d\r\n",
bufptr,
zone_table[zone].connected ? "* " : " ",
zone_table[zone].age, zone_table[zone].lifespan,
zone_table[zone].reset_mode, zone_table[zone].top,
zone_table[zone].security);
} else {
int rooms = 0, objs = 0, mobs = 0, shops = 0;
for (i = 0; i <= top_of_world && world[i].number <= zone_table[zone].top; i++)
if (world[i].number >= (zone_table[zone].number * 100))
rooms++;
for (i = 0; i <= top_of_mobt && mob_index[i].virt <= zone_table[zone].top; i++)
if (mob_index[i].virt >= (zone_table[zone].number * 100))
mobs++;
for (i = 0; i <= top_of_objt && obj_index[i].virt <= zone_table[zone].top; i++)
if (obj_index[i].virt >= (zone_table[zone].number * 100))
objs++;
for (i = 0; i < top_of_shopt && shop_table[i].virt <= zone_table[zone].top; i++)
if (shop_table[i].virt >= (zone_table[zone].number * 100))
shops++;
sprintf(bufptr, "Zone %d (%d): %s\r\n"
"Age: %d, Commands: %d, Reset: %d (%d), Top: %d\r\n"
"Rooms: %d, Mobiles: %d, Objects: %d, Shops: %d\r\n"
"Matrix: %s, Security: %d, Status: %s\r\nEditors: ",
zone_table[zone].number, zone, zone_table[zone].name,
zone_table[zone].age, zone_table[zone].num_cmds,
zone_table[zone].lifespan, zone_table[zone].reset_mode,
zone_table[zone].top, rooms, mobs, objs, shops,
matrix_modes[zone_table[zone].alert], zone_table[zone].security,
zone_table[zone].connected ? "Connected" : "In Progress");
for (i = 0; i < 5; i++) {
if (get_name_by_id(zone_table[zone].editor_ids[i])) {
if (first)
first = 0;
else strcat(bufptr, ", ");
strcat(bufptr, CAP(get_name_by_id(zone_table[zone].editor_ids[i])));
}
}
if (first)
strcat(bufptr, "None.\r\n");
else strcat(bufptr, ".\r\n");
}
}
#define MAXBUF 0
ACMD(do_show)
{
struct char_file_u vbuf;
int i, j, k, l, con, last = -1;
char self = 0;
struct char_data *vict;
struct obj_data *obj;
spell_t *temp;
char field[40], value[40], birth[80];
extern char *genders[];
extern int buf_switches, buf_largecount, buf_overflows;
void show_shops(struct char_data * ch, char *value);
void hcontrol_list_houses(struct char_data *ch, char *arg);
SPECIAL(call_elevator);
struct show_struct {
char *cmd;
char level;
} fields[] = {
{ "nothing", 0 },/* 0 */
{ "zones", LVL_LEGEND }, /* 1 */
{ "player", LVL_BUILDER },
{ "rent", LVL_ADVISOR },
{ "stats", LVL_DIRECTOR },
{ "errors", LVL_MANAGER }, /* 5 */
{ "death", LVL_MANAGER },
{ "godrooms", LVL_LEGEND },
{ "skills", LVL_PRESIDENT },
{ "spells", LVL_PRESIDENT },
{ "prompt", LVL_PRESIDENT },
{ "lodge", LVL_MANAGER },
{ "library", LVL_MANAGER },
{ "\n", 0 }
};
skip_spaces(&argument);
if (!*argument) {
strcpy(buf, "Show options:\r\n");
for (j = 0, i = 1; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
sprintf(buf, "%s%-15s%s", buf, fields[i].cmd, (!(++j % 5) ? "\r\n" : ""));
strcat(buf, "\r\n");
send_to_char(buf, ch);
return;
}
strcpy(arg, two_arguments(argument, field, value));
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if (!access_level(ch, fields[l].level)) {
send_to_char("You are not erudite enough for that!\r\n", ch);
return;
}
if (!strcmp(value, "."))
self = 1;
buf[0] = '\0';
switch (l) {
case 1: /* zone */
/* tightened up by JE 4/6/93 */
if (self) {
if (access_level(ch, LVL_MANAGER))
print_zone_to_buf(buf, world[ch->in_room].zone, 1);
else
print_zone_to_buf(buf, world[ch->in_room].zone, 0);
}
else if (*value && is_number(value))
{
for (j = atoi(value), i = 0; zone_table[i].number != j && i <= top_of_zone_table; i++);
if (i <= top_of_zone_table) {
if (access_level(ch, LVL_DIRECTOR))
print_zone_to_buf(buf, i, 1);
else
print_zone_to_buf(buf, i, 0);
} else {
send_to_char("That is not a valid zone.\r\n", ch);
return;
}
} else for (i = 0; i <= top_of_zone_table; i++)
print_zone_to_buf(buf, i, 0);
page_string(ch->desc, buf, 1);
break;
case 2: /* player */
if (!*value) {
send_to_char("A name would help.\r\n", ch);
return;
}
if (load_char(value, &vbuf) < 0) {
send_to_char("There is no such player.\r\n", ch);
return;
}
if (!access_level(ch, LVL_PRESIDENT)
&& GET_LEVEL(ch) <= vbuf.level) {
send_to_char("You're not erudite enough to do that!\r\n", ch);
return;
}
sprintf(buf, "Player: %-12s (%s) [%2d]\r\n", vbuf.name,
genders[(int) vbuf.sex], vbuf.level);
sprintf(buf, "%s¥: %-8d Bal: %-8d Karma: %-8d Align: %-5d\r\n",
buf, vbuf.points.nuyen, vbuf.points.bank, vbuf.points.karma,
vbuf.char_specials_saved.alignment);
strcpy(birth, ctime(&vbuf.birth));
sprintf(buf, "%sStarted: %-20.16s Last: %-20.16s Played: %3dh %2dm\r\n",
buf, birth, ctime(&vbuf.last_logon), (int) (vbuf.played / 3600),
(int) (vbuf.played / 60 % 60));
send_to_char(buf, ch);
break;
case 3:
Crash_listrent(ch, value);
break;
case 4:
i = 0;
j = 0;
k = 0;
con = 0;
for (vict = character_list; vict; vict = vict->next) {
if (IS_NPC(vict))
j++;
else if (CAN_SEE(ch, vict)) {
i++;
if (vict->desc)
con++;
}
}
sprintf(buf, "Current stats:\r\n");
sprintf(buf, "%s Players in game: ^C%-5d^n Connected: ^g%-5d^n\r\n", buf, i, con);
sprintf(buf, "%s Registered players: ^c%-5d^n\r\n", buf, top_of_p_table + 1);
sprintf(buf, "%s Mobiles: ^c%-5d^n Prototypes: ^y%-5d^n Available: ^L%-5d^n\r\n",
buf, j, top_of_mobt + 1, top_of_mob_array - top_of_mobt + 1);
sprintf(buf, "%s Objects: ^c%-5d^n Prototypes: ^y%-5d^n Available: ^L%-5d^n\r\n",
buf, ObjList.NumItems(), top_of_objt + 1, top_of_obj_array - top_of_objt + 1);
sprintf(buf, "%s Rooms: ^c%-5d^n Available: ^L%-5d^n\r\n Zones: %-5d\r\n",
buf, top_of_world + 1, top_of_world_array - top_of_world + 1,
top_of_zone_table + 1);
sprintf(buf, "%s World chunk: ^c%-5d^n Mob chunk: ^c%-5d^n Obj chunk: ^c%-5d^n\r\n",
buf, world_chunk_size, mob_chunk_size, obj_chunk_size);
sprintf(buf, "%s Large bufs: ^c%-5d^n Buf switches: ^C%-5d^n Overflows: ^r%-5d^n\r\n",
buf, buf_largecount, buf_switches, buf_overflows);
sprintf(buf, "%s ObjStackSize: %d(%d), ChStackSize: %d(%d), RmStackSize: %d(%d)\r\n",
buf, Mem->ObjSize(), Mem->ObjMaxSize(), Mem->ChSize(), Mem->ChMaxSize(),
Mem->RoomSize(), Mem->RoomMaxSize());
sprintf(buf, "%s OLC is %s\r\n", buf,
(olc_state ? "^GAvailable.^n" : "^RUnavailable.^n"));
sprintf(buf, "%s Anti-Lar is %s\n\r", buf,
(ANTI_LAR ? "^REnabled.^n" : "^GDisabled.^n"));
send_to_char(buf, ch);
break;
case 5:
strcpy(buf, "Errant Rooms\r\n------------\r\n");
for (i = 0, k = 0; i <= top_of_world; i++)
for (j = 0; j < NUM_OF_DIRS; j++)
if (world[i].dir_option[j] && (world[i].dir_option[j]->to_room == 0 ||
world[i].dir_option[j]->to_room == NOWHERE) && i != last) {
sprintf(buf, "%s%2d: [%5d] %s\r\n", buf, ++k, world[i].number, world[i].name);
last = i;
}
send_to_char(buf, ch);
break;
case 6:
strcpy(buf, "Death Traps\r\n-----------\r\n");
for (i = 0, j = 0; i <= top_of_world; i++)
if (IS_SET(ROOM_FLAGS(i), ROOM_DEATH))
sprintf(buf, "%s%2d: [%5d] %s %s\r\n", buf, ++j,
world[i].number,
from_ip_zone(world[i].number) ? " " : "*",
world[i].name);
send_to_char(buf, ch);
break;
case 7:
#define GOD_ROOMS_ZONE 0
strcpy(buf, "Godrooms\r\n--------------------------\r\n");
for (i = 0, j = 0; i <= zone_table[real_zone(GOD_ROOMS_ZONE)].top; i++)
if (world[i].zone == GOD_ROOMS_ZONE && i > 1 && !(i >= 8 && i <= 12))
sprintf(buf, "%s%2d: [%5d] %s %s\r\n", buf, j++, world[i].number,
from_ip_zone(world[i].number) ? " " : "*",
world[i].name);
send_to_char(buf, ch);
break;
case 8:
if (!*value) {
send_to_char("A name would help.\r\n", ch);
return;
}
if (!(vict = get_char_vis(ch, value))) {
send_to_char(ch, "You can't see anyone named '%s'.\r\n", value);
return;
}
send_to_char(ch, "%s's skills:", GET_NAME(vict));
j = 0;
sprintf(buf, "\r\n");
for (i = SKILL_STEALTH; i <= SKILL_RESISTANCE; i++)
if (GET_SKILL(vict, i) > 0) {
sprintf(buf, "%s[%-20s%4d]", buf, spells[i], GET_SKILL(vict, i));
j++;
if (!(j % 3))
strcat(buf, "\r\n");
}
send_to_char(buf, ch);
send_to_char("\r\n", ch);
break;
case 9:
if (!*value) {
send_to_char("A name would help.\r\n", ch);
return;
}
if (!(vict = get_char_vis(ch, value))) {
send_to_char(ch, "You can't see anyone named '%s'.\r\n", value);
return;
}
if (!vict->spells) {
send_to_char(ch, "%s does not know any spells.\r\n", GET_NAME(vict));
return;
}
send_to_char(ch, "%s's spells:\r\n", GET_NAME(vict));
i = 0;
*buf = '\0';
for (temp = vict->spells; temp; temp = temp->next) {
i += strlen(temp->name) + 4 + (int)(temp->force / 10);
if (i < 79) {
if (temp->next)
sprintf(buf, "%s%s (%d), ", buf, temp->name, temp->force);
else sprintf(buf, "%s%s (%d).\r\n", buf, temp->name, temp->force);
} else {
send_to_char(strcat(buf, "\r\n"), ch);
if (temp->next)
sprintf(buf, "%s (%d), ", temp->name, temp->force);
else sprintf(buf, "%s (%d).\r\n", temp->name, temp->force);
i = strlen(buf);
}
}
send_to_char(buf, ch);
break;
case 10:
if (!*value) {
send_to_char("A name would help.\r\n", ch);
return;
}
if (!(vict = get_char_vis(ch, value))) {
send_to_char(ch, "You can't see anyone named '%s'.\r\n", value);
return;
}
send_to_char(ch, "%s's prompt:\r\n%s\r\n", GET_NAME(vict), GET_PROMPT(vict));
break;
case 11:
strcpy(buf, "Lodges\r\n------\r\n");
for (i = 0, j = 0; i <= top_of_world; i++)
if (IS_SET(ROOM_FLAGS(i), ROOM_MEDICINE_LODGE))
sprintf(buf, "%s%2d: [%5d] %s (%2d) %s\r\n", buf, ++j,
world[i].number,
from_ip_zone(world[i].number) ? " " : "*",
world[i].rating, world[i].name);
send_to_char(buf, ch);
break;
case 12:
strcpy(buf, "Libraries\r\n---------\r\n");
for (i = 0, j = 0; i <= top_of_world; i++)
if (IS_SET(ROOM_FLAGS(i), ROOM_HERMETIC_LIBRARY))
sprintf(buf, "%s%2d: [%5d] %s (%d) %s\r\n", buf, ++j,
world[i].number,
from_ip_zone(world[i].number) ? " " : "*",
world[i].rating, world[i].name);
send_to_char(buf, ch);
break;
default:
send_to_char("Sorry, I don't understand that.\r\n", ch);
break;
}
}
#define PC 1
#define NPC 2
#define BOTH 3
#define MISC 0
#define BINARY 1
#define NUMBER 2
#define SET_OR_REMOVE(flagset, flags) {if (on) SET_BIT(flagset, flags);else if (off) REMOVE_BIT(flagset, flags);}
#define RANGE(low, high) (value = MAX((low), MIN((high), (value))))
ACMD(do_set)
{
int i, l;
struct char_data *vict = NULL, *cbuf = NULL;
struct char_file_u tmp_store;
char field[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGTH];
int on = 0, off = 0, value = 0;
char is_file = 0, is_mob = 0, is_player = 0;
int player_i = 0;
int parse_class(struct descriptor_data *d, char *arg);
struct set_struct {
char *cmd;
char level;
char pcnpc;
char type;
} fields[] = {
{ "brief", LVL_OWNER, PC, BINARY }, // 0
{ "invstart", LVL_OWNER, PC, BINARY },
{ "title", LVL_DIRECTOR, PC, MISC },
{ "afk", LVL_DIRECTOR, PC, BINARY },
{ "maxphysical", LVL_OWNER, BOTH, NUMBER },
{ "maxmental", LVL_OWNER, BOTH, NUMBER }, // 5
{ "physical", LVL_PRESIDENT, BOTH, NUMBER },
{ "mental", LVL_PRESIDENT, BOTH, NUMBER },
{ "align", LVL_OWNER, BOTH, NUMBER },
{ "str", LVL_PRESIDENT, BOTH, NUMBER },
{ "ess", LVL_PRESIDENT, BOTH, NUMBER }, // 10
{ "int", LVL_PRESIDENT, BOTH, NUMBER },
{ "wil", LVL_PRESIDENT, BOTH, NUMBER },
{ "qui", LVL_PRESIDENT, BOTH, NUMBER },
{ "bod", LVL_PRESIDENT, BOTH, NUMBER },
{ "sex", LVL_PRESIDENT, BOTH, MISC }, // 15
{ "ballistic", LVL_OWNER, BOTH, NUMBER },
{ "nuyen", LVL_DIRECTOR, BOTH, NUMBER },
{ "bank", LVL_DIRECTOR, PC, NUMBER },
{ "reputation", LVL_OWNER, BOTH, NUMBER },
{ "initdice", LVL_OWNER, BOTH, NUMBER }, // 20
{ "initroll", LVL_OWNER, BOTH, NUMBER },
{ "invis", LVL_OWNER, PC, NUMBER },
{ "nohassle", LVL_PRESIDENT, PC, BINARY },
{ "frozen", LVL_FREEZE, PC, BINARY },
{ "karma", LVL_PRESIDENT, PC, NUMBER }, // 25
{ "drunk", LVL_DIRECTOR, BOTH, MISC },
{ "hunger", LVL_PRESIDENT, BOTH, MISC },
{ "thirst", LVL_PRESIDENT, BOTH, MISC },
{ "killer", LVL_OWNER, PC, BINARY },
{ "thief", LVL_OWNER, PC, BINARY }, // 30
{ "level", LVL_OWNER, BOTH, NUMBER },
{ "room", LVL_PRESIDENT, BOTH, NUMBER },
{ "roomflag", LVL_PRESIDENT, PC, BINARY },
{ "siteok", LVL_PRESIDENT, PC, BINARY },
{ "deleted", LVL_OWNER, PC, BINARY }, // 35
{ "nowizlist", LVL_OWNER, PC, BINARY },
{ "quest", LVL_OWNER, PC, BINARY },
{ "loadroom", LVL_PRESIDENT, PC, MISC },
{ "color", LVL_PRESIDENT, PC, BINARY },
{ "idnum", LVL_OWNER, PC, NUMBER }, // 40
{ "passwd", LVL_OWNER, PC, MISC },
{ "nodelete", LVL_OWNER, PC, BINARY },
{ "cha", LVL_PRESIDENT, BOTH, NUMBER },
{ "mag", LVL_PRESIDENT, BOTH, NUMBER },
{ "rea", LVL_OWNER, BOTH, NUMBER }, // 45
{ "impact", LVL_OWNER, BOTH, NUMBER },
{ "newbie", LVL_PRESIDENT, PC, BINARY },
{ "skillpoints", LVL_PRESIDENT, PC, NUMBER },
{ "totem", LVL_PRESIDENT, PC, NUMBER },
{ "zone", LVL_PRESIDENT, PC, NUMBER }, // 50
{ "olc", LVL_PRESIDENT, PC, BINARY },
{ "guest", LVL_DIRECTOR, PC, BINARY },
{ "nostat", LVL_OWNER, PC, BINARY },
{ "pretitle", LVL_DIRECTOR, PC, MISC },
{ "whotitle", LVL_DIRECTOR, PC, MISC }, // 55
{ "pker", LVL_DIRECTOR, PC, BINARY },
{ "index", LVL_PRESIDENT, BOTH, NUMBER },
{ "quester", LVL_DIRECTOR, PC, BINARY },
{ "tradition", LVL_PRESIDENT, PC, NUMBER },
{ "nosnoop", LVL_OWNER, PC, BINARY },
{ "\n", 0, BOTH, MISC }
};
half_chop(argument, name, buf);
if (!strcmp(name, "file")) {
is_file = 1;
half_chop(buf, name, buf);
} else if (!str_cmp(name, "player")) {
is_player = 1;
half_chop(buf, name, buf);
} else if (!str_cmp(name, "mob")) {
is_mob = 1;
half_chop(buf, name, buf);
}
half_chop(buf, field, buf);
strcpy(val_arg, buf);
if (!*name || !*field) {
send_to_char("Usage: set <victim> <field> <value>\r\n", ch);
return;
}
if (!is_file) {
if (is_player) {
if (!(vict = get_player_vis(ch, name, 0))) {
send_to_char("There is no such player.\r\n", ch);
return;
}
} else {
if (!(vict = get_char_vis(ch, name))) {
send_to_char("There is no such creature.\r\n", ch);
return;
}
}
} else if (is_file) {
if ((player_i = load_char(name, &tmp_store)) > -1) {
cbuf = new char_data;
clear_char(cbuf);
store_to_char(&tmp_store, cbuf);
if (!access_level(ch, GET_LEVEL(cbuf)+1)) {
// return the memory to the stack if the player can't do it
send_to_char("Sorry, you can't do that.\r\n", ch);
delete cbuf;
return;
}
vict = cbuf;
} else {
send_to_char("There is no such player.\r\n", ch);
return;
}
}
if (!access_level(ch, LVL_PRESIDENT)) {
if (!IS_NPC(vict) && !access_level(ch, GET_LEVEL(vict)+1)) {
send_to_char("Maybe that's not such a great idea...\r\n", ch);
return;
}
}
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if (!access_level(ch, fields[l].level)) {
send_to_char("You are not erudite enough for that!\r\n", ch);
return;
}
if (IS_NPC(vict) && fields[l].pcnpc == PC) {
send_to_char("You can't do that to a mob!\r\n", ch);
return;
} else if (!IS_NPC(vict) && fields[l].pcnpc == NPC) {
send_to_char("That can only be done to mobs!\r\n", ch);
return;
}
if (fields[l].type == BINARY) {
if (!strcmp(val_arg, "on") || !strcmp(val_arg, "yes"))
on = 1;
else if (!strcmp(val_arg, "off") || !strcmp(val_arg, "no"))
off = 1;
if (!(on || off)) {
send_to_char("Value must be on or off.\r\n", ch);
return;
}
} else if (fields[l].type == NUMBER) {
value = atoi(val_arg);
}
strcpy(buf, "Okay."); /* can't use OK macro here 'cause of \r\n */
switch (l) {
case 0:
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_BRIEF);
break;
case 1:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_INVSTART);
break;
case 2:
set_title(vict, val_arg);
sprintf(buf, "%s's title is now: %s", GET_NAME(vict), GET_TITLE(vict));
break;
case 3:
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_AFK);
on = !on; /* so output will be correct */
break;
case 4:
RANGE(1, 100);
vict->points.max_physical = value * 100;
affect_total(vict);
break;
case 5:
RANGE(1, 100);
vict->points.max_mental = value * 100;
affect_total(vict);
break;
case 6:
RANGE(-(GET_BOD(vict) - 1), (int)(vict->points.max_physical / 100));
vict->points.physical = value * 100;
affect_total(vict);
update_pos(vict);
break;
case 7:
RANGE(-9, (int)(vict->points.max_mental / 100));
vict->points.mental = value * 100;
affect_total(vict);
update_pos(vict);
break;
case 8:
RANGE(-1000, 1000);
GET_ALIGNMENT(vict) = value;
affect_total(vict);
break;
case 9:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 50);
else RANGE(1, 15);
if (GET_LEVEL(vict) == 1)
GET_REP(vict) = GET_REP(vict) + value - vict->real_abils.str;
vict->real_abils.str = value;
affect_total(vict);
break;
case 10:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 1000);
else RANGE(1, 600);
vict->real_abils.ess = value;
affect_total(vict);
break;
case 11:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 50);
else RANGE(1, 15);
if (GET_LEVEL(vict) == 1)
GET_REP(vict) = GET_REP(vict) + value - vict->real_abils.intel;
vict->real_abils.intel = value;
affect_total(vict);
break;
case 12:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 50);
else RANGE(1, 15);
if (GET_LEVEL(vict) == 1)
GET_REP(vict) = GET_REP(vict) + value - vict->real_abils.wil;
vict->real_abils.wil = value;
affect_total(vict);
break;
case 13:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 50);
else RANGE(1, 15);
if (GET_LEVEL(vict) == 1)
GET_REP(vict) = GET_REP(vict) + value - vict->real_abils.qui;
vict->real_abils.qui = value;
affect_total(vict);
break;
case 14:
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_MANAGER)
RANGE(1, 50);
else RANGE(1, 15);
if (GET_LEVEL(vict) == 1)
GET_REP(vict) = GET_REP(vict) + value - vict->real_abils.bod;
vict->real_abils.bod = value;
affect_total(vict);
break;
case 15:
if (!str_cmp(val_arg, "male"))
vict->player.sex = SEX_MALE;
else if (!str_cmp(val_arg, "female"))
vict->player.sex = SEX_FEMALE;
else if (!str_cmp(val_arg, "neutral"))
vict->player.sex = SEX_NEUTRAL;
else {
send_to_char("Must be 'male', 'female', or 'neutral'.\r\n", ch);
return;
}
break;
case 16:
RANGE(0, 100);
vict->points.ballistic = value;
affect_total(vict);
break;
case 17:
RANGE(0, 100000000);
GET_NUYEN(vict) = value;
break;
case 18:
RANGE(0, 100000000);
GET_BANK(vict) = value;
break;
case 19:
RANGE(0, 750);
GET_REP(vict) = value;
break;
case 20:
RANGE(0, 10);
vict->points.init_dice = value;
affect_total(vict);
break;
case 21:
RANGE(0, 50);
vict->points.init_roll = value;
affect_total(vict);
break;
case 22:
if (!access_level(ch, LVL_PRESIDENT) && ch != vict) {
send_to_char("You aren't erudite enough for that!\r\n", ch);
return;
}
RANGE(0, GET_LEVEL(vict));
GET_INVIS_LEV(vict) = value;
break;
case 23:
if (!access_level(ch, LVL_PRESIDENT) && ch != vict) {
send_to_char("You aren't erudite enough for that!\r\n", ch);
return;
}
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_NOHASSLE);
break;
case 24:
if (ch == vict) {
send_to_char("Better not -- could be a long winter!\r\n", ch);
return;
}
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_FROZEN);
break;
case 25:
RANGE(0, 1000000);
GET_KARMA(vict) = value;
break;
case 26: case 27: case 28:
if (!str_cmp(val_arg, "off")) {
GET_COND(vict, (l - 26)) = (char) -1;
sprintf(buf, "%s's %s now off.", GET_NAME(vict), fields[l].cmd);
} else if (is_number(val_arg)) {
value = atoi(val_arg);
RANGE(0, 24);
GET_COND(vict, (l - 26)) = (char) value;
sprintf(buf, "%s's %s set to %d.", GET_NAME(vict), fields[l].cmd, value);
} else {
send_to_char("Must be 'off' or a value from 0 to 24.\r\n", ch);
return;
}
break;
case 29:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER);
break;
case 30:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF);
break;
case 31:
if (!access_level(ch, value) || value > LVL_OWNER) {
send_to_char("You can't do that.\r\n", ch);
return;
}
/* Can't demote other owners this way, unless it's yourself */
if ( vict->player.level == LVL_OWNER && vict != ch )
{
send_to_char("You can't do that.\n\r",ch);
return;
}
RANGE(0, LVL_OWNER);
vict->player.level = (byte) value;
break;
case 32:
if ((i = real_room(value)) < 0) {
send_to_char("No room exists with that number.\r\n", ch);
return;
}
char_from_room(vict);
char_to_room(vict, i);
break;
case 33:
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_ROOMFLAGS);
break;
case 34:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK);
break;
case 35:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_DELETED);
break;
case 36:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST);
break;
case 37:
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST);
break;
case 38:
if (!str_cmp(val_arg, "off"))
REMOVE_BIT(PLR_FLAGS(vict), PLR_LOADROOM);
else if (is_number(val_arg)) {
value = atoi(val_arg);
if (real_room(value) != NOWHERE) {
SET_BIT(PLR_FLAGS(vict), PLR_LOADROOM);
GET_LOADROOM(vict) = value;
sprintf(buf, "%s will enter at room #%d.", GET_NAME(vict), GET_LOAShowing the first 100 KB of 120.8 KB. Download the archive for the full file.