act_wiz.c
zim/src/act_wiz.c · 180.3 KB
From the archive zim.tar.bz2
Download the archive « Back to the archive contents
/*
* $Id: act_wiz.c 998 2007-01-21 21:23:49Z zsuzsu $
*/
/***************************************************************************
* ANATOLIA 2.1 is copyright 1996-1997 Serdar BULUT, Ibrahim CANPUNAR *
* ANATOLIA has been brought to you by ANATOLIA consortium *
* Serdar BULUT {Chronos} bulut@rorqual.cc.metu.edu.tr *
* Ibrahim Canpunar {Asena} canpunar@rorqual.cc.metu.edu.tr *
* Murat BICER {KIO} mbicer@rorqual.cc.metu.edu.tr *
* D.Baris ACAR {Powerman} dbacar@rorqual.cc.metu.edu.tr *
* By using this code, you have agreed to follow the terms of the *
* ANATOLIA license, in the file Anatolia/anatolia.licence *
***************************************************************************/
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/***************************************************************************
* ROM 2.4 is copyright 1993-1995 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@pacinfo.com) *
* Gabrielle Taylor (gtaylor@pacinfo.com) *
* Brian Moore (rom@rom.efn.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <limits.h>
#include <dirent.h>
#ifdef LINUX
#include <time.h>
#endif
#include "merc.h"
#include "debug.h"
#include "db/cmd.h"
#include "interp.h"
#include "update.h"
#include "quest.h"
#include "obj_prog.h"
#include "fight.h"
#include "quest.h"
#include "db/db.h"
#include "olc/olc.h"
#include "waffects.h"
#include "augment.h"
#include "stats.h"
#include "fixes.h"
/* command procedures needed */
DECLARE_DO_FUN(do_rstat );
DECLARE_DO_FUN(do_mstat );
DECLARE_DO_FUN(do_dstat );
DECLARE_DO_FUN(do_ostat );
DECLARE_DO_FUN(do_rset );
DECLARE_DO_FUN(do_mset );
DECLARE_DO_FUN(do_oset );
DECLARE_DO_FUN(do_sset );
DECLARE_DO_FUN(do_mfind_old );
DECLARE_DO_FUN(do_ofind );
DECLARE_DO_FUN(do_ofind_old );
DECLARE_DO_FUN(do_mload );
DECLARE_DO_FUN(do_oload );
DECLARE_DO_FUN(do_save );
DECLARE_DO_FUN(do_look );
DECLARE_DO_FUN(do_stand );
DECLARE_DO_FUN(do_help );
DECLARE_DO_FUN(do_awardqp );
DECLARE_DO_FUN(do_awardxp );
DECLARE_DO_FUN(do_awardprac );
DECLARE_DO_FUN(do_warena );
qtrouble_t *qtrouble_lookup(CHAR_DATA *ch, int vnum);
void ofind_vnum (CHAR_DATA *ch, int vnum);
int repossess_limiteds (CHAR_DATA *ch, CHAR_PDATA *pvict);
extern int rebooter;
/*
* display immortal commands
*/
void do_wizcmd(CHAR_DATA *ch, const char *argument)
{
cmd_t *cmd;
int col;
int clevel;
int control;
if (IS_NPC(ch)) {
char_puts("Huh?\n", ch);
return;
}
for( clevel = LEVEL_HERO + 1; clevel < MAX_LEVEL + 1; clevel++ ) {
control = 0;
col = 0;
for (cmd = cmd_table; cmd->name; cmd++) {
if (cmd->level < LEVEL_IMMORTAL
|| IS_SET(cmd->flags, CMD_HIDDEN))
continue;
if(cmd->level == clevel) {
control++;
if(control==1)
char_printf(ch,
"\n{C ==============={R Level {R%-2d {C ==============={x\n",clevel);
if (ch->level < IMPLEMENTOR
&& !is_name(cmd->name, ch->pcdata->granted)) {
char_printf(ch, "{D%-12s{x",cmd->name);
if (++col % 6 == 0)
char_puts("\n", ch);
}
else {
char_printf(ch, "{W%-12s{x",cmd->name);
if (++col % 6 == 0)
char_puts("\n", ch);
}
}
}
}
}
/*
* stop all fighting in the realm
*/
void do_wpeace(CHAR_DATA *ch, const char *argument )
{
CHAR_DATA *rch;
char buf[MAX_STRING_LENGTH];
rch = ch;
for ( rch = char_list; rch; rch = rch->next )
{
if ( ch->desc == NULL || ch->desc->connected != CON_PLAYING )
continue;
if ( rch->fighting )
{
sprintf( buf, "%s has declared World Peace.\n\r", ch->name );
send_to_char( buf, rch );
stop_fighting( rch, TRUE );
}
}
send_to_char( "You have declared World Peace.\n\r", ch );
return;
}
void do_objlist(CHAR_DATA *ch, const char *argument)
{
FILE *fp;
OBJ_DATA *obj;
BUFFER *buf;
int bp, bpmax;
if ((fp = dfopen(TMP_PATH, "objlist.txt", "w+")) == NULL) {
char_puts("File error.\n", ch);
return;
}
buf = buf_new(-1);
for(obj = object_list; obj != NULL; obj = obj->next) {
if (obj->pIndexData->affected == NULL)
continue;
buf_clear(buf);
buf_printf(buf, "\n#Obj: %s (Vnum : %d) \n",
mlstr_mval(obj->short_descr),
obj->pIndexData->vnum);
format_obj(buf, obj);
if (!IS_SET(obj->extra_flags, ITEM_ENCHANTED))
format_obj_affects(buf, obj->pIndexData->affected,
FOA_F_NODURATION);
format_obj_affects(buf, obj->affected, 0);
build_points(obj->pIndexData, &bp, &bpmax);
buf_printf(buf, "Build Points: %d/%d\n",
bp, bpmax);
fprintf(fp, "%s", fix_string(buf_string(buf)));
}
buf_free(buf);
fclose(fp);
}
void do_limited(CHAR_DATA *ch, const char *argument)
{
extern int top_obj_index;
OBJ_DATA *obj;
OBJ_INDEX_DATA *obj_index;
int lCount = 0;
int ingameCount;
int nMatch;
int vnum;
int bp = 0,
bpmax = 0;
if (argument[0] != '\0') {
obj_index = get_obj_index(atoi(argument));
if (obj_index == NULL) {
char_puts("Not found.\n", ch);
return;
}
if (obj_index->limit == -1) {
char_puts("Thats not a limited item.\n", ch);
return;
}
nMatch = 0;
build_points(obj_index, &bp, &bpmax);
char_printf(ch, "{D[{%c%7d{D] {%c%3d{w of {C%3d{D max"
" {c%3d{xlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(obj_index->count > obj_index->limit) ? 'R' : 'c',
obj_index->count,
obj_index->limit,
obj_index->level,
mlstr_mval(obj_index->short_descr));
ingameCount = 0;
for (obj=object_list; obj != NULL; obj=obj->next)
if (obj->pIndexData->vnum == obj_index->vnum) {
ingameCount++;
if (obj->carried_by != NULL)
char_printf(ch,
" Carried by %s\n", obj->carried_by->name);
else if (obj->in_room != NULL)
char_printf(ch, " At {D[{W%7d{D]{x %s\n",
obj->in_room->vnum,
mlstr_cval(obj->in_room->name, ch));
else if (obj->in_obj != NULL)
char_printf(ch, " In {D[{W%7d{D]{x %s\n",
obj->in_obj->pIndexData->vnum,
mlstr_mval(obj->in_obj->short_descr));
}
char_printf(ch, " {c%d {wfound in game. {c%d {wshould be in pFiles.{x\n",
ingameCount, obj_index->count-ingameCount);
return;
}
nMatch = 0;
for (vnum = 0; nMatch < top_obj_index; vnum++)
if ((obj_index = get_obj_index(vnum)) != NULL) {
nMatch++;
if (obj_index->limit != -1) {
lCount++;
build_points(obj_index, &bp, &bpmax);
char_printf(ch, "{D[{%c%7d{D] {%c%3d{w of {C%3d{D max"
" {c%3d{Dlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(obj_index->count > obj_index->limit) ? 'R' : 'c',
obj_index->count,
obj_index->limit,
obj_index->level,
mlstr_mval(obj_index->short_descr));
}
}
char_printf(ch, "\n{c%d{w of {c%d {wobjects are limited.{x\n", lCount, nMatch);
}
void do_rare(CHAR_DATA *ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
extern int top_obj_index;
OBJ_DATA *obj;
OBJ_INDEX_DATA *obj_index;
int lCount = 0;
int ingameCount;
int nMatch;
int vnum;
int min_level,
max_level,
tmp;
int bp = 0,
bpmax = 0;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0') {
char_puts("Syntax: rare [min-level] [max-level]\n"
" or: rare [vnum]\n", ch);
return;
}
if (arg2[0] == '\0') {
obj_index = get_obj_index(atoi(arg1));
if (obj_index == NULL) {
char_puts("Not found.\n", ch);
return;
}
if (IS_SET(obj_index->extra_flags, ITEM_RARE)) {
char_puts("Thats not a rare item.\n", ch);
return;
}
nMatch = 0;
build_points(obj_index, &bp, &bpmax);
char_printf(ch, "{D[{%c%7d{D] {%c%3d{w of {C%3d{D max"
" {c%3d{xlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(obj_index->count > obj_index->limit) ? 'R' : 'c',
obj_index->count,
obj_index->limit,
obj_index->level,
mlstr_mval(obj_index->short_descr));
ingameCount = 0;
for (obj=object_list; obj != NULL; obj=obj->next)
if (obj->pIndexData->vnum == obj_index->vnum) {
ingameCount++;
if (obj->carried_by != NULL)
char_printf(ch,
" Carried by %s\n", obj->carried_by->name);
else if (obj->in_room != NULL)
char_printf(ch, " At {D[{W%7d{D]{x %s\n",
obj->in_room->vnum,
mlstr_cval(obj->in_room->name, ch));
else if (obj->in_obj != NULL)
char_printf(ch, " In {D[{W%7d{D]{x %s\n",
obj->in_obj->pIndexData->vnum,
mlstr_mval(obj->in_obj->short_descr));
}
char_printf(ch, " {c%d {wfound in game. {c%d {wshould be in pFiles.{x\n",
ingameCount, obj_index->count-ingameCount);
return;
}
nMatch = 0;
min_level = atoi(arg1);
max_level = atoi(arg2);
if (min_level > max_level) {
tmp = min_level;
min_level = max_level;
max_level = tmp;
}
for (vnum = 0; nMatch < top_obj_index; vnum++)
if ((obj_index = get_obj_index(vnum)) != NULL) {
nMatch++;
if (obj_index->level >= min_level
&& obj_index->level <= max_level
&& IS_SET(obj_index->extra_flags, ITEM_RARE)) {
lCount++;
build_points(obj_index, &bp, &bpmax);
char_printf(ch, "{D[{%c%7d{D] {%c%3d{w of {C%3d{D max"
" {c%3d{Dlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(obj_index->count > obj_index->limit) ? 'R' : 'c',
obj_index->count,
obj_index->limit,
obj_index->level,
mlstr_mval(obj_index->short_descr));
}
}
char_printf(ch, "\n{c%d{w of {c%d {wobjects are rare.{x\n", lCount, nMatch);
}
/*
* Syntax: ofind [vnum]
* or: ofind type [pill|wand|armor|all] level [min] [max] flags [rare][noremove]
* or: ofind weapon [spear|dagger] level [min] [max] flags [flaming]
*
* by Zsuzsu
*/
void do_ofind (CHAR_DATA *ch, const char *argument)
{
extern int top_obj_index;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
int affect[APPLY_MAX][3]; /* [argument]->[loc][min][max] */
AFFECT_DATA *pAf;
OBJ_INDEX_DATA *obj_index;
BUFFER *output;
AREA_DATA *pArea;
int lCount = 0,
nMatch = 0,
vnum = 0,
min_level = 0,
max_level = 999,
bp = 0,
bpmax = 0,
item_type = 0,
extra_flags = 0,
wear_flag = 0,
weapon = -1,
tmp = 0,
min_vnum = 0,
bp_percent = -1,
min_weight = -1,
max_weight = -1,
max_vnum = top_obj_index;
int i;
bool is_limited = FALSE,
closed_area = FALSE;
const flag_t *f = NULL;
for (i = 0; i<APPLY_MAX; i++) affect[i][0] = APPLY_NONE;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0') {
char_puts(
"Syntax: ofind [vnum]\n"
" or: ofind [options]\n"
" level [min] [max]\n"
" type [pill|boat|light]\n"
" wear [neck|ring]\n"
" weapon [spear|dagger]\n"
/* " flags [rare] [noremove]\n"
" aff [flaming]\n"
*/ " weight [min] [max]\n"
" bp [percent] (>=)\n"
" affect [loc] [min] [max]\n"
" limited\n"
" closed (show closed areas)\n"
, ch);
return;
}
if (arg2[0] == '\0' && str_prefix(arg1, "limited")) {
ofind_vnum(ch, atoi(arg1));
return;
}
while (arg1[0] != '\0') {
if (arg2[0] == '\0')
argument = one_argument(argument, arg2, sizeof(arg2));
/*limited items*/
if (!str_prefix(arg1, "limited")) {
is_limited = TRUE;
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
continue;
}
/*level range*/
else if (!str_prefix(arg1, "levels")
|| !str_prefix(arg1, "lvls")) {
min_level = atoi(arg2);
argument = one_argument(argument, arg2, sizeof(arg2));
if (!isdigit(arg2[0])) {
max_level = min_level;
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
continue;
}
max_level = atoi(arg2);
if (min_level > max_level) {
tmp = min_level;
min_level = max_level;
max_level = tmp;
}
arg2[0] = '\0';
}
/*weight range*/
else if (!str_prefix(arg1, "weight")) {
min_weight = atoi(arg2);
argument = one_argument(argument, arg2, sizeof(arg2));
if (!isdigit(arg2[0])) {
max_weight = min_weight;
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
continue;
}
max_weight = atoi(arg2);
if (min_weight > max_weight) {
tmp = min_weight;
min_weight = max_weight;
max_weight = tmp;
}
arg2[0] = '\0';
}
/*item type*/
else if (!str_prefix(arg1, "type")) {
if ((f = flag_lookup(item_types, arg2)) == NULL) {
char_puts("What type?\n", ch);
show_flags(ch, item_types);
return;
}
SET_BIT(item_type, f->bit);
arg2[0] = '\0';
}
/*wear location*/
else if (!str_prefix(arg1, "wear")
|| !str_prefix(arg1, "location")) {
if ((f = flag_lookup(wear_flags, arg2)) == NULL) {
char_puts("Wear where?\n", ch);
show_flags(ch, wear_flags);
return;
}
SET_BIT(wear_flag, f->bit);
arg2[0] = '\0';
}
/*weapon class*/
else if (!str_prefix(arg1, "weapon")) {
SET_BIT(item_type, ITEM_WEAPON);
if ((weapon = flag_value(weapon_class, arg2)) < 0) {
char_puts("What kind of weapon?\n", ch);
show_flags(ch, weapon_class);
return;
}
arg2[0] = '\0';
}
/* only for a certain area */
else if (!str_prefix(arg1, "area")) {
pArea = area_lookup(atoi(arg2));
if (!pArea) {
char_printf(ch,
"Can't find area #%s.\n", arg2);
return;
}
min_vnum = pArea->min_vnum;
max_vnum = pArea->max_vnum;
arg2[0] = '\0';
}
/* build point percentage */
else if (!str_cmp(arg1, "bp")) {
bp_percent = atoi(arg2);
arg2[0] = '\0';
}
/* show closed area items */
else if (!str_prefix(arg1, "closed")) {
closed_area = TRUE;
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
}
/*affects*/
else if (!str_prefix(arg1, "affect")) {
int location;
if ((location = flag_value(apply_flags, arg2)) < 0) {
char_printf(ch, "Affect '%s' invalid\n"
"Valid Affects are:\n", arg2);
show_flags(ch, apply_flags);
return;
}
for (i=0;
i < APPLY_MAX && affect[i][0] != APPLY_NONE; i++);
if (i >= APPLY_MAX) {
char_puts("Too many affects, sorry.\n", ch);
return;
}
affect[i][0] = location;
argument = one_argument(argument, arg2, sizeof(arg2));
if (!isdigit(arg2[0])) {
affect[i][1] = affect[i][2] = 0;
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
continue;
}
affect[i][1] = atoi(arg2);
argument = one_argument(argument, arg2, sizeof(arg2));
if (!isdigit(arg2[0])) {
affect[i][2] = affect[i][1];
strnzcpy(arg1, sizeof(arg1), arg2);
arg2[0] = '\0';
continue;
}
affect[i][2] = atoi(arg2);
if (affect[i][1] > affect[i][2]) {
tmp = affect[i][1];
affect[i][1] = affect[i][2];
affect[i][2] = tmp;
}
arg2[0] = '\0';
}
argument = one_argument(argument, arg1, sizeof(arg1));
}
output = buf_new(-1);
/* now do the search */
for (vnum = min_vnum; nMatch < max_vnum; vnum++)
if ((obj_index = get_obj_index(vnum)) != NULL) {
nMatch++;
if (is_limited && !IS_OBJ_LIMITED(obj_index))
continue;
if (obj_index->level < min_level
|| obj_index->level > max_level)
continue;
if (item_type
&& obj_index->item_type != item_type)
continue;
if (min_weight > -1
&& (obj_index->weight < min_weight
|| obj_index->weight > max_weight))
continue;
if (wear_flag
&& !IS_SET(obj_index->wear_flags, wear_flag))
continue;
if (extra_flags
&& !IS_SET(obj_index->extra_flags, extra_flags))
continue;
if (weapon >= 0
&& obj_index->value[ITEM_WEAPON_TYPE] != weapon)
continue;
if (bp_percent != -1) {
build_points(obj_index, &bp, &bpmax);
if (bp_percent == 101) {
if (bp <= bpmax)
continue;
}
else if (bp == 0 && bp_percent != 0)
continue;
else if (bp*100 < bpmax * bp_percent)
continue;
}
if (affect[0][0] != APPLY_NONE) {
bool has_affect = FALSE;
for (i = 0;
i < APPLY_MAX && affect[i][0] != APPLY_NONE;
i++) {
pAf = obj_index->affected;
while(pAf && !has_affect) {
has_affect =
(affect[i][0] == pAf->location
&& pAf->modifier >= affect[i][1]
&& pAf->modifier <= affect[i][2]);
pAf = pAf->next;
}
if (!has_affect) break;
}
if (!has_affect)
continue;
}
pArea = area_vnum_lookup(obj_index->vnum);
if (!closed_area && IS_SET(pArea->flags, AREA_CLOSED))
continue;
lCount++;
if (bp_percent == -1)
build_points(obj_index, &bp, &bpmax);
buf_printf(output, "{D[{%c%7d{D] {%c%3d{w of {%c%3d{D max"
" {%c%3d{Dlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(IS_SET(pArea->flags, AREA_CLOSED)
&& obj_index->count > 0) ? 'Y':
(obj_index->limit == -1) ? 'c' :
(obj_index->count > obj_index->limit) ? 'R' : 'C',
obj_index->count,
IS_SET(pArea->flags, AREA_CLOSED)
|| obj_index->limit == -1 ? 'D' : 'C',
obj_index->limit,
IS_SET(pArea->flags, AREA_CLOSED) ? 'D' : 'c',
obj_index->level,
mlstr_mval(obj_index->short_descr));
}
buf_printf(output, "\n {c%d{w of {c%d {wobjects fit that criteria.{x\n",
lCount, nMatch);
page_to_char(buf_string(output), ch);
buf_free(output);
}
void ofind_vnum (CHAR_DATA *ch, int vnum)
{
OBJ_DATA *obj;
OBJ_INDEX_DATA *obj_index;
int ingameCount;
int nMatch;
int bp = 0,
bpmax = 0;
obj_index = get_obj_index(vnum);
if (obj_index == NULL) {
char_puts("Not found.\n", ch);
return;
}
nMatch = 0;
build_points(obj_index, &bp, &bpmax);
char_printf(ch, "{D[{%c%7d{D] {%c%3d{w of {C%3d{D max"
" {c%3d{xlvl {W:{x %s\n",
build_point_percent_color(bp, bpmax),
obj_index->vnum,
(obj_index->count > obj_index->limit) ? 'R' : 'c',
obj_index->count,
obj_index->limit,
obj_index->level,
mlstr_mval(obj_index->short_descr));
ingameCount = 0;
for (obj=object_list; obj != NULL; obj=obj->next)
if (obj->pIndexData->vnum == obj_index->vnum) {
ingameCount++;
if (obj->carried_by != NULL)
char_printf(ch,
" Carried by %s\n", obj->carried_by->name);
else if (obj->in_room != NULL)
char_printf(ch, " At {D[{W%7d{D]{x %s\n",
obj->in_room->vnum,
mlstr_cval(obj->in_room->name, ch));
else if (obj->in_obj != NULL)
char_printf(ch, " In {D[{W%7d{D]{x %s\n",
obj->in_obj->pIndexData->vnum,
mlstr_mval(obj->in_obj->short_descr));
}
char_printf(ch, " {c%d {wfound in game. {c%d {wshould be in pFiles.{x\n",
ingameCount, obj_index->count-ingameCount);
}
void do_wiznet(CHAR_DATA *ch, const char *argument)
{
int flag;
if (argument[0] == '\0') {
/* show wiznet status */
BUFFER *output;
output = buf_new(-1);
buf_printf(output, "Wiznet status: %s\n",
IS_SET(ch->pcdata->wiznet, WIZ_ON) ? "ON" : "OFF");
buf_add(output, "\nlvl | channel | status");
buf_add(output, "\n----|------------------|-------\n");
for (flag = 0; wiznet_table[flag].name != NULL; flag++) {
if (wiznet_table[flag].level == ML)
continue;
if (wiznet_table[flag].level > ch->level)
continue;
buf_printf(output, "%3d | {%c%-17s{x| %s{x\n",
wiznet_table[flag].level,
wiznet_table[flag].level > ch->level ? 'D' : 'W',
wiznet_table[flag].name,
wiznet_table[flag].level > ch->level ?
"{DN/A" :
IS_SET(ch->pcdata->wiznet, wiznet_table[flag].flag) ?
"{GON" : "{rOFF");
}
page_to_char(buf_string(output), ch);
buf_free(output);
return;
}
if (!str_prefix(argument,"on")) {
char_puts("Welcome to Wiznet!\n", ch);
SET_BIT(ch->pcdata->wiznet, WIZ_ON);
return;
}
if (!str_prefix(argument,"off")) {
char_puts("Signing off of Wiznet.\n", ch);
REMOVE_BIT(ch->pcdata->wiznet, WIZ_ON);
return;
}
flag = wiznet_lookup(argument);
if (flag == -1
|| ch->level < wiznet_table[flag].level
|| (wiznet_table[flag].level == ML && !IS_TRUSTED_IMP(ch))) {
char_puts("No such option.\n", ch);
return;
}
TOGGLE_BIT(ch->pcdata->wiznet, wiznet_table[flag].flag);
if (!IS_SET(ch->pcdata->wiznet, wiznet_table[flag].flag))
char_printf(ch,"You will no longer see %s on wiznet.\n",
wiznet_table[flag].name);
else
char_printf(ch, "You will now see %s on wiznet.\n",
wiznet_table[flag].name);
}
void wiznet2(flag64_t flag, int min_level, flag64_t flag_skip,
CHAR_DATA *ch, const char *format, ...)
{
DESCRIPTOR_DATA *d;
char msg[MAX_STRING_LENGTH];
va_list ap;
va_start(ap, format);
vsnprintf(msg, sizeof(msg), format, ap);
va_end(ap);
for (d = descriptor_list; d != NULL; d = d->next) {
CHAR_DATA *vch = d->original ? d->original : d->character;
if (d->connected != CON_PLAYING
|| !vch
|| vch->level < LEVEL_IMMORTAL
|| !IS_SET(vch->pcdata->wiznet, WIZ_ON)
|| (flag && !IS_SET(vch->pcdata->wiznet, flag))
|| (flag_skip && IS_SET(vch->pcdata->wiznet, flag_skip))
|| vch->level < min_level
|| vch == ch)
continue;
if (IS_SET(vch->pcdata->wiznet, WIZ_PREFIX))
act_puts("--> ", vch, NULL, NULL, TO_CHAR | ACT_NOLF,
POS_DEAD);
act_puts(msg, vch, NULL, ch, TO_CHAR, POS_DEAD);
}
}
void wiznet(const char *msg, CHAR_DATA *ch, const void *arg,
flag64_t flag, flag64_t flag_skip, int min_level)
{
DESCRIPTOR_DATA *d;
for (d = descriptor_list; d != NULL; d = d->next) {
CHAR_DATA *vch = d->original ? d->original : d->character;
if (d->connected != CON_PLAYING
|| !vch
|| vch->level < LEVEL_IMMORTAL
|| !IS_SET(vch->pcdata->wiznet, WIZ_ON)
|| (flag && !IS_SET(vch->pcdata->wiznet, flag))
|| (flag_skip && IS_SET(vch->pcdata->wiznet, flag_skip))
|| vch->level < min_level
|| vch == ch)
continue;
if (IS_SET(vch->pcdata->wiznet, WIZ_PREFIX))
act_puts("--> ", vch, NULL, NULL, TO_CHAR | ACT_NOLF,
POS_DEAD);
act_puts(msg, vch, arg, ch, TO_CHAR, POS_DEAD);
}
}
/*
* Death reports
* by Zsuzsu
*/
void wiznet_death(CHAR_DATA *killer, CHAR_DATA *victim, int death_type) {
if (killer == victim) {
wiznet("{W$N{x has {Rdied{x of natural causes.",
victim, NULL, WIZ_DEATHS, 0, 0);
return;
}
switch (death_type) {
case DEATH_DUEL:
wiznet("{W$N{x has lost a {Rduel{x to {W$t{x.",
victim, mlstr_mval(killer->short_descr),
WIZ_DEATHS, 0, 0);
break;
case DEATH_ENSLAVED:
wiznet("{W$N{x has been {renslaved{x by {W$t{x.",
victim, mlstr_mval(killer->short_descr),
WIZ_DEATHS, 0, 0);
break;
case DEATH_SLAY:
wiznet("{W$N{x was {rslain{x by $t.",
victim, mlstr_mval(killer->short_descr),
WIZ_DEATHS, 0, 0);
break;
case DEATH_KILL:
default:
if (IS_NPC(killer))
wiznet("{W$N{x was {Rkilled{x by $t.",
victim, mlstr_mval(killer->short_descr),
WIZ_DEATHS, 0, 0);
else {
wiznet("{W$N{x was {rmurdered{x by {W$t{x.",
victim, mlstr_mval(killer->short_descr),
WIZ_DEATHS, 0, 0);
log_printf("death: %s[%d] murdered by %s[%d](%d/%d)",
victim->name, victim->level,
killer->name, killer->level,
killer->hit, killer->max_hit);
}
}
}
void wiznet_theft(CHAR_DATA *ch, CHAR_DATA *victim,
OBJ_DATA *container, OBJ_DATA *obj,
int theft_type, int chance, bool success, int worth) {
BUFFER *output;
output = buf_new(-1);
switch (theft_type) {
case THEFT_STEAL:
buf_printf(output,
"{W$N{x {g%s{x ",
success ? "stole" : "failed to steal");
if (obj == NULL)
buf_printf(output,
"%d coins from %s",
worth,
mlstr_mval(victim->short_descr));
else
buf_printf(output,
"%s{D(%d){x from %s",
mlstr_mval(obj->short_descr),
worth/100,
mlstr_mval(victim->short_descr));
if (container != NULL)
buf_printf(output,
"'s %s",
mlstr_mval(container->short_descr));
if (chance > 0)
buf_printf(output,
" {D(chance %d%%){x", chance);
break;
case THEFT_PLANT:
buf_printf(output,
"{W$N{x {g%s{x ",
success ? "planted" : "failed to plant");
if (obj == NULL)
buf_printf(output,
"%d %s on %s",
(worth > 0) ? worth : worth*-1,
(worth > 0) ? "silver" : "gold",
mlstr_mval(victim->short_descr));
else
buf_printf(output,
"%s %s %s",
mlstr_mval(obj->short_descr),
container ? "in" : "on",
mlstr_mval(victim->short_descr));
if (container != NULL)
buf_printf(output,
"'s %s",
mlstr_mval(container->short_descr));
if (chance > 0)
buf_printf(output,
" {D(chance %d%%){x", chance);
break;
case THEFT_PAWN:
buf_printf(output,
"{W$N{x {g%s{x %s to %s for %d coins {D(worth %d){x.",
success ? "pawned" : "tried to pawn",
mlstr_mval(obj->short_descr),
mlstr_mval(victim->short_descr),
chance,
worth);
break;
case THEFT_SWITCH:
buf_printf(output,
"{W$N{x {g%s a switcheroo{x on %s of %s for %s {D(%d%%){x",
success ? "pulled" : "failed",
mlstr_mval(victim->short_descr),
mlstr_mval(obj->short_descr),
mlstr_mval(container->short_descr),
chance);
break;
}
wiznet(buf_string(output), ch, NULL, WIZ_ECONOMY, 0, 0);
buf_free(output);
}
void do_tick(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("tick area : area update\n",ch);
char_puts("tick char : char update\n",ch);
char_puts("tick room : room update\n",ch);
char_puts("tick track: track update\n",ch);
char_puts("tick obj : obj update\n",ch);
return;
}
if (is_name(arg, "area")) {
area_update();
char_puts("Area updated.\n", ch);
return;
}
if (is_name(arg, "char player")) {
char_update();
char_puts("Players updated.\n", ch);
return;
}
if (is_name(arg, "room")) {
room_update();
char_puts("Room updated.\n", ch);
return;
}
if (is_name(arg, "track")) {
track_update();
char_puts("Tracks updated.\n", ch);
return;
}
if (is_name(arg, "obj")) {
obj_update();
char_puts("Objects updated.\n", ch);
return;
}
do_tick(ch,str_empty);
return;
}
/* equips a character */
void do_outfit(CHAR_DATA *ch, const char *argument)
{
OBJ_DATA *obj;
class_t *cl = class_lookup(ch->class);
int sn,vnum;
if ((ch->level > 5 && !IS_IMMORTAL(ch))
|| IS_NPC(ch) || cl == NULL) {
char_puts("Find it yourself!\n",ch);
return;
}
if ((obj = get_eq_char(ch, WEAR_LIGHT)) == NULL)
{
obj = create_obj(get_obj_index(OBJ_VNUM_SCHOOL_BANNER), 0);
obj->cost = 0;
obj->condition = 100;
obj_to_char(obj, ch);
equip_char(ch, obj, WEAR_LIGHT);
}
if ((obj = get_eq_char(ch, WEAR_BODY)) == NULL)
{
obj = create_obj(get_obj_index(OBJ_VNUM_SCHOOL_VEST), 0);
obj->cost = 0;
obj->condition = 100;
obj_to_char(obj, ch);
equip_char(ch, obj, WEAR_BODY);
}
/* do the weapon thing */
if ((obj = get_eq_char(ch,WEAR_WIELD)) == NULL) {
sn = 0;
vnum = cl->weapon;
obj = create_obj(get_obj_index(vnum),0);
obj->condition = 100;
obj_to_char(obj,ch);
equip_char(ch,obj,WEAR_WIELD);
}
if (((obj = get_eq_char(ch,WEAR_WIELD)) == NULL
|| !IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS))
&& (obj = get_eq_char(ch, WEAR_SHIELD)) == NULL)
{
obj = create_obj(get_obj_index(OBJ_VNUM_SCHOOL_SHIELD), 0);
obj->cost = 0;
obj->condition = 100;
obj_to_char(obj, ch);
equip_char(ch, obj, WEAR_SHIELD);
}
char_puts("You have been equipped by gods.\n",ch);
}
void do_smote(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *vch;
const char *letter, *name;
char last[MAX_INPUT_LENGTH], temp[MAX_STRING_LENGTH];
int matches = 0;
if (!IS_NPC(ch) && IS_SET(ch->restricted_channels, CHAN_GLOBAL_EMOTE)) {
char_puts("You can't show your emotions.\n", ch);
return;
}
if (argument[0] == '\0') {
char_puts("Emote what?\n", ch);
return;
}
if (strstr(argument,ch->name) == NULL) {
char_puts("You must include your name in an smote.\n",ch);
return;
}
char_printf(ch, "%s\n", argument);
for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) {
if (vch->desc == NULL || vch == ch)
continue;
if ((letter = strstr(argument,vch->name)) == NULL) {
char_printf(ch, "%s\n", argument);
continue;
}
strnzcpy(temp, sizeof(temp), argument);
temp[strlen(argument) - strlen(letter)] = '\0';
last[0] = '\0';
name = vch->name;
for (; *letter != '\0'; letter++) {
if (*letter == '\'' && matches == strlen(vch->name)) {
strnzcat(temp, sizeof(temp), "r");
continue;
}
if (*letter == 's' && matches == strlen(vch->name)) {
matches = 0;
continue;
}
if (matches == strlen(vch->name))
matches = 0;
if (*letter == *name) {
matches++;
name++;
if (matches == strlen(vch->name)) {
strnzcat(temp, sizeof(temp), "you");
last[0] = '\0';
name = vch->name;
continue;
}
strnzncat(last, sizeof(last), letter, 1);
continue;
}
matches = 0;
strnzcat(temp, sizeof(temp), last);
strnzncat(temp, sizeof(temp), letter, 1);
last[0] = '\0';
name = vch->name;
}
char_printf(ch, "%s\n", temp);
}
}
void do_bamfin(CHAR_DATA *ch, const char *argument)
{
if (!IS_NPC(ch)) {
if (argument[0] == '\0') {
char_printf(ch, "Your poofin is '%s'\n",
ch->pcdata->bamfin);
return;
}
if (strstr(argument, ch->name) == NULL) {
char_puts("You must include your name.\n",ch);
return;
}
free_string(ch->pcdata->bamfin);
ch->pcdata->bamfin = str_dup(argument);
char_printf(ch, "Your poofin is now '%s'\n",
ch->pcdata->bamfin);
}
}
void do_bamfout(CHAR_DATA *ch, const char *argument)
{
if (!IS_NPC(ch)) {
if (argument[0] == '\0') {
char_printf(ch, "Your poofout is '%s'\n",
ch->pcdata->bamfout);
return;
}
if (strstr(argument,ch->name) == NULL) {
char_puts("You must include your name.\n", ch);
return;
}
free_string(ch->pcdata->bamfout);
ch->pcdata->bamfout = str_dup(argument);
char_printf(ch, "Your poofout is now '%s'\n",
ch->pcdata->bamfout);
}
}
void do_deny(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Deny whom?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (IS_NPC(victim)) {
char_puts("Not on NPC's.\n", ch);
return;
}
if (victim->level >= ch->level) {
char_puts("You failed.\n", ch);
return;
}
SET_BIT(victim->state_flags, STATE_DENY);
char_puts("You are denied access!\n", victim);
wiznet("$N denies access to $i",
ch, victim, WIZ_PENALTIES, 0, 0);
char_puts("Ok.\n", ch);
save_char_obj(victim, FALSE);
stop_fighting(victim, TRUE);
quit_char(victim, 0);
}
void do_disconnect(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Disconnect whom?\n", ch);
return;
}
if (is_number(arg)) {
int desc;
desc = atoi(arg);
for (d = descriptor_list; d != NULL; d = d->next) {
if (d->descriptor == desc) {
close_descriptor(d);
char_puts("Ok.\n", ch);
return;
}
}
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (victim->desc == NULL) {
act("$N doesn't have a descriptor.", ch, NULL, victim, TO_CHAR);
return;
}
for (d = descriptor_list; d != NULL; d = d->next)
if (d == victim->desc) {
close_descriptor(d);
char_puts("Ok.\n", ch);
return;
}
bug("Do_disconnect: desc not found.", 0);
char_puts("Descriptor not found!\n", ch);
return;
}
void do_echo(CHAR_DATA *ch, const char *argument)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0') {
char_puts("Global echo what?\n", ch);
return;
}
for (d = descriptor_list; d; d = d->next)
if (d->connected == CON_PLAYING) {
if (d->character->level >= ch->level)
char_puts("global> ", d->character);
char_printf(d->character, "%s\n", argument);
}
}
void do_recho(CHAR_DATA *ch, const char *argument)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0') {
char_puts("Local echo what?\n", ch);
return;
}
for (d = descriptor_list; d; d = d->next)
if (d->connected == CON_PLAYING
&& d->character->in_room == ch->in_room) {
if (d->character->level >= ch->level)
char_puts("local> ",d->character);
char_printf(d->character, "%s\n", argument);
}
}
void do_zecho(CHAR_DATA *ch, const char *argument)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0') {
char_puts("Zone echo what?\n",ch);
return;
}
for (d = descriptor_list; d; d = d->next)
if (d->connected == CON_PLAYING
&& d->character->in_room != NULL && ch->in_room != NULL
&& d->character->in_room->area == ch->in_room->area) {
if (d->character->level >= ch->level)
char_puts("zone> ", d->character);
char_printf(d->character, "%s\n", argument);
}
}
void do_pecho(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
argument = one_argument(argument, arg, sizeof(arg));
if (argument[0] == '\0' || arg[0] == '\0') {
char_puts("Personal echo what?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (victim->level >= ch->level && ch->level != MAX_LEVEL)
char_puts("personal> ", victim);
char_printf(victim, "%s\n", argument);
char_printf(ch, "personal> %s\n", argument);
}
ROOM_INDEX_DATA *find_location(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *victim;
OBJ_DATA *obj;
if (is_number(argument))
return get_room_index(atoi(argument));
if ((victim = get_char_world(ch, argument)) != NULL)
return victim->in_room;
if ((obj = get_obj_world(ch, argument)) != NULL)
return obj->in_room;
return NULL;
}
void do_transfer(CHAR_DATA *ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location, *from_room;
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0') {
char_puts("Transfer whom (and where)?\n", ch);
return;
}
if (!str_cmp(arg1, "all")) {
for (d = descriptor_list; d != NULL; d = d->next)
if (d->connected == CON_PLAYING
&& d->character != ch
&& d->character->in_room != NULL
&& can_see(ch, d->character))
doprintf(do_transfer, ch,
"%s %s", d->character->name, arg2);
return;
}
if ((victim = get_char_world(ch, arg1)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (victim->in_room == NULL) {
char_puts("They are in limbo.\n", ch);
return;
}
/*
* Thanks to Grodyn for the optional location parameter.
*/
if (arg2[0]) {
if ((location = find_location(ch, arg2)) == NULL) {
char_puts("No such location.\n", ch);
return;
}
if (room_is_private(location) && ch->level < MAX_LEVEL) {
char_puts("That room is private right now.\n", ch);
return;
}
} else {
if (ch->in_room == victim->in_room
&& victim->last_transfer != NULL)
location = victim->last_transfer;
else
location = ch->in_room;
}
if (victim->fighting != NULL)
stop_fighting(victim, TRUE);
act("$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM);
from_room = victim->in_room;
char_from_room(victim);
/*Zz*/
if (ch->in_room == location) {
char_printf(ch, "{D[{W%d{D]{w %s arrives from a puff of smoke.",
from_room->vnum,
mlstr_mval(victim->short_descr));
act("$N arrives from a puff of smoke.",
ch, NULL, victim, TO_NOTVICT);
}
else {
act("$N arrives from a puff of smoke.",
location->people, NULL, victim, TO_NOTVICT);
act("$N transfered.", ch, NULL, victim, TO_CHAR);
}
victim->last_transfer = from_room;
if (ch != victim)
act("$n has transferred you.", ch, NULL, victim, TO_VICT);
char_to_room(victim, location);
if (JUST_KILLED(victim))
return;
do_look(victim, "auto");
}
void do_at(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
ROOM_INDEX_DATA *original;
OBJ_DATA *on;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0' || argument[0] == '\0') {
char_puts("At where what?\n", ch);
return;
}
if ((location = find_location(ch, arg)) == NULL) {
char_puts("No such location.\n", ch);
return;
}
if (room_is_private(location)
&& ch->level < MAX_LEVEL) {
char_puts("That room is private right now.\n", ch);
return;
}
original = ch->in_room;
on = ch->on;
char_from_room(ch);
char_to_room(ch, location);
if (JUST_KILLED(ch))
return;
interpret(ch, argument);
/* handle 'at xxx quit' */
if (JUST_KILLED(ch) || ch->extracted)
return;
char_from_room(ch);
char_to_room(ch, original);
if (JUST_KILLED(ch))
return;
ch->on = on;
}
void do_goto(CHAR_DATA *ch, const char *argument)
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
CHAR_DATA *pet = NULL;
if (argument[0] == '\0') {
char_puts("Goto where?\n", ch);
return;
}
if ((location = find_location(ch, argument)) == NULL) {
char_puts("No such location.\n", ch);
return;
}
if (ch->level < LEVEL_IMMORTAL) {
if (ch->fighting) {
char_puts("No way! You are fighting.\n", ch);
return;
}
if (IS_PUMPED(ch)) {
act_puts("You are too pumped to pray now.",
ch, NULL, NULL, TO_CHAR, POS_DEAD);
return;
}
#if 0
if (!IS_SET(ch->in_room->room_flags, ROOM_PEACE)) {
char_puts("You must be in a safe place in order "
"to make a transportation.\n", ch);
return;
}
#endif
if (!IS_BUILDER(ch, location->area)
|| !IS_BUILDER(ch, ch->in_room->area)) {
char_puts("You cannot transfer yourself there.\n", ch);
return;
}
}
if (ch->fighting != NULL)
stop_fighting(ch, TRUE);
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (IS_TRUSTED(rch, ch->invis_level)) {
if (ch->pcdata != NULL
&& ch->pcdata->bamfout[0] != '\0')
act("$t", ch, ch->pcdata->bamfout,
rch, TO_VICT);
else
act("$n leaves in a swirling mist.", ch, NULL,
rch, TO_VICT);
}
if (ch->pet && ch->in_room == ch->pet->in_room)
pet = ch->pet;
char_from_room(ch);
for (rch = location->people; rch; rch = rch->next_in_room)
if (IS_TRUSTED(rch, ch->invis_level)) {
if (ch->pcdata
&& ch->pcdata->bamfin[0])
act("$t",
rch, ch->pcdata->bamfin, NULL, TO_CHAR);
else
act("$N appears in a swirling mist.",
rch, NULL, ch, TO_CHAR);
}
char_to_room(ch, location);
if (JUST_KILLED(ch))
return;
do_look(ch, "auto");
if (pet && !IS_AFFECTED(pet, AFF_SLEEP)) {
if (ch->pet->position != POS_STANDING)
do_stand(pet, str_empty);
char_from_room(pet);
char_to_room(pet, location);
}
}
void do_violate(CHAR_DATA *ch, const char *argument)
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
if (argument[0] == '\0') {
char_puts("Goto where?\n", ch);
return;
}
if ((location = find_location(ch, argument)) == NULL) {
char_puts("No such location.\n", ch);
return;
}
if (!room_is_private(location)) {
char_puts("That room isn't private, use goto.\n", ch);
return;
}
if (ch->fighting != NULL)
stop_fighting(ch, TRUE);
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (IS_TRUSTED(rch, ch->invis_level)) {
if (ch->pcdata != NULL
&& ch->pcdata->bamfout[0] != '\0')
act("$t", ch, ch->pcdata->bamfout,
rch, TO_VICT);
else
act("$n leaves in a swirling mist.", ch, NULL,
rch, TO_VICT);
}
char_from_room(ch);
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (IS_TRUSTED(rch, ch->invis_level)) {
if (ch->pcdata && ch->pcdata->bamfin[0] != '\0')
act("$t",
rch, ch->pcdata->bamfin, NULL, TO_CHAR);
else
act("$N appears in a swirling mist.",
rch, NULL, ch, TO_CHAR);
}
char_to_room(ch, location);
if (JUST_KILLED(ch))
return;
do_look(ch, "auto");
}
/* RT to replace the 3 stat commands */
void do_stat(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
ROOM_INDEX_DATA *location;
CHAR_DATA *victim;
const char *string;
string = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Syntax:\n", ch);
char_puts(" stat <name>\n", ch);
char_puts(" stat obj <name>\n", ch);
char_puts(" stat mob <name>\n", ch);
char_puts(" stat room <number>\n", ch);
char_puts(" stat desc <number>\n", ch);
return;
}
if (!str_prefix(arg, "room")) {
do_rstat(ch, string);
return;
}
if (!str_prefix(arg, "obj")) {
do_ostat(ch, string);
return;
}
if (!str_prefix(arg, "char")
|| !str_cmp(arg, "mob")) {
do_mstat(ch, string);
return;
}
if (!str_cmp(arg, "desc")) {
do_dstat(ch, string);
return;
}
/* do it the old way */
obj = get_obj_world(ch, argument);
if (obj != NULL) {
do_ostat(ch, argument);
return;
}
victim = get_char_world(ch, argument);
if (victim != NULL) {
do_mstat(ch, argument);
return;
}
location = find_location(ch, argument);
if (location != NULL) {
do_rstat(ch, argument);
return;
}
char_puts("Nothing by that name found anywhere.\n",ch);
}
void do_rstat(CHAR_DATA *ch, const char *argument)
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
ROOM_HISTORY_DATA *rh;
OBJ_DATA *obj;
CHAR_DATA *rch;
BUFFER *output;
int door;
one_argument(argument, arg, sizeof(arg));
location = (arg[0] == '\0') ? ch->in_room : find_location(ch, arg);
if (location == NULL) {
char_puts("No such location.\n", ch);
return;
}
if (ch->in_room != location
&& room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR)) {
char_puts("That room is private right now.\n", ch);
return;
}
output = buf_new(-1);
if (ch->in_room->affected_by)
buf_printf(output, "Affected by %s\n",
flag_string(raffect_flags, ch->in_room->affected_by));
if (ch->in_room->room_flags)
buf_printf(output, "Room Flags %s\n",
flag_string(room_flags, ch->in_room->room_flags));
mlstr_dump(output, "Name: ", location->name);
buf_printf(output, "Area: '%s'\nOwner: '%s'\n",
location->area->name,
location->owner);
buf_printf(output,
"Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n",
location->vnum,
location->sector_type,
location->light,
location->heal_rate,
location->mana_rate);
buf_printf(output, "Room flags: [%s].\n",
flag_string(room_flags, location->room_flags));
buf_add(output, "Description:\n");
mlstr_dump(output, str_empty, location->description);
if (location->ed != NULL) {
ED_DATA *ed;
buf_add(output, "Extra description keywords: '");
for (ed = location->ed; ed; ed = ed->next) {
buf_add(output, ed->keyword);
if (ed->next != NULL)
buf_add(output, " ");
}
buf_add(output, "'.\n");
}
buf_add(output, "Characters:");
for (rch = location->people; rch; rch = rch->next_in_room) {
if (can_see(ch,rch)) {
buf_add(output, " ");
one_argument(rch->name, buf, sizeof(buf));
buf_add(output, buf);
}
}
buf_add(output, ".\nObjects: ");
for (obj = location->contents; obj; obj = obj->next_content) {
buf_add(output, " ");
one_argument(obj->name, buf, sizeof(buf));
buf_add(output, buf);
}
buf_add(output, ".\n");
for (door = 0; door <= 5; door++) {
EXIT_DATA *pexit;
if ((pexit = location->exit[door]) != NULL) {
buf_printf(output, "Door: %d. To: %d. Key: %d. Exit flags: %d.\nKeyword: '%s'.\n",
door,
pexit->to_room.r == NULL ?
-1 : pexit->to_room.r->vnum,
pexit->key,
pexit->exit_info,
pexit->keyword);
mlstr_dump(output, "Description: ",
pexit->description);
}
}
buf_add(output, "Tracks:\n");
for (rh = location->history;rh != NULL;rh = rh->next)
buf_printf(output,"%s took door %i.\n", rh->name, rh->went);
send_to_char(buf_string(output), ch);
buf_free(output);
}
void do_ostat(CHAR_DATA *ch, const char *argument)
{
int i;
BUFFER *output;
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
int autow_avg = 0,
w_avg = 0,
avg_dnum = 0,
avg_dsize = 0;
bool from_world = FALSE;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Stat what?\n", ch);
return;
}
if ((obj = get_obj_room(ch, argument)) == NULL) {
if ((obj = get_obj_world(ch, argument)) == NULL) {
char_puts("Nothing like that in hell, heaven or earth.\n",ch);
return;
}
else
from_world = TRUE;
}
output = buf_new(-1);
buf_printf(output, "Name: %s\n", obj->name);
buf_printf(output, "Vnum: %d Type: %s Resets: %d\n",
obj->pIndexData->vnum,
flag_string(item_types, obj->pIndexData->item_type),
obj->pIndexData->reset_num);
buf_printf(output, "Wear: %s\n",
flag_string(wear_flags, obj->wear_flags));
buf_printf(output, "Extra: %s\n",
flag_string(extra_flags, obj->extra_flags));
buf_printf(output, "Number: %d/%d Weight: %d/%d/%d (10th pounds)\n",
1, get_obj_number(obj),
obj->weight, get_obj_weight(obj),get_true_weight(obj));
buf_printf(output,
"Level: %d Cost: %d Condition: %d Timer: %d Count: %d\n",
obj->level, obj->cost, obj->condition,
obj->timer, obj->pIndexData->count);
buf_printf(output,
"Material: %s MatDesc: %s\n",
obj->material->name,
obj->material_descr);
buf_printf(output,
"room: %d In object: %s Carried by: %s Wear_loc: %d\n",
obj->in_room == NULL ? 0 : obj->in_room->vnum,
obj->in_obj == NULL ? "(none)" : mlstr_mval(obj->in_obj->short_descr),
obj->carried_by == NULL ? "(none)" :
can_see(ch,obj->carried_by) ? obj->carried_by->name
: "someone",
obj->wear_loc);
if (!mlstr_null(obj->owner))
buf_printf(output,
"Owner: %s\n", mlstr_mval(obj->owner));
if (!mlstr_null(obj->killer))
buf_printf(output,
"Killer: %s\n", mlstr_mval(obj->killer));
mlstr_dump(output, "Short description: ", obj->short_descr);
mlstr_dump(output, "Long description: ", obj->description);
buf_printf(output, "Values: %d %d %d %d %d\n",
obj->value[0], obj->value[1], obj->value[2], obj->value[3],
obj->value[4]);
/* now give out vital statistics as per identify */
switch (obj->pIndexData->item_type) {
int i;
case ITEM_SCROLL:
case ITEM_POTION:
case ITEM_PILL:
buf_printf(output, "Level %d spells of:", obj->value[0]);
for (i = 1; i < 5; i++)
if (obj->value[i] >= 0)
buf_printf(output, " '%s'",
skill_name(obj->value[i]));
buf_add(output, ".\n");
break;
case ITEM_WAND:
case ITEM_STAFF:
buf_printf(output, "Has %d(%d) charges of level %d",
obj->value[ITEM_WAND_CHARGES_TOTAL],
obj->value[ITEM_WAND_CHARGES_REMAINING],
obj->value[ITEM_WAND_LEVEL]);
if (obj->value[ITEM_WAND_SPELL] >= 0)
buf_printf(output, " '%s'",
skill_name(obj->value[ITEM_WAND_SPELL]));
buf_add(output, ".\n");
break;
case ITEM_DRINK_CON:
buf_printf(output, "It holds %s-colored %s.\n",
liq_table[obj->value[ITEM_DRINK_TYPE]].liq_color,
liq_table[obj->value[ITEM_DRINK_TYPE]].liq_name);
break;
case ITEM_WEAPON:
buf_printf(output, "%s\n",
flag_string(weapon_class, obj->value[ITEM_WEAPON_TYPE]));
autow_avg = get_autoweapon(obj->pIndexData, &avg_dnum, &avg_dsize, 100);
w_avg = (1 + obj->value[ITEM_WEAPON_DICE_SIZE])
* obj->value[ITEM_WEAPON_DICE_NUM]/2;
buf_printf(output, "Dam Average: {%c%d {Dauto: %d (%d%%){x\n",
w_avg > autow_avg * 1.20 ? 'R' :
w_avg > autow_avg ? 'Y' :
w_avg > autow_avg * 0.90 ? 'G' :
w_avg > autow_avg * 0.80 ? 'B' : 'M',
w_avg, autow_avg,
(w_avg - autow_avg)*100 / autow_avg +100);
buf_printf(output, "Damage noun is %s.\n",
attack_table[obj->value[ITEM_WEAPON_ATTACK_TYPE]].noun);
if (obj->value[ITEM_WEAPON_FLAGS])
buf_printf(output,"Weapons flags: %s\n",
flag_string(weapon_type2,
obj->value[ITEM_WEAPON_FLAGS]));
break;
case ITEM_ARMOR:
buf_printf(output,
"Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n",
obj->value[ITEM_ARMOR_AC_PIERCE],
obj->value[ITEM_ARMOR_AC_BASH],
obj->value[ITEM_ARMOR_AC_SLASH],
obj->value[ITEM_ARMOR_AC_EXOTIC]);
break;
case ITEM_CONTAINER:
buf_printf(output,"Capacity: %d# Maximum weight: %d# flags: %s\n",
obj->value[ITEM_CONTAINER_WEIGHT],
obj->value[ITEM_CONTAINER_PER_ITEM_WEIGHT],
flag_string(cont_flags, obj->value[ITEM_CONTAINER_FLAGS]));
if (obj->value[ITEM_CONTAINER_WEIGHT_MULTI] != 100)
buf_printf(output,"Weight multiplier: %d%%\n",
obj->value[ITEM_CONTAINER_WEIGHT_MULTI]);
break;
}
if (obj->ed) {
ED_DATA *ed;
buf_add(output, "Extra description keywords: '");
for (ed = obj->ed; ed; ed = ed->next) {
buf_add(output, ed->keyword);
if (ed->next)
buf_add(output, " ");
}
buf_add(output, "'\n");
}
if (obj->pIndexData->ed) {
ED_DATA *ed;
buf_add(output, "pIndexData extra description keywords: '");
for (ed = obj->pIndexData->ed; ed; ed = ed->next) {
buf_add(output, ed->keyword);
if (ed->next)
buf_add(output, " ");
}
buf_add(output, "'\n");
}
if (!mlstr_null(obj->writtenDesc))
mlstr_dump(output, "WrittenDesc: ", obj->writtenDesc);
if (!IS_SET(obj->extra_flags, ITEM_ENCHANTED))
format_obj_affects(output, obj->pIndexData->affected,
FOA_F_NODURATION);
format_obj_affects(output, obj->affected, 0);
show_augment(ch, obj, output);
if (obj->pIndexData->oprogs) {
buf_add(output, "Object progs:\n");
for (i = 0; i < OPROG_MAX; i++)
if (obj->pIndexData->oprogs[i] != NULL)
buf_printf(output, "%s: {y%s{x\n",
optype_table[i],
oprog_name_lookup(obj->pIndexData->oprogs[i]));
}
buf_printf(output,"Damage condition : %d (%s)\n", obj->condition,
get_cond_alias(obj));
if (obj->stolen_from > 0)
buf_printf(output,"Stolen from [%d]\n",
obj->stolen_from);
for (i = 0; i < PAST_OWNER_MAX; i++) {
if (!IS_NULLSTR(obj->past_owner[i])) {
buf_printf(output,
"PastOwner[%d]: %s %s\n",
i,
obj->past_owner[i],
obj->past_owner_ip[i]);
}
}
if (from_world)
buf_printf(output, "Not in this room.\n");
buf_printf(output,
"Next: %s Next_content: %s\n",
obj->next == NULL ? "(none)" : mlstr_mval(obj->next->short_descr),
obj->next_content == NULL ? "(none)" : mlstr_mval(obj->next_content->short_descr));
send_to_char(buf_string(output), ch);
buf_free(output);
}
void do_mstat(CHAR_DATA *ch, const char *argument)
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
AFFECT_DATA *paf;
CHAR_DATA *victim;
BUFFER *output;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Stat whom?\n", ch);
return;
}
if ((victim = get_char_world(ch, argument))
&& IS_NPC(victim)) {
if ((victim = get_char_room(ch, argument)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
}
if (!victim) {
char_puts("They aren't here.\n", ch);
return;
}
output = buf_new(-1);
buf_printf(output,
"{yName:{x [{C%s{x] Vnum: {D[{W%6d{D]{x "
"Reset Zone: {D%s{x Room: [{c%6d{x]\n",
victim->name,
IS_NPC(victim) ? victim->pIndexData->vnum : 0,
(IS_NPC(victim) &&victim->zone) ? victim->zone->name : "?",
victim->in_room == NULL ? 0 : victim->in_room->vnum);
buf_printf(output,
"Level: {c%d{D + {c%d{x "
"Class: {c%s{x "
"Race: {c%s {D({c%s{D){x "
"Sex: {c%s{x\n",
victim->level,
victim->drain_level,
class_name(victim),
race_name(victim->race), race_name(ORG_RACE(victim)),
flag_string(gender_table, victim->sex));
if (IS_NPC(victim))
snprintf(buf, sizeof(buf), "{c%d{x", victim->alignment);
else {
snprintf(buf, sizeof(buf), "{c%s{D-{c%s{x",
flag_string(ethos_table, victim->ethos),
flag_string(align_names, NALIGN(victim)));
}
if (IS_NPC(victim))
buf_printf(output,
"Damage: {c%d{Dd{c%d{x "
"Message: {c%s{x\n",
victim->damage[DICE_NUMBER],
victim->damage[DICE_TYPE],
attack_table[victim->dam_type].noun);
buf_printf(output,
"Size: {c%s{x "
"Align: %s "
"Religion: {c%s{x.\n",
flag_string(size_table, victim->size),
buf,
IS_NPC(victim) || victim->religion > MAX_RELIGION-1
? "Zsuzsu"
: religion_table[victim->religion].leader);
buf_printf(output,
"Str: {C%2d{x({c%2d{x) "
"pierce: {c%5d{x "
"Wimpy: {c%4d{x "
"HP: {C%4d{D/{c%-4d{x\n",
get_curr_stat(victim,STAT_STR),
victim->perm_stat[STAT_STR],
GET_AC(victim,AC_PIERCE),
victim->wimpy,
victim->hit, victim->max_hit);
buf_printf(output,
"Int: {C%2d{x({c%2d{x) "
"bash: {c%5d{x "
"Trains: {c%2d{x "
"Mana: {C%4d{D/{c%-4d{x\n",
get_curr_stat(victim,STAT_INT),
victim->perm_stat[STAT_INT],
GET_AC(victim,AC_BASH),
victim->train,
victim->mana, victim->max_mana);
buf_printf(output,
"Wis: {C%2d{x({c%2d{x) "
"slash: {c%5d{x "
"Practs: {c%3d{x "
"Move: {C%4d{D/{c%-4d{x\n",
get_curr_stat(victim,STAT_WIS),
victim->perm_stat[STAT_WIS],
GET_AC(victim,AC_SLASH),
victim->practice,
victim->move, victim->max_move);
buf_printf(output,
"Dex: {C%2d{x({c%2d{x) "
"magic: {c%5d{x "
"Deaths: {c%3d{x ",
get_curr_stat(victim,STAT_DEX),
victim->perm_stat[STAT_DEX],
GET_AC(victim,AC_EXOTIC),
IS_NPC(victim) ? 0 : victim->pcdata->death);
if (!IS_NPC(victim) && ch->level == ML) {
buf_printf(output,
"{rPKs: %3d{D/{r%-3d{x",
victim->pcdata->pk_kills,
victim->pcdata->pk_deaths);
}
buf_add(output, "\n");
buf_printf(output,
"Con: {C%2d{x({c%2d{x) "
"saves: {c%5d{x "
"Hit: {C%4d{x "
"Exp: {c%6d{x\n",
get_curr_stat(victim,STAT_CON),
victim->perm_stat[STAT_CON],
victim->saving_throw,
GET_HITROLL(victim),
victim->exp);
buf_printf(output,
"Cha: {C%2d{x({c%2d{x) "
" "
"Dam: {C%4d{x "
"tnl: {c%6d{x\n",
get_curr_stat(victim,STAT_CHA),
victim->perm_stat[STAT_CHA],
GET_DAMROLL(victim),
IS_NPC(victim) ? 0 : exp_to_level(victim));
if (IS_TRUSTED_IMP(ch) && !IS_NPC(victim)) {
buf_printf(output,
"Lck: {C%2d{x({c%2d{x) "
"\n",
get_curr_stat(victim,STAT_LCK),
victim->perm_stat[STAT_LCK]);
buf_printf(output,
"Trends: Str: {C%2d{D/%2d{x"
" Int: {C%2d{D/%2d{x"
" Wis: {C%2d{D/%2d{x"
" Dex: {C%2d{D/%2d{x"
" Con: {C%2d{D/%2d{x"
" Cha: {C%2d{D/%2d{x\n",
victim->pcdata->trend_stat[STAT_STR]/victim->level,
victim->pcdata->trend_stat[STAT_STR],
victim->pcdata->trend_stat[STAT_INT]/victim->level,
victim->pcdata->trend_stat[STAT_INT],
victim->pcdata->trend_stat[STAT_WIS]/victim->level,
victim->pcdata->trend_stat[STAT_WIS],
victim->pcdata->trend_stat[STAT_DEX]/victim->level,
victim->pcdata->trend_stat[STAT_DEX],
victim->pcdata->trend_stat[STAT_CON]/victim->level,
victim->pcdata->trend_stat[STAT_CON],
victim->pcdata->trend_stat[STAT_CHA]/victim->level,
victim->pcdata->trend_stat[STAT_CHA]
);
buf_printf(output,
"LvlAvg: Str: {C%2d{D/%2d{x"
" Int: {C%2d{D/%2d{x"
" Wis: {C%2d{D/%2d{x"
" Dex: {C%2d{D/%2d{x"
" Con: {C%2d{D/%2d{x"
" Cha: {C%2d{D/%2d{x\n",
(victim->pcdata->stat_avg[STAT_STR][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_STR][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_STR][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_STR][STAT_AVG_NUM],
(victim->pcdata->stat_avg[STAT_INT][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_INT][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_INT][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_INT][STAT_AVG_NUM],
(victim->pcdata->stat_avg[STAT_WIS][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_WIS][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_WIS][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_WIS][STAT_AVG_NUM],
(victim->pcdata->stat_avg[STAT_DEX][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_DEX][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_DEX][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_DEX][STAT_AVG_NUM],
(victim->pcdata->stat_avg[STAT_CON][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_CON][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_CON][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_CON][STAT_AVG_NUM],
(victim->pcdata->stat_avg[STAT_CHA][STAT_AVG_NUM])
? victim->pcdata->stat_avg[STAT_CHA][STAT_AVG_TOTAL] /
victim->pcdata->stat_avg[STAT_CHA][STAT_AVG_NUM]
: 0,
victim->pcdata->stat_avg[STAT_CHA][STAT_AVG_NUM]
);
}
if (!IS_NPC(victim)) {
buf_printf(output,
"Thirst: {c%d{x Hunger: {c%d{x Full: {c%d{x "
"Drunk: {C%d{D/{c%d{x Bloodlust: {c%d{x Desire: {c%d{x\n",
victim->pcdata->condition[COND_THIRST],
victim->pcdata->condition[COND_HUNGER],
victim->pcdata->condition[COND_FULL],
victim->pcdata->condition[COND_DRUNK],
drunk_tolerance(victim),
victim->pcdata->condition[COND_BLOODLUST],
victim->pcdata->condition[COND_DESIRE]);
}
buf_printf(output,
"Gold: {Y%ld{x "
"Silver: {W%ld{x ",
victim->gold, victim->silver);
if (!IS_NPC(victim)) {
buf_printf(output,
"Bank Gold: {Y%ld{x "
"Silver: {W%ld{x\n",
victim->pcdata->bank_g,
victim->pcdata->bank_s);
}
buf_printf(output,
"Carry number: {C%d{D/{c%d{x "
"Carry weight: {C%ld{D/{c%ld{D (%d%%){x\n",
victim->carry_number,
can_carry_n(victim),
ch_weight_carried(victim),
ch_max_carry_weight(victim),
ENCUMBERANCE(victim));
if (!IS_NPC(victim)) {
buf_printf(output,
"Age: {c%3d{x "
"Played: {c%d{x "
"Last Level: {c%d{x "
"Timer: {c%d{x\n",
get_age(victim),
(int) (victim->played+current_time-victim->logon) / 3600,
victim->pcdata->last_level,
victim->timer);
}
if (!IS_NPC(victim)) {
buf_printf(output, "AlignKills: {c%d{x %s"
" {c%d{x %s"
" {c%d{x %s"
" {c%d{x %s\n",
victim->pcdata->align_killed[ALIGN_INDEX_NONE], "non",
victim->pcdata->align_killed[ALIGN_INDEX_GOOD], "good",
victim->pcdata->align_killed[ALIGN_INDEX_NEUTRAL], "neutral",
victim->pcdata->align_killed[ALIGN_INDEX_EVIL], "evil");
buf_printf(output, "AlignStanding: {c%s{x",
flag_string(standing_types, align_standing(victim)));
if (ch->level >= ML) {
buf_printf(output, " {c%d{x %s"
" {c%d{x %s"
" {c%d{x %s",
victim->pcdata->align_standing[ALIGN_INDEX_GOOD], "good",
victim->pcdata->align_standing[ALIGN_INDEX_NEUTRAL], "neutral",
victim->pcdata->align_standing[ALIGN_INDEX_EVIL], "evil");
}
buf_printf(output, "\n");
}
if (!IS_NPC(victim)) {
buf_printf(output, "Acct: [{c%s{x]\n",
flag_string(acct_flags, victim->acct_flags));
buf_printf(output, "Config: [{c%s{x]\n",
flag_string(plr_conf_flags, victim->conf_flags));
buf_printf(output, "State: [{c%s{x]\n",
flag_string(state_flags, victim->state_flags));
}
buf_printf(output, "Fixes: [{c%s{x]\n",
flag_string(fixed_flags, victim->fixed_flags));
if (victim->comm)
buf_printf(output, "Comm: [{c%s{x]\n",
flag_string(comm_flags, victim->comm));
if (victim->channels) {
channel_t *ct;
char color = 'x';
buf_printf(output, "Channels:[");
for (ct = channel_table; ct->name; ct++) {
if (victim->level >= ct->write_level
|| victim->level >= ct->read_level) {
if (IS_SET(victim->channels, ct->flag))
color = 'c';
else
color = 'D';
if (IS_SET(victim->restricted_channels, ct->flag))
color = 'r';
buf_printf(output, "{%c%s ", color, ct->name);
}
}
buf_printf(output, "{x]\n");
}
else
buf_printf(output, "Channels:[{Dnone{x]\n");
if (!IS_NPC(victim)
&& victim->pcdata->wiznet
&& (ch->level > victim->level
|| IS_TRUSTED_IMP(ch))) {
int flag;
char color = 'x';
buf_printf(output, "Wiznet: [");
for (flag = 0; wiznet_table[flag].name; flag++) {
if (wiznet_table[flag].level <= victim->level) {
if (IS_SET(victim->pcdata->wiznet,
wiznet_table[flag].flag))
color = 'c';
else
color = 'D';
buf_printf(output, "{%c%s ",
color, wiznet_table[flag].name);
}
}
buf_printf(output, "{x]\n");
}
if (IS_NPC(victim))
buf_printf(output, "Act: [{c%s{x]\n",
flag_string(act_flags,
victim->pIndexData->act));
if (IS_NPC(victim))
buf_printf(output, "Attr: [{c%s{x]\n",
flag_string(mob_attr_flags,
victim->pIndexData->attr_flags));
if (IS_NPC(victim) && victim->pIndexData->off_flags)
buf_printf(output, "Offense: [{c%s{x]\n",
flag_string(off_flags,
victim->pIndexData->off_flags));
if (victim->imm_flags)
buf_printf(output, "Immune: [{c%s{x]\n",
flag_string(imm_flags, victim->imm_flags));
if (victim->res_flags)
buf_printf(output, "Resist: [{c%s{x]\n",
flag_string(res_flags, victim->res_flags));
if (victim->vuln_flags)
buf_printf(output, "Vulner: [{c%s{x]\n",
flag_string(vuln_flags, victim->vuln_flags));
if (victim->affected_by)
buf_printf(output, "Affected [{C%s{x]\n",
flag_string(affect_flags, victim->affected_by));
for (paf = victim->affected; paf != NULL; paf = paf->next)
buf_printf(output,
"Spell: '{c%s{x' modifies {c%s{x by {c%d{x for {c%d{x hours with bits {c%s{x, level {c%d{x.\n",
skill_name(paf->type),
flag_string(apply_flags, paf->location),
paf->modifier,
paf->duration,
flag_string(affect_flags, paf->bitvector),
paf->level
);
if (IS_NPC(victim)) {
buf_printf(output, "Form: [{c%s{x]\n",
flag_string(form_flags, victim->form));
buf_printf(output, "Parts: [{c%s{x]\n",
flag_string(part_flags, victim->parts));
}
mlstr_dump(output, "Short description: ", victim->short_descr);
if (IS_NPC(victim))
mlstr_dump(output, "Long description: ", victim->long_descr);
if (IS_NPC(victim) && victim->spec_fun != 0)
buf_printf(output, "Mobile has special procedure {y%s{x.\n",
spec_name(victim->spec_fun));
buf_printf(output,
"Group: {c%d{x "
"Master: {c%s{x Leader: {c%s{x Pet: {c%s{x\n",
IS_NPC(victim) ? victim->group : 0,
victim->master ? victim->master->name : "(none)",
victim->leader ? victim->leader->name : "(none)",
victim->pet ? victim->pet->name : "(none)");
if (!IS_NPC(victim)) {
qtrouble_t *qt;
if (IS_ON_QUEST(victim)) {
buf_printf(output,
"QuestCnt: [{C%d{x] "
"QuestPnts: [{C%d{x] "
"Questnext: [{c%d{x]\n"
"Questgiver: [{c%d{x] ",
victim->pcdata->questcount,
victim->pcdata->questpoints,
victim->pcdata->questtime < 0 ?
-victim->pcdata->questtime : 0,
victim->pcdata->questgiver);
buf_printf(output,
"QuestCntDown: [{c%d{x] "
"QuestObj: [{c%d{x] "
"Questmob: [{c%d{x]\n",
victim->pcdata->questtime > 0 ?
victim->pcdata->questtime : 0,
victim->pcdata->questobj,
victim->pcdata->questmob);
}
else {
buf_printf(output,
"QuestCnt: [{C%d{x] "
"QuestPnts: [{C%d{x] "
"Questnext: [{c%d{x] "
"NOT QUESTING\n",
victim->pcdata->questcount,
victim->pcdata->questpoints,
victim->pcdata->questtime < 0 ?
-victim->pcdata->questtime : 0);
}
buf_add(output, "Quest Troubles: ");
for (qt = victim->pcdata->qtrouble; qt; qt = qt->next)
buf_printf(output, "[{W%d{x]{D-{x[{c%d{x] ",
qt->vnum, qt->count-1);
buf_add(output, "{x\n");
if (!IS_NULLSTR(victim->pcdata->twitlist))
buf_printf(output, "Twitlist: [{D%s{x]\n",
victim->pcdata->twitlist);
buf_printf(output, "Security: {c%d{x\n",
victim->pcdata->security);
if (!IS_NULLSTR(victim->pcdata->granted))
buf_printf(output, "Granted: [{y%s{x]\n",
victim->pcdata->granted);
}
if (IS_NPC(victim))
buf_printf(output,"Count: {c%d{x Killed: {c%d{x\n",
victim->pIndexData->count, victim->pIndexData->killed);
buf_printf(output,
"Fighting: {C%s{x "
"In_mind: [{c%s{x], Target: [{c%s{x]\n",
victim->fighting ? victim->fighting->name : "(none)" ,
victim->in_mind ? victim->in_mind : "none",
victim->target ? victim->target->name : "none");
buf_printf(output,
"Position: {c%s{x ",
flag_string(position_table, victim->position));
if (IS_PUMPED(victim))
buf_add(output, "Adrenaline is gushing.");
buf_add(output, "\n");
buf_printf(output,
"Last fought: [{c%s{x], Last fight time: [{c%s{x]\n",
victim->last_fought ? victim->last_fought->name : "none",
(victim->last_fight_time < 2) ? "-" : strtime(victim->last_fight_time));
buf_printf(output,
"CursedByWitch: {c%s{x ",
(victim->cursed_by_witch)
? victim->cursed_by_witch->name : "(none)");
if (!IS_NPC(victim)) {
buf_printf(output,
"SavedStalkers: {c%2d{x Enslaver: {c%s{x",
victim->pcdata->saved_stalkers,
(victim->pcdata->enslaver) ? victim->pcdata->enslaver : "(none)");
if (!IS_NULLSTR(victim->pcdata->pk_ok_list))
buf_printf(output, "\nPKOKlist: [{r%s{x]",
victim->pcdata->pk_ok_list);
if (!IS_NULLSTR(victim->pcdata->fake_ip)
&& ch->level > victim->level
&& IS_TRUSTED_IMP(ch)) {
buf_printf(output, "\nFakeIP: [{r%s{x]",
victim->pcdata->fake_ip);
}
}
buf_add(output, "\n");
page_to_char(buf_string(output), ch);
buf_free(output);
}
DO_FUN(do_dstat)
{
BUFFER *output;
DESCRIPTOR_DATA *d;
char arg[MAX_INPUT_LENGTH];
int desc;
one_argument(argument, arg, sizeof(arg));
if (!is_number(arg)) {
do_help(ch, "'WIZ STAT'");
return;
}
desc = atoi(arg);
for (d = descriptor_list; d; d = d->next)
if (d->descriptor == desc)
break;
if (!d) {
char_puts("dstat: descriptor not found\n", ch);
return;
}
output = buf_new(-1);
buf_printf(output, "Desc: [%d] Conn: [%d] "
"Outsize: [%d] Outtop: [%d]\n",
d->descriptor, d->connected, d->outsize, d->outtop);
buf_printf(output, "Inbuf: [%s]\n", d->inbuf);
buf_printf(output, "Incomm: [%s]\n", d->incomm);
buf_printf(output, "Repeat: [%d] Inlast: [%s]\n",
d->repeat, d->inlast);
if (d->character)
buf_printf(output, "Ch: [%s]\n", d->character->name);
if (d->original)
buf_printf(output, "Original: [%s]\n", d->original->name);
if (d->olced)
buf_printf(output, "OlcEd: [%s]\n", d->olced->name);
if (d->pString)
buf_printf(output, "pString: [%s]\n", *d->pString);
if (d->showstr_head)
buf_printf(output, "showstr_head: [%s]\n", d->showstr_head);
page_to_char(buf_string(output), ch);
buf_free(output);
}
void do_vnum(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
const char *string;
string = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Syntax:\n",ch);
char_puts(" vnum obj <name>\n",ch);
char_puts(" vnum mob <name>\n",ch);
return;
}
if (!str_cmp(arg, "obj")) {
do_ofind_old(ch, string);
return;
}
if (!str_cmp(arg, "mob") || !str_cmp(arg, "char")) {
do_mfind_old(ch, string);
return;
}
/* do both */
do_mfind_old(ch, argument);
do_ofind_old(ch, argument);
}
void do_mfind_old(CHAR_DATA *ch, const char *argument)
{
extern int top_mob_index;
char arg[MAX_INPUT_LENGTH];
MOB_INDEX_DATA *pMobIndex;
int vnum;
int nMatch;
bool found;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Find whom?\n", ch);
return;
}
found = FALSE;
nMatch = 0;
/*
* Yeah, so iterating over all vnum's takes 10,000 loops.
* Get_mob_index is fast, and I don't feel like threading another link.
* Do you?
* -- Furey
*/
for (vnum = 0; nMatch < top_mob_index; vnum++)
if ((pMobIndex = get_mob_index(vnum)) != NULL) {
nMatch++;
if (is_name(argument, pMobIndex->name)) {
found = TRUE;
char_printf(ch, "[%5d] %s\n", pMobIndex->vnum,
mlstr_mval(pMobIndex->short_descr));
}
}
if (!found)
char_puts("No mobiles by that name.\n", ch);
}
void do_ofind_old(CHAR_DATA *ch, const char *argument)
{
extern int top_obj_index;
char arg[MAX_INPUT_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
int vnum;
int nMatch;
bool found;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Find what?\n", ch);
return;
}
found = FALSE;
nMatch = 0;
/*
* Yeah, so iterating over all vnum's takes 10,000 loops.
* Get_obj_index is fast, and I don't feel like threading another link.
* Do you?
* -- Furey
*/
for (vnum = 0; nMatch < top_obj_index; vnum++)
if ((pObjIndex = get_obj_index(vnum)) != NULL) {
nMatch++;
if (is_name(argument, pObjIndex->name)) {
found = TRUE;
char_printf(ch, "[%5d] %s\n", pObjIndex->vnum,
mlstr_mval(pObjIndex->short_descr));
}
}
if (!found)
char_puts("No objects by that name.\n", ch);
}
void do_owhere(CHAR_DATA *ch, const char *argument)
{
BUFFER *buffer = NULL;
OBJ_DATA *obj;
OBJ_DATA *in_obj;
int number = 0, max_found = 200;
int vnum = 0;
bool limited = FALSE,
limited_pc = FALSE;
bool corpse_pc;
if (argument[0] == '\0') {
char_puts("Find what?\n",ch);
return;
}
vnum = atoi(argument);
if (ch->level >= L3) {
limited = !str_prefix("limited", argument);
limited_pc = !str_cmp(argument, "limited_pc");
}
corpse_pc = !str_cmp(argument, "corpse_pc");
for (obj = object_list; obj != NULL; obj = obj->next) {
if (!can_see_obj(ch, obj)
|| ((vnum && obj->pIndexData->vnum != vnum) ||
(limited && !IS_OBJ_LIMITED(obj->pIndexData)) ||
(!vnum && !limited && !is_name(argument, obj->name)))
|| (!IS_IMMORTAL(ch) && ch->level < obj->level))
continue;
if (buffer == NULL)
buffer = buf_new(-1);
for (in_obj = obj; in_obj->in_obj != NULL;
in_obj = in_obj->in_obj)
;
if (limited_pc
&& (in_obj->carried_by == NULL ||
IS_NPC(in_obj->carried_by)))
continue;
if (corpse_pc
&& in_obj->pIndexData->item_type != ITEM_CORPSE_PC)
continue;
if (in_obj->carried_by != NULL
&& (in_obj->carried_by->invis_level > ch->level
|| in_obj->carried_by->incog_level > ch->level))
continue;
number++;
if (in_obj->carried_by != NULL
&& can_see(ch,in_obj->carried_by)
&& in_obj->carried_by->in_room != NULL)
buf_printf(buffer,
"%3d) {D[{W%6d{D]{x %s is carried by %s {D[{wRoom {W%d{D]{x\n",
number,
obj->pIndexData->vnum,
mlstr_mval(obj->short_descr),
fix_short(PERS(in_obj->carried_by, ch)),
in_obj->carried_by->in_room->vnum);
else if (in_obj->in_room != NULL
&& can_see_room(ch, in_obj->in_room))
buf_printf(buffer, "%3d) {D[{W%6d{D]{x %s is in %s {D[{wRoom {W%d{D]{x\n",
number,
obj->pIndexData->vnum,
mlstr_mval(obj->short_descr),
mlstr_cval(in_obj->in_room->name, ch),
in_obj->in_room->vnum);
else
buf_printf(buffer, "%3d) {D[{W%6d{D]{x %s{x is somewhere\n",
number,
obj->pIndexData->vnum,
mlstr_mval(obj->short_descr));
if (number >= max_found)
break;
}
if (buffer == NULL)
char_puts("Nothing like that in heaven or earth.\n", ch);
else {
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
}
}
void do_mwhere(CHAR_DATA *ch, const char *argument)
{
BUFFER *buffer;
CHAR_DATA *victim;
int count = 0;
if (argument[0] == '\0') {
DESCRIPTOR_DATA *d;
/* show characters logged */
buffer = buf_new(-1);
for (d = descriptor_list; d != NULL; d = d->next)
{
if (d->character != NULL && d->connected == CON_PLAYING
&& d->character->in_room != NULL
&& d->character->in_room->area != NULL
&& can_see(ch,d->character)
&& can_see_room(ch,d->character->in_room))
{
victim = d->character;
count++;
if (d->original != NULL)
buf_printf(buffer,"%3d){D%-15.15s{w %-10.10s {D({r%s{D) {D[{W%6d{D]{w %s\n",
count,
victim->in_room->area->name,
victim->name,
mlstr_mval(victim->short_descr),
victim->in_room->vnum,
mlstr_mval(victim->in_room->name)
);
else
buf_printf(buffer,"%3d){D%-15.15s{w %-10.10s {D[{W%6d{D]{w %s\n",
count,
victim->in_room->area->name,
victim->name,
victim->in_room->vnum,
mlstr_mval(victim->in_room->name)
);
}
}
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
return;
}
buffer = NULL;
for (victim = char_list; victim; victim = victim->next)
if (victim->in_room
&& is_name(argument, victim->name)
&& can_see(ch,victim)) {
if (buffer == NULL)
buffer = buf_new(-1);
count++;
buf_printf(buffer, "%3d) {D[{W%6d{D]{w %-28s {D[{W%6d{D]{w %s\n",
count, IS_NPC(victim) ? victim->pIndexData->vnum : 0,
IS_NPC(victim) ?
mlstr_mval(victim->short_descr) : victim->name,
victim->in_room->vnum,
mlstr_mval(victim->in_room->name));
}
if (buffer) {
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
}
else
act("You didn't find any $T.", ch, NULL, argument, TO_CHAR);
}
void do_reboo(CHAR_DATA *ch, const char *argument)
{
char_puts("If you want to REBOOT, spell it out.\n", ch);
}
void do_shutdow(CHAR_DATA *ch, const char *argument)
{
char_puts("If you want to SHUTDOWN, spell it out.\n", ch);
}
void do_shutdown(CHAR_DATA *ch, const char *argument)
{
bool active;
char arg[MAX_INPUT_LENGTH];
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
do_help(ch, "SHUTDOWN");
return;
}
active = dfexist(TMP_PATH, SHUTDOWN_FILE);
if (!str_prefix(arg, "status")) {
char_printf(ch, "Shutdown status: %s\n",
active ? "active" : "inactive");
return;
}
if (!str_prefix(arg, "activate")) {
if (!active) {
FILE *fp = dfopen(TMP_PATH, SHUTDOWN_FILE, "w");
if (!fp) {
char_printf(ch, "Error: %s.\n",
strerror(errno));
return;
}
fclose(fp);
wiznet("$N has activated shutdown", ch, NULL, 0, 0, 0);
char_puts("Shutdown activated.\n", ch);
}
else
char_puts("Shutdown already activated.\n", ch);
return;
}
if (!str_prefix(arg, "deactivate") || !str_prefix(arg, "cancel")) {
if (!active)
char_puts("Shutdown already inactive.\n", ch);
else {
if (dunlink(TMP_PATH, SHUTDOWN_FILE) < 0) {
char_printf(ch, "Error: %s.\n",
strerror(errno));
return;
}
wiznet("$N has deactivated shutdown",
ch, NULL, 0, 0, 0);
char_puts("Shutdown deactivated.\n", ch);
}
return;
}
do_shutdown(ch, str_empty);
}
void do_protect(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *victim;
if (argument[0] == '\0') {
char_puts("Protect whom from snooping?\n",ch);
return;
}
if ((victim = get_char_world(ch,argument)) == NULL) {
char_puts("You can't find them.\n",ch);
return;
}
if (IS_SET(victim->comm,COMM_SNOOP_PROOF)) {
act_puts("$N is no longer snoop-proof.", ch, NULL, victim,
TO_CHAR, POS_DEAD);
char_puts("Your snoop-proofing was just removed.\n", victim);
REMOVE_BIT(victim->comm, COMM_SNOOP_PROOF);
}
else {
act_puts("$N is now snoop-proof.", ch, NULL, victim, TO_CHAR,
POS_DEAD);
char_puts("You are now immune to snooping.\n", victim);
SET_BIT(victim->comm, COMM_SNOOP_PROOF);
}
}
void do_snoop(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Snoop whom?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (victim->desc == NULL) {
char_puts("No descriptor to snoop.\n", ch);
return;
}
if (victim == ch) {
char_puts("Cancelling all snoops.\n", ch);
wiznet("$N stops being such a snoop.", ch, NULL, WIZ_SNOOPS,
0, ch->level);
for (d = descriptor_list; d != NULL; d = d->next)
if (d->snoop_by == ch->desc)
d->snoop_by = NULL;
return;
}
if (victim->desc->snoop_by != NULL) {
char_puts("Busy already.\n", ch);
return;
}
if (!is_room_owner(ch,victim->in_room)
&& ch->in_room != victim->in_room
&& room_is_private(victim->in_room)
&& !IS_TRUSTED(ch, IMPLEMENTOR)) {
char_puts("That character is in a private room.\n",ch);
return;
}
if (victim->level >= ch->level
|| IS_SET(victim->comm, COMM_SNOOP_PROOF)) {
char_puts("You failed.\n", ch);
return;
}
if (ch->desc != NULL)
for (d = ch->desc->snoop_by; d != NULL; d = d->snoop_by)
if (d->character == victim || d->original == victim) {
char_puts("No snoop loops.\n", ch);
return;
}
victim->desc->snoop_by = ch->desc;
wiznet("$N starts snooping on $i.",
ch, victim, WIZ_SNOOPS, 0, ch->level);
char_puts("Ok.\n", ch);
}
void do_switch(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Switch into whom?\n", ch);
return;
}
if (ch->desc == NULL)
return;
if (ch->desc->original != NULL) {
char_puts("You are already switched.\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (victim == ch) {
char_puts("Ok.\n", ch);
return;
}
if (!IS_NPC(victim)) {
char_puts("You can only switch into mobiles.\n", ch);
return;
}
if (!is_room_owner(ch,victim->in_room)
&& ch->in_room != victim->in_room
&& room_is_private(victim->in_room)
&& !IS_TRUSTED(ch,IMPLEMENTOR)) {
char_puts("That character is in a private room.\n", ch);
return;
}
if (victim->desc != NULL) {
char_puts("Character in use.\n", ch);
return;
}
wiznet("$N switches into $i.",
ch, victim, WIZ_SWITCHES, 0, ch->level);
ch->desc->character = victim;
ch->desc->original = ch;
victim->desc = ch->desc;
ch->desc = NULL;
/* change communications to match */
if (ch->prompt != NULL)
victim->prompt = str_qdup(ch->prompt);
victim->comm = ch->comm;
victim->lines = ch->lines;
if (IS_SET(ch->state_flags, STATE_LOG))
SET_BIT(victim->state_flags, STATE_LOG);
char_puts("You assume your new identity.\n", victim);
}
void do_return(CHAR_DATA *ch, const char *argument)
{
if (ch->desc == NULL)
return;
if (ch->desc->original == NULL)
return;
char_puts("You return to your original body.\n", ch);
if (ch->prompt != NULL) {
free_string(ch->prompt);
ch->prompt = NULL;
}
wiznet("$N returns from $i.",
ch->desc->original, ch,
WIZ_SWITCHES, 0, ch->desc->original->level);
REMOVE_BIT(ch->desc->character->state_flags, STATE_LOG);
ch->desc->character = ch->desc->original;
ch->desc->original = NULL;
ch->desc->character->desc = ch->desc;
ch->desc = NULL;
do_replay(ch, str_empty);
}
/* trust levels for load and clone */
bool obj_check(CHAR_DATA *ch, OBJ_DATA *obj)
{
if (IS_TRUSTED(ch, GOD)
|| (IS_TRUSTED(ch, IMMORTAL) && obj->level <= 20 && obj->cost <= 1000)
|| (IS_TRUSTED(ch, DEMI) && obj->level <= 10 && obj->cost <= 500)
|| (IS_TRUSTED(ch, ANGEL) && obj->level <= 5 && obj->cost <= 250)
|| (IS_TRUSTED(ch, AVATAR) && obj->level == 0 && obj->cost <= 100))
return TRUE;
else
return FALSE;
}
bool mob_check(CHAR_DATA *ch, CHAR_DATA *mob)
{
if ((mob->level > 20 && !IS_TRUSTED(ch, GOD))
|| (mob->level > 10 && !IS_TRUSTED(ch, IMMORTAL))
|| (mob->level > 5 && !IS_TRUSTED(ch, DEMI))
|| (mob->level > 0 && !IS_TRUSTED(ch, ANGEL))
|| !IS_TRUSTED(ch, AVATAR))
return FALSE;
else
return TRUE;
}
/* for clone, to insure that cloning goes many levels deep */
void recursive_clone(CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *clone)
{
OBJ_DATA *c_obj, *t_obj;
for (c_obj = obj->contains; c_obj != NULL; c_obj = c_obj->next_content)
if (obj_check(ch, c_obj)) {
t_obj = create_obj(c_obj->pIndexData, 0);
clone_obj(c_obj, t_obj);
obj_to_obj(t_obj, clone);
recursive_clone(ch, c_obj, t_obj);
}
}
/* command that is similar to load */
void do_clone(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
const char *rest;
CHAR_DATA *mob;
OBJ_DATA *obj;
rest = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Clone what?\n",ch);
return;
}
if (!str_prefix(arg,"object")) {
mob = NULL;
obj = get_obj_here(ch,rest);
if (obj == NULL) {
char_puts("You don't see that here.\n",ch);
return;
}
} else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character")) {
obj = NULL;
mob = get_char_room(ch,rest);
if (mob == NULL) {
char_puts("You don't see that here.\n",ch);
return;
}
} else { /* find both */
mob = get_char_room(ch,argument);
obj = get_obj_here(ch,argument);
if (mob == NULL && obj == NULL) {
char_puts("You don't see that here.\n",ch);
return;
}
}
/* clone an object */
if (obj) {
OBJ_DATA *clone;
if (!obj_check(ch,obj)) {
char_puts("You haven't enough power.\n", ch);
return;
}
clone = create_obj(obj->pIndexData, 0);
clone_obj(obj, clone);
if (obj->carried_by != NULL)
obj_to_char(clone, ch);
else
obj_to_room(clone, ch->in_room);
recursive_clone(ch, obj, clone);
act("$n has created $p.", ch, clone, NULL, TO_ROOM);
act("You clone $p.", ch, clone, NULL, TO_CHAR);
wiznet("$N clones $p.",
ch, clone, WIZ_LOAD, 0, ch->level);
return;
} else if (mob != NULL) {
CHAR_DATA *clone;
OBJ_DATA *new_obj;
if (!IS_NPC(mob)) {
char_puts("You can only clone mobiles.\n",ch);
return;
}
if (!mob_check(ch, mob)) {
char_puts("You haven't enough power.\n", ch);
return;
}
clone = create_mob(mob->pIndexData);
clone_mob(mob,clone);
for (obj = mob->carrying; obj != NULL; obj = obj->next_content)
if (obj_check(ch,obj)) {
new_obj = create_obj(obj->pIndexData, 0);
clone_obj(obj, new_obj);
recursive_clone(ch, obj, new_obj);
obj_to_char(new_obj, clone);
new_obj->wear_loc = obj->wear_loc;
}
act("$n has created $N.", ch, NULL, clone, TO_ROOM);
act("You clone $N.", ch, NULL, clone, TO_CHAR);
wiznet("$N clones $i.",
ch, clone, WIZ_LOAD, WIZ_SECURE, ch->level);
char_to_room(clone, ch->in_room);
}
}
/* RT to replace the two load commands */
void do_load(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
argument = one_argument(argument, arg, sizeof(arg));
if (ch->level <= L7 &&
!is_name(ch->name, ch->in_room->area->builders)) {
char_puts("You can't load here!\n", ch);
return;
}
if (arg[0] == '\0') {
char_puts("Syntax:\n", ch);
char_puts(" load mob <vnum>\n", ch);
char_puts(" load obj <vnum> <level>\n", ch);
return;
}
if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) {
do_mload(ch, argument);
return;
}
if (!str_cmp(arg,"obj")) {
do_oload(ch, argument);
return;
}
/* echo syntax */
do_load(ch,str_empty);
}
void do_mload(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *victim;
int vnum;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0' || !is_number(arg)) {
char_puts("Syntax: load mob <vnum>.\n", ch);
return;
}
if ((pMobIndex = get_mob_index(vnum = atoi(arg))) == NULL) {
char_printf(ch, "%d: No mob has that vnum.\n", vnum);
return;
}
victim = create_mob(pMobIndex);
act("$n has created $N!", ch, NULL, victim, TO_ROOM);
wiznet("$N loads $i.", ch, victim, WIZ_LOAD, 0, ch->level);
act("You have created $N!", ch, NULL, victim, TO_CHAR);
char_to_room(victim, ch->in_room);
}
void do_oload(CHAR_DATA *ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
int vnum;
argument = one_argument(argument, arg1, sizeof(arg1));
one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0' || !is_number(arg1)) {
char_puts("Syntax: load obj <vnum>.\n", ch);
return;
}
vnum = atoi(arg1);
if ((pObjIndex = get_obj_index(vnum)) == NULL) {
char_printf(ch, "%d: No objects with this vnum.\n", vnum);
return;
}
obj = create_obj(pObjIndex, 0);
if (CAN_WEAR(obj, ITEM_TAKE))
obj_to_char(obj, ch);
else
obj_to_room(obj, ch->in_room);
act("$n has created $p!", ch, obj, NULL, TO_ROOM);
wiznet("$N loads $p.", ch, obj, WIZ_LOAD, 0, ch->level);
act("You have created $p!", ch, obj, NULL, TO_CHAR);
}
void do_purge(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
DESCRIPTOR_DATA *d;
one_argument(argument, arg, sizeof(arg));
if (ch->level <= (L7) &&
!is_name(ch->name, ch->in_room->area->builders)) {
char_puts("You can't purge in this area!\n", ch);
return;
}
if (arg[0] == '\0') {
/* 'purge' */
CHAR_DATA *vnext;
OBJ_DATA *obj_next;
for (victim = ch->in_room->people; victim; victim = vnext) {
vnext = victim->next_in_room;
if (IS_NPC(victim)
&& !IS_SET(victim->pIndexData->act, ACT_NOPURGE)
&& victim != ch /* safety precaution */)
extract_char(victim, 0);
}
for (obj = ch->in_room->contents; obj != NULL; obj = obj_next) {
obj_next = obj->next_content;
if (!IS_OBJ_STAT(obj, ITEM_NOPURGE))
extract_obj(obj, 0);
}
act("$n purges the room!", ch, NULL, NULL, TO_ROOM);
char_puts("Ok.\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (!IS_NPC(victim)) {
if (ch == victim) {
char_puts("Ho ho ho.\n", ch);
return;
}
if (ch->level <= victim->level) {
char_puts("Maybe that wasn't a good idea...\n",ch);
char_printf(ch,"%s tried to purge you!\n",ch->name);
return;
}
act("$n disintegrates $N.", ch, 0, victim, TO_NOTVICT);
if (victim->level > 1)
save_char_obj(victim, FALSE);
d = victim->desc;
extract_char(victim, 0);
if (d)
close_descriptor(d);
return;
}
act("$n purges $N.", ch, NULL, victim, TO_NOTVICT);
extract_char(victim, 0);
}
void do_restore(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
CHAR_DATA *vch;
DESCRIPTOR_DATA *d;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0' || !str_cmp(arg,"room")) {
/* cure room */
for (vch = ch->in_room->people; vch; vch = vch->next_in_room) {
affect_strip(vch,gsn_plague);
affect_strip(vch,gsn_poison);
affect_strip(vch,gsn_blindness);
affect_strip(vch,gsn_sleep);
affect_strip(vch,gsn_curse);
vch->hit = vch->max_hit;
vch->mana = vch->max_mana;
vch->move = vch->max_move;
update_pos(vch);
act("$n has restored you.",ch,NULL,vch,TO_VICT);
}
wiznet("$N restored room $j.",
ch, (const void*) ch->in_room->vnum,
WIZ_RESTORE, 0, ch->level);
char_puts("Room restored.\n",ch);
return;
}
if (ch->level >= MAX_LEVEL - 1 && !str_cmp(arg,"all")) {
/* cure all */
for (d = descriptor_list; d != NULL; d = d->next) {
victim = d->character;
if (victim == NULL || IS_NPC(victim))
continue;
affect_strip(victim,gsn_plague);
affect_strip(victim,gsn_poison);
affect_strip(victim,gsn_blindness);
affect_strip(victim,gsn_sleep);
affect_strip(victim,gsn_curse);
victim->hit = victim->max_hit;
victim->mana = victim->max_mana;
victim->move = victim->max_move;
update_pos(victim);
if (victim->in_room != NULL)
act("$n has restored you.",ch,NULL,victim,TO_VICT);
}
char_puts("All active players restored.\n",ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
affect_strip(victim, gsn_plague);
affect_strip(victim, gsn_poison);
affect_strip(victim, gsn_blindness);
affect_strip(victim, gsn_sleep);
affect_strip(victim, gsn_curse);
victim->hit = victim->max_hit;
victim->mana = victim->max_mana;
victim->move = victim->max_move;
update_pos(victim);
act("$n has restored you.", ch, NULL, victim, TO_VICT);
wiznet("$N restored $i",
ch, victim, WIZ_RESTORE, 0, ch->level);
char_puts("Ok.\n", ch);
}
void do_freeze(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Freeze whom?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (IS_NPC(victim)) {
char_puts("Not on NPC's.\n", ch);
return;
}
if (victim->level >= ch->level) {
char_puts("You failed.\n", ch);
return;
}
TOGGLE_BIT(victim->state_flags, STATE_FREEZE);
if (!IS_SET(victim->state_flags, STATE_FREEZE)) {
char_puts("You can play again.\n", victim);
char_puts("FREEZE removed.\n", ch);
wiznet("$N thaws $i.",
ch, victim, WIZ_PENALTIES, 0, 0);
}
else {
char_puts("You can't do ANYthing!\n", victim);
char_puts("FREEZE set.\n", ch);
wiznet("$N puts $i in the deep freeze.",
ch, victim, WIZ_PENALTIES, 0, 0);
}
save_char_obj(victim, FALSE);
}
void do_log(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Log whom?\n", ch);
return;
}
if (!str_cmp(arg, "all")) {
if (fLogAll) {
fLogAll = FALSE;
char_puts("Log ALL off.\n", ch);
} else {
fLogAll = TRUE;
char_puts("Log ALL on.\n", ch);
}
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (IS_NPC(victim)) {
char_puts("Not on NPC's.\n", ch);
return;
}
/*
* No level check, gods can log anyone.
*/
TOGGLE_BIT(victim->state_flags, STATE_LOG);
if (!IS_SET(victim->state_flags, STATE_LOG))
char_puts("LOG removed.\n", ch);
else
char_puts("LOG set.\n", ch);
}
/* Coded by Thornan for Iceydepths */
void do_addlag(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *victim;
char arg[MAX_STRING_LENGTH];
int x;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
send_to_char("addlag to who?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
send_to_char("They're not here.\n", ch);
return;
}
if ((x = atoi(argument)) <= 0)
{
send_to_char("That makes a LOT of sense.\n", ch);
return;
}
if (x > 100)
{
send_to_char("There's a limit to cruel and unusual punishment\n", ch);
return;
}
send_to_char("Somebody REALLY didn't like you\n", victim);
WAIT_STATE(victim, x);
send_to_char("Adding lag now...\n", ch);
return;
}
/* void do_check(CHAR_DATA *ch, const char *argument)
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
BUFFER *buffer;
CHAR_DATA *victim;
int count = 1;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0'|| !str_prefix(arg,"stats"))
{
buffer = buf_new(ch->lang);
for (victim = char_list; victim != NULL; victim = victim->next)
{
if (IS_NPC(victim) || !can_see(ch,victim))
continue;
if (victim->desc == NULL)
{
sprintf(buf,"%3d) %s is linkdead.\n\r", count,
victim->name);
buf_add(buffer, buf);
count++;
continue;
}
if (victim->desc->connected >= CON_GET_NEW_RACE
&& victim->desc->connected <= CON_PICK_WEAPON)
{
sprintf(buf,"%3d) %s is being created.\n\r",
count, victim->name);
buf_add(buffer, buf);
count++;
continue;
}
if ( (victim->desc->connected == CON_GET_OLD_PASSWORD
|| victim->desc->connected >= CON_READ_IMOTD))
{
sprintf(buf,"%3d) %s is connecting.\n\r",
count, victim->name);
buf_add(buffer, buf);
count++;
continue;
}
if (victim->desc->connected == CON_PLAYING)
{
sprintf(buf,
"%3d) %s, Level %d connected since {M%d{x hours ({G%d total hours{x)\n\r",
count, victim->name,
victim->level, ((int)(current_time
- victim->pcdata->logon)) /3600,
(victim->pcdata->played + (int)(current_time
- victim->pcdata->logon)) /3600 );
buf_add(buffer, buf);
if (arg[0]!='\0' && !str_prefix(arg,
"stats")) {
sprintf(buf,
" {C%5d HP %5d M ({Y%2dstr %2dint %2dwis %2ddex %2dcon{x) {m%3d Tr %3d Pr {B%4d golds %d Qpts{x\n\r",
victim->max_hit,
victim->max_mana,
victim->perm_stat[STAT_STR],
victim->perm_stat[STAT_INT],
victim->perm_stat[STAT_WIS],
victim->perm_stat[STAT_DEX],
victim->perm_stat[STAT_CON],
victim->pcdata->train,
victim->pcdata->practice,
victim->gold
+ victim->silver/100,
victim->pcdata->questpoints);
buf_add(buffer, buf);
}
count++;
continue;
}
sprintf(buf,
"%3d) BUGGY (Oops!)...please report to Implemetators: "
"%s %d\n\r",
count, victim->name, victim->desc->connected);
buf_add(buffer, buf);
count++;
}
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
return;
}
if (!str_prefix(arg,"eq")) {
buffer = buf_new(ch->lang);
for (victim = char_list; victim != NULL;
victim = victim->next) {
if (IS_NPC(victim)
|| !victim->desc
|| victim->desc->connected != CON_PLAYING
|| !can_see(ch,victim))
continue;
sprintf(buf,
"%3d) %-10s, %2d items(weight %4d) {YHit:%2d, Dam:%2d, {WAC:%3d %3d %3d %3d, {ySav:%d{x\n\r",
count, victim->name, victim->carry_number,
victim->carry_weight, victim->hitroll,
victim->damroll,
victim->armor[AC_PIERCE],
victim->armor[AC_BASH],
victim->armor[AC_SLASH],
victim->armor[AC_EXOTIC],
buf_add(buffer, buf));
count++;
}
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
return;
}
if (!str_prefix(arg,"snoop")) {
char bufsnoop [100];
if(ch->level < MAX_LEVEL ) {
char_puts("You can't use this check option.\n\r",ch);
return;
}
buffer = buf_new(ch->lang);
for (victim = char_list; victim != NULL;
victim = victim->next) {
if (IS_NPC(victim)
|| !victim->desc
|| victim->desc->connected != CON_PLAYING
|| !can_see(ch,victim))
continue;
if(victim->desc->snoop_by != NULL)
sprintf(bufsnoop," %15s .",
victim->desc->snoop_by->character->name);
else
sprintf(bufsnoop," (none) ." );
sprintf(buf,"%3d %15s : %s \n\r",count,victim->name,
bufsnoop);
buf_add(buffer, buf);
count++;
}
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
return;
}
char_puts("{CSyntax: {W'check' {Ydisplay info about players\n\r",ch);
char_puts(" {W'check stats' {Ydisplay info and resume stats\n\r",ch);
char_puts(" {W'check eq' {Yresume eq of all players\n\r",ch);
char_puts(" {W'check snoop' {Ydisplay info about snoops\n\r",ch);
char_puts("{RUse the stat command in case of doubt about someone...{x\n\r",
ch);
return;
} */
void do_noexp(CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
//int gain;
// int xp;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0') {
char_puts("Freeze whom?\n", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL) {
char_puts("They aren't here.\n", ch);
return;
}
if (IS_NPC(victim)) {
char_puts("Not on NPC's.\n", ch);
return;
}
if (!IS_NPC(victim) && victim->level >= ch->level) {
char_puts("You failed to remove $i's exp gain.\n", ch);
return;
}
TOGGLE_BIT(victim->state_flags, STATE_NOEXP);
if (!IS_SET(victim->state_flags, STATE_NOEXP)) {
char_puts("You can gain experience again.\n", victim);
char_puts("NOEXP removed.\n", ch);
wiznet("$N 'gives' $i experience ability back.",
ch, victim, WIZ_PENALTIES, 0, 0);
}
else {
char_puts("You can't gain any experience!\n", victim);
char_puts("NOEXP set.\n", ch);
wiznet("$N removes $i 's experience ability.",
ch, victim, WIZ_PENALTIES, 0, 0);
}
save_char_obj(victim, FALSE);
}
void do_peace(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *rch;
for (rch = ch->in_room->people; rch; rch = rch->next_in_room) {
if (!rch->fighting)
continue;
stop_fighting(rch, TRUE);
if (IS_NPC(rch)) {
/*
* avoid aggressive mobs and hunting mobs attacks
*/
AFFECT_DATA af;
af.where = TO_AFFECTS;
af.type = gsn_reserved;
af.level = MAX_LEVEL;
af.duration = 15;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_CALM | AFF_SCREAM;
affect_to_char(rch, &af);
}
}
char_puts("Ok.\n", ch);
}
void do_wizlock(CHAR_DATA *ch, const char *argument)
{
extern bool wizlock;
wizlock = !wizlock;
if (wizlock) {
wiznet("$N has wizlocked the game.", ch, NULL, 0, 0, 0);
char_puts("Game wizlocked.\n", ch);
}
else {
wiznet("$N removes wizlock.", ch, NULL, 0, 0, 0);
char_puts("Game un-wizlocked.\n", ch);
}
}
/* RT anti-newbie code */
void do_newlock(CHAR_DATA *ch, const char *argument)
{
extern bool newlock;
newlock = !newlock;
if (newlock) {
wiznet("$N locks out new characters.", ch, NULL, 0, 0, 0);
char_puts("New characters have been locked out.\n", ch);
}
else {
wiznet("$N allows new characters back in.", ch, NULL, 0, 0, 0);
char_puts("Newlock removed.\n", ch);
}
}
/* award gives a char specified amount of qp or xp */
#define AWARD_XP 1
#define AWARD_QP 2
#define AWARD_GP 3
#define AWARD_RP 4
#define AWARD_PRAC 5
void do_award(CHAR_DATA *ch, const char *argument)
{
char Showing the first 100 KB of 180.3 KB. Download the archive for the full file.