act_wiz.c
muddy/src/act_wiz.c · 228.5 KB
From the archive astrum.tar.bz2
Download the archive « Back to the archive contents
/* $Id: act_wiz.c,v 1.666 2004/09/20 10:49:47 shrike Exp $ */
/************************************************************************************
* Copyright 2004 Astrum Metaphora consortium *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
************************************************************************************/
/************************************************************************************
* 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 *
*************************************************************************************/
/************************************************************************************
* Copyright (c) 1998 fjoe <fjoe@iclub.nsu.ru> *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND *
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE *
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
************************************************************************************/
#include <sys/types.h>
#if !defined (WIN32)
#include <sys/time.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#if !defined (WIN32)
#include <unistd.h>
#endif
#include "limited.h"
#include "merc.h"
#include "update.h"
#include "quest.h"
#include "obj_prog.h"
#include "fight.h"
#include "quest.h"
#include "db/cmd.h"
#include "db/db.h"
#include "db/dofun.h"
#include "skills.h"
#include "olc/olc.h"
#include "auction.h"
#include "conquer.h"
/* command procedures needed */
DECLARE_DO_FUN(do_rstat );
DECLARE_DO_FUN(do_mstat );
DECLARE_DO_FUN(do_ostat );
DECLARE_DO_FUN(do_dstat );
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 );
DECLARE_DO_FUN(do_ofind );
DECLARE_DO_FUN(do_mload );
DECLARE_DO_FUN(do_oload );
DECLARE_DO_FUN(do_quit );
DECLARE_DO_FUN(do_save );
DECLARE_DO_FUN(do_look );
DECLARE_DO_FUN(do_stand );
DECLARE_DO_FUN(do_help );
DECLARE_DO_FUN(do_bd );
DECLARE_DO_FUN(do_wset );
DECLARE_DO_FUN(do_dateset);
DECLARE_DO_FUN(do_datetime);
DECLARE_DO_FUN(do_CreateHand);
DECLARE_DO_FUN(do_CreateDeck);
DECLARE_DO_FUN(do_CreateTable);
DECLARE_DO_FUN(do_StatDeck);
DECLARE_DO_FUN(do_gc);
qtrouble_t *qtrouble_lookup(CHAR_DATA *ch, int vnum);
unsigned long get_next_seconds(const char *argument, CHAR_DATA *ch);
void links_pull (CHAR_DATA *ch);
void do_quit_org (CHAR_DATA *ch, const char *argument, bool Count);
bool write_to_descriptor (int desc, char *txt, int length);
void reboot_muddy(void);
void trim_ch(CHAR_DATA *ch);
void limits_strip(CHAR_DATA * ch);
void update_member_info (CHAR_DATA * ch);
char *crypt(const char *key, const char *salt);
extern int rebooter;
extern void msg_dump (BUFFER *buf, mlstring *ml);
extern void links_fix (CHAR_DATA *ch);
extern void save_immortal (CHAR_DATA *ch);
extern bool delete_immortal (CHAR_DATA *ch, const char *argument);
extern void save_stat_record (void);
extern void save_gq (void);
#if !defined (WIN32)
FILE * popen args((const char *command, const char *type));
int pclose args((FILE *stream));
#endif
char * fgetf args((char *s, int n, register FILE *iop));
DO_FUN(do_pipe)
{
char buf[5000];
FILE *fp;
#if !defined (WIN32)
fp = popen(argument, "r");
#else
fp = _popen(argument, "r");
#endif
fgetf(buf, 5000, fp);
page_to_char(buf, ch);
#if !defined (WIN32)
pclose(fp);
#else
_pclose(fp);
#endif
return;
}
char *fgetf(char *s, int n, register FILE *iop)
{
register int c;
register char *cs;
c = '\0';
cs = s;
while (--n > 0 && (c = getc(iop)) != EOF)
if ((*cs++ = c) == '\0')
break;
*cs = '\0';
return((c == EOF && cs == s) ? NULL : s);
}
void do_bd (CHAR_DATA * ch, const char * argument)
{
int i ;
if (argument[0] == '\0')
{
if (bdflags == 1) char_act("Congratulation is {Ron{x.", ch) ; //T
else char_act("Congratulation is {Roff{x.", ch) ; //T
for (i = 0 ; i < 10 ; i++)
if (bdmsg[i] != NULL) char_printf (ch, "BD %s\n", bdmsg[i]) ;
}
if (!str_cmp(argument, "help"))
{
char_act("Syntax: bd on|off|msg <number> <msg>", ch) ;
return ;
}
if (!str_cmp(argument, "on"))
{
bdflags = 1 ;
char_act("Congratulation is {Ron{x.", ch) ; //T
} else
if (!str_cmp(argument, "off"))
{
bdflags = 0 ;
char_act("Congratulation is {Roff{x.", ch) ; //T
} else
if (!str_cmp(argument, "msg"))
{
int number ;
char arg [MAX_INPUT_LENGTH] ;
argument = one_argument(argument, arg, sizeof(arg)) ;
if (IS_NULLSTR (arg) || !is_number(arg))
{
char_act("Syntax: bd on|off|msg <number> <msg>", ch) ;
return ;
}
number = atoi (arg) ;
if (number < 0 && number > 9) return ;
free_string (bdmsg [number]) ;
bdmsg [number] = str_dup (argument) ;
return ;
}
}
DO_FUN(do_limit_strip)
{
CHAR_DATA *victim;
victim = get_char_world(ch, argument);
if (victim == NULL || IS_NPC(victim))
{
char_act("úÄÅÓØ ÔÁËÉÈ ÎÅÔ.", ch);
return;
}
limits_strip(victim);
}
/* New objlist from mud.nnov.ru */
void brief_show_obj_index(OBJ_INDEX_DATA *pObj, BUFFER *buf)
{
char arg[MAX_INPUT_LENGTH];
AFFECT_DATA *paf;
int cnt;
where_t *w;
int i;
ROOM_INDEX_DATA *room;
RESET_DATA *reset;
buf_printf(buf, "\n#Obj[%6d]: [%s] (%s)\n", pObj->vnum,
mlstr_mval(pObj->short_descr), flag_string(item_types, pObj->item_type));
if (pObj->limit != -1)
snprintf(arg, sizeof(arg), " Limited by %d", pObj->limit);
else
arg[0] = '\0';
buf_printf(buf, "Level: [%3d] ",
pObj->level, arg);
buf_printf(buf, "Wear flags: [%s]\n",
flag_string(wear_flags, pObj->wear_flags));
buf_printf(buf, "Extra flags: [%s]\n",
flag_string(extra_flags, pObj->extra_flags));
buf_printf(buf, "Condition: [%3d] Material: [%s]\n",
pObj->condition, pObj->material);
buf_printf(buf, "Weight: [%5d]\nCost: [%5d]\n",
pObj->weight, pObj->cost);
for (cnt = 0, paf = pObj->affected; paf; paf = paf->next)
{
w = where_lookup(paf->where);
if (cnt == 0)
{
buf_add(buf, "Number Affects Modifier Affects Bitvector\n");
buf_add(buf, "------ ------------ -------- ------- -----------------------------------------\n");
}
buf_printf(buf, "[%4d] %12.12s",
cnt, flag_string(apply_flags, paf->location));
// if (paf->location == APPLY_5_SKILL || paf->location == APPLY_10_SKILL)
// buf_printf(buf, " %-8s ", skill_name(paf->modifier));
// else
buf_printf(buf, " %8d ", paf->modifier);
buf_printf(buf, "%7.7s %s\n",
flag_string(apply_types, paf->where),
w ? flag_string(w->table, paf->bitvector) : "none");
cnt++;
}
show_obj_values(buf, pObj);
cnt = 0;
for (i = 0; i < MAX_KEY_HASH; i++)
for (room = room_index_hash[i]; room; room = room->next)
for (reset = room->reset_first; reset; reset = reset->next)
{
bool found = FALSE;
switch (reset->command)
{
case 'P':
case 'O':
case 'G':
case 'E':
if (reset->arg1 == pObj->vnum)
found = TRUE;
break;
default:
break;;
}
if (!found)
continue;
if (!(cnt++))
buf_add(buf, "Obj has resets in following rooms: ");
buf_printf(buf, "%d ", room->vnum);
break;
}
if (cnt)
buf_add(buf, ".\n");
else
buf_add(buf, "This obj hasn't resets !\n");
}
DO_FUN(do_objlist)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
FILE *fp;
OBJ_DATA *obj;
BUFFER *buf;
if ((fp = dfopen(TMP_PATH, "objlist.txt", "w+")) == NULL)
{
char_act("File error.", ch);
return;
}
buf = buf_new(-1);
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0' || str_prefix(arg1, "sort"))
{
fprintf(fp, "This is dump obj, not pIndexObj !!!\n");
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, FALSE);
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);
fprintf(fp, "%s", fix_string(buf_string(buf)));
}
char_act("tmp/objlist.txt created, type 'objlist sort {{level|type}' for create sort list obj->pIndexData.", ch);
} else
{
OBJ_INDEX_DATA *pObj;
int iLevel;
int iType;
int iHash;
if (arg2[0] == '\0' || !str_prefix(arg2, "level"))
{
for (iLevel = 0; iLevel < 101; iLevel++)
{
buf_printf(buf, "\n\n >>>>> Level %d <<<<<\n\n", iLevel);
for (iType = 0; item_types[iType].name; iType++)
{
if (!item_types[iType].settable)
continue;
buf_printf(buf, "\n\n === Type %s ===\n", item_types[iType].name);
for (iHash = 0; iHash < MAX_KEY_HASH; iHash++)
for (pObj = obj_index_hash[iHash]; pObj; pObj = pObj->next)
if (pObj->level == iLevel && pObj->item_type == item_types[iType].bit)
{
brief_show_obj_index(pObj, buf);
fprintf(fp, "%s", fix_string(buf_string(buf)));
buf_clear(buf);
}
}
}
} else
{
for (iType = 0; item_types[iType].name; iType++)
{
if (!item_types[iType].settable)
continue;
buf_printf(buf, "\n\n >>>>> Type %s <<<<<\n\n", item_types[iType].name);
for (iLevel = 0; iLevel < 101; iLevel++)
{
buf_printf(buf, "\n\n === Level %d ===\n", iLevel);
for (iHash = 0; iHash < MAX_KEY_HASH; iHash++)
for (pObj = obj_index_hash[iHash]; pObj; pObj = pObj->next)
if (pObj->level == iLevel && pObj->item_type == item_types[iType].bit)
{
brief_show_obj_index(pObj, buf);
fprintf(fp, "%s", fix_string(buf_string(buf)));
buf_clear(buf);
}
}
}
}
}
fclose(fp);
}
/* end objlist from mud.nnov.ru */
DO_FUN(do_hash)
{
char *crypted;
if (argument[0] == '\0')
{
char_act("Syntax: hash <string>.", ch);
return;
}
crypted = str_crypt(argument);
char_printf(ch, "Crypted password will be: '%s'.\n", crypted);
}
DO_FUN(do_limited)
{
extern int top_obj_index;
OBJ_DATA *obj;
OBJ_INDEX_DATA *obj_index;
int lCount = 0;
int ingameCount;
int nMatch;
int vnum;
if (argument[0] != '\0')
{
obj_index = get_obj_index(atoi(argument));
if (obj_index == NULL)
{
char_act("îÅ ÎÁÊÄÅÎ.", ch);
return;
}
if (obj_index->limit == -1)
{
char_act("Thats not a limited item.", ch);
return;
}
nMatch = 0;
ingameCount = 0;
for (obj=object_list; obj != NULL; obj=obj->next)
if (obj->pIndexData->vnum == obj_index->vnum)
{
ingameCount++;
}
char_printf(ch, "%s [%5d] ìÉÍÉÔ: %3d óÅÊÞÁÓ: %s%3d{x (%3d)\n",
fmt_color_str(mlstr_mval(obj_index->short_descr), 35),
obj_index->vnum,
obj_index->limit,
(obj_index->count > obj_index->limit) ?
"{R" : str_empty,
ingameCount,
obj_index->count);
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, "îÁÈÏÄÉÔÓÑ Õ {C %-30s{x\n", obj->carried_by->name);
else if (obj->in_room != NULL)
char_printf(ch, "÷ %-20s [%d]\n",
mlstr_cval(obj->in_room->name, ch),
obj->in_room->vnum);
else if (obj->in_obj != NULL)
char_printf(ch, "÷ %-20s [%d] \n",
mlstr_mval(obj->in_obj->short_descr),
obj->in_obj->pIndexData->vnum);
}
char_printf(ch, " %d ÎÁÊÄÅÎÏ × ÉÇÒÅ. %d ÄÏÌÖÎÏ ÂÙÔØ × pFiles.\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++;
ingameCount = 0;
for (obj=object_list; obj != NULL; obj=obj->next)
if (obj->pIndexData->vnum == obj_index->vnum)
{
ingameCount++;
}
char_printf(ch, "%s [%5d] ìÉÍÉÔ: %3d óÅÊÞÁÓ: %s%3d{x (%3d)\n",
fmt_color_str(mlstr_mval(obj_index->short_descr), 37),
obj_index->vnum,
obj_index->limit,
(obj_index->count > obj_index->limit) ?
"{R" : str_empty,
ingameCount,
obj_index->count);
}
}
char_printf(ch, "\n%d ÉÚ %d ÐÒÅÄÍÅÔÏ× ÌÉÍÉÔÉÒÏ×ÁÎÙ.\n", lCount, nMatch);
}
DO_FUN(do_wiznet)
{
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, "\n ËÁÎÁÌ | ÓÔÁÔÕÓ");
buf_add(output, "\n-----------|-------\n");
for (flag = 0; wiznet_table[flag].name != NULL; flag++)
buf_printf(output, "%-11s| %s\n",
wiznet_table[flag].name,
wiznet_table[flag].level > ch->level ?
"N/A" :
IS_SET(ch->pcdata->wiznet,
wiznet_table[flag].flag) ?
"ON" : "OFF");
page_to_char(buf_string(output), ch);
buf_free(output);
return;
}
if (!str_prefix(argument,"on"))
{
char_act("Welcome to Wiznet!", ch);
SET_BIT(ch->pcdata->wiznet, WIZ_ON);
return;
}
if (!str_prefix(argument,"off"))
{
char_act("Signing off of Wiznet.", ch);
REMOVE_BIT(ch->pcdata->wiznet, WIZ_ON);
return;
}
flag = wiznet_lookup(argument);
if (flag == -1 || ch->level < wiznet_table[flag].level)
{
char_act("îÅÔ ÔÁËÏÊ ÏÐÃÉÉ.", 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 wiznet_printf(CHAR_DATA *ch, const void *arg,
long flag, long flag_skip, int min_level,
char* format, ...)
{
va_list ap;
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
struct tm *ctm;
time_t clock;
va_start(ap, format);
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *vch = d->original ? d->original : d->character;
if (d->connected != CON_PLAYING
|| !vch
|| (ch && ch->level == MAX_LEVEL)
|| 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);
clock = time(NULL);
ctm = localtime(&clock);
if (flag == WIZ_LOGINS
|| flag == WIZ_LINKS
|| flag == WIZ_DEATHS
|| flag == WIZ_LEVELS
|| flag == WIZ_SWITCHES
|| flag == WIZ_SPAM)
{
snprintf(buf2, 27, "(%02d:%02d:%02d) [Room: %6d] ", ctm->tm_hour,
ctm->tm_min, ctm->tm_sec,
ch ? (ch->in_room ? ch->in_room->vnum : 0) : 0);
} else
{
snprintf(buf2, 12, "(%02d:%02d:%02d) ", ctm->tm_hour,
ctm->tm_min, ctm->tm_sec);
}
act_puts(buf2, vch, NULL, NULL, TO_CHAR | ACT_NOLF, POS_DEAD);
vsnprintf(buf, sizeof(buf), GETMSG(format, vch->lang), ap);
act_puts(buf, vch, arg, ch, TO_CHAR , POS_DEAD);
}
va_end(ap);
}
DO_FUN(do_tick)
{
char arg[MAX_INPUT_LENGTH];
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("tick area : area update", ch);
char_act("tick char : char update", ch);
char_act("tick room : room update", ch);
char_act("tick track: track update", ch);
char_act("tick obj : obj update", ch);
return;
}
if (is_name(arg, "area"))
{
area_update();
char_act("áÒÉÑ ÏÂÎÏ×ÌÅÎÁ.", ch);
return;
}
if (is_name(arg, "char player"))
{
char_update();
char_act("éÇÒÏËÉ ÏÂÎÏ×ÌÅÎÙ.", ch);
return;
}
if (is_name(arg, "room"))
{
room_update();
char_act("ëÏÍÎÁÔÁ ÏÂÎÏ×ÌÅÎÁ.", ch);
return;
}
if (is_name(arg, "track"))
{
track_update();
char_act("óÌÅÄÙ ÏÂÎÏ×ÌÅÎÙ.", ch);
return;
}
if (is_name(arg, "obj"))
{
obj_update();
char_act("ïÂØÅËÔÙ ÏÂÎÏ×ÌÅÎÙ.", ch);
return;
}
do_tick(ch,str_empty);
return;
}
/* equips a character */
DO_FUN(do_outfit)
{
OBJ_DATA *obj;
OBJ_INDEX_DATA * obj_index;
AFFECT_DATA af;
class_t *cl = class_lookup(ch->class);
int sn,vnum;
if (IS_NPC(ch) || cl == NULL)
return;
if (ch->level > 9
&& !IS_SET(ch->comm, PLR_PEACE))
{
char_act("Find it yourself!", ch);
return;
}
if (ch->carry_number + 4 > can_carry_n(ch))
{
char_act("Your hands are full.", ch);
return;
}
if ((obj = get_eq_char(ch, WEAR_LIGHT)) == NULL)
{
obj_index = get_obj_index(OBJ_VNUM_SCHOOL_BANNER);
obj = create_obj(obj_index, 0);
if (obj_index != NULL)
{
obj->cost = 0;
obj->condition = 100;
obj->timer = 100;
af.where = TO_OBJECT;
af.type = gsn_unique;
af.level = LVL(ch);
af.duration = -1;
af.location = APPLY_HITROLL;
af.modifier = LVL(ch) / 10;
af.bitvector = 0;
affect_to_obj(obj,&af);
af.location = APPLY_DAMROLL;
af.modifier = LVL(ch) / 20;
affect_to_obj(obj,&af);
af.modifier = -5;
af.location = APPLY_SAVING_SPELL;
affect_to_obj(obj,&af);
af.location = APPLY_HIT;
af.modifier = LVL(ch) / 2;
affect_to_obj(obj,&af);
af.location = APPLY_MANA;
af.modifier = LVL(ch);
affect_to_obj(obj,&af);
obj_to_char(obj, ch);
equip_char(ch, obj, WEAR_LIGHT);
}
}
if ((obj = get_eq_char(ch, WEAR_BODY)) == NULL)
{
obj_index = get_obj_index(OBJ_VNUM_SCHOOL_VEST);
if (obj_index != NULL)
{
obj = create_obj(obj_index, 0);
obj->cost = 0;
obj->condition = 100;
obj->timer = 100;
af.where = TO_OBJECT;
af.type = gsn_unique;
af.level = LVL(ch);
af.duration = -1;
af.location = APPLY_HITROLL;
af.modifier = LVL(ch) / 10;
af.bitvector = 0;
affect_to_obj(obj,&af);
af.location = APPLY_DAMROLL;
af.modifier = LVL(ch) / 20;
affect_to_obj(obj,&af);
af.modifier = -5;
af.location = APPLY_SAVING_SPELL;
affect_to_obj(obj,&af);
af.location = APPLY_HIT;
af.modifier = LVL(ch);
affect_to_obj(obj,&af);
af.location = APPLY_MANA;
af.modifier = LVL(ch);
affect_to_obj(obj,&af);
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;
if ((vnum = cl->weapon) == 0)
vnum = OBJ_VNUM_SCHOOL_SWORD; /* just in case! */
obj_index = get_obj_index(vnum);
if (obj_index != NULL)
{
obj = create_obj(obj_index, 0);
obj->condition = 100;
obj->timer = 100;
af.where = TO_OBJECT;
af.type = gsn_unique;
af.level = LVL(ch);
af.duration = -1;
af.location = APPLY_HITROLL;
af.modifier = LVL(ch) / 10;
af.bitvector = 0;
affect_to_obj(obj,&af);
af.location = APPLY_DAMROLL;
af.modifier = LVL(ch) / 20;
affect_to_obj(obj,&af);
obj->value[1] = LVL(ch) / 6;
obj->value[2] = 9;
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_index = get_obj_index(OBJ_VNUM_SCHOOL_SHIELD);
if (obj_index != NULL)
{
obj = create_obj(obj_index, 0);
obj->cost = 0;
obj->condition = 100;
obj->timer = 100;
af.where = TO_OBJECT;
af.type = gsn_unique;
af.level = LVL(ch);
af.duration = -1;
af.location = APPLY_HITROLL;
af.modifier = LVL(ch) / 10;
af.bitvector = 0;
affect_to_obj(obj,&af);
af.location = APPLY_DAMROLL;
af.modifier = LVL(ch) / 10;
affect_to_obj(obj,&af);
af.modifier = -5;
af.location = APPLY_SAVING_SPELL;
affect_to_obj(obj,&af);
af.location = APPLY_HIT;
af.modifier = LVL(ch) / 2;
affect_to_obj(obj,&af);
af.location = APPLY_MANA;
af.modifier = LVL(ch);
affect_to_obj(obj,&af);
af.location = APPLY_MOVE;
af.modifier = LVL(ch) / 4;
affect_to_obj(obj,&af);
obj_to_char(obj, ch);
equip_char(ch, obj, WEAR_SHIELD);
}
}
char_act("You have been equipped by gods.", ch);
}
DO_FUN(do_smote)
{
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->comm, COMM_NOEMOTE))
{
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÐÒÏÑ×ÌÑÔØ Ó×ÏÉ ÜÍÏÃÉÉ.", ch);
return;
}
if (argument[0] == '\0')
{
char_act("ëÁËÁÑ ÜÍÏÃÉÑ?", ch);
return;
}
if (strstr(argument,ch->name) == NULL)
{
char_act("ôÙ ÄÏÌÖÅÎ ÕËÁÚÁÔØ Ó×ÏÅ ÉÍÑ × smote.", 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);
}
}
DO_FUN(do_bamfin)
{
if (!IS_NPC(ch))
{
if (argument[0] == '\0')
{
char_printf(ch, "ðÒÉ Ô×ÏÅÍ ÐÏÑ×ÌÅÎÉÉ ×ÙÓ×ÅÞÉ×ÁÅÔÓÑ ÎÁÄÐÉÓØ '%s'\n",
ch->pcdata->bamfin);
return;
}
if (strstr(argument, ch->name) == NULL)
{
char_act("ôÙ ÄÏÌÖÅÎ ÕËÁÚÁÔØ Ó×ÏÅ ÉÍÑ.", ch);
return;
}
free_string(ch->pcdata->bamfin);
ch->pcdata->bamfin = str_dup(argument);
char_printf(ch, "ôÅÐÅÒØ ÐÒÉ Ô×ÏÅÍ ÐÏÑ×ÌÅÎÉÉ ÂÕÄÅÔ ×ÙÓ×ÅÞÉ×ÁÔØÓÑ ÎÁÄÐÉÓØ '%s'\n",
ch->pcdata->bamfin);
}
}
DO_FUN(do_bamfout)
{
if (!IS_NPC(ch))
{
if (argument[0] == '\0')
{
char_printf(ch, "ï Ô×ÏÅÍ ÕÈÏÄÅ ÓÏÏÂÝÁÅÔ ÎÁÄÐÉÓØ '%s'\n",
ch->pcdata->bamfout);
return;
}
if (strstr(argument,ch->name) == NULL)
{
char_act("îÅ ÚÁÂÕÄØ ×ËÌÀÞÉÔØ ÓÀÄÁ Ó×ÏÅ ÉÍÑ.", ch);
return;
}
free_string(ch->pcdata->bamfout);
ch->pcdata->bamfout = str_dup(argument);
char_printf(ch, "ï Ô×ÏÅÍ ÕÈÏÄÅ ÓÏÏÂÝÁÅÔ ÎÁÄÐÉÓØ '%s'\n",
ch->pcdata->bamfout);
}
}
DO_FUN(do_deny)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
bool loaded = FALSE;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("ëÏÍÕ ÚÁËÒÙÔØ ÄÏÓÔÕÐ?", ch);
return;
}
if ((victim = gq_findchar(arg)) == NULL)
{
loaded = TRUE;
victim = char_load_special(arg);
}
if (victim == NULL)
{
char_act("éÇÒÏËÁ Ó ÔÁËÉÍ ÉÍÅÎÅÍ × ÍÉÒÅ ÎÅÔ.", ch);
return;
}
if (IS_NPC(victim))
{
char_act("ôÏÌØËÏ ÎÅ ÄÌÑ NPC.", ch);
return;
}
if (victim->level > ch->level)
{
char_act("îÉÞÅÇÏ ÎÅ ÐÏÌÕÞÉÌÏÓØ.", ch);
if (loaded)
char_nuke(victim);
return;
}
if (IS_SET(victim->plr_flags, PLR_DENY))
{
char_act("ôÅÐÅÒØ ÏÎ Ó ÎÁÍÉ.", ch);
REMOVE_BIT(victim->plr_flags, PLR_DENY);
wiznet_printf(ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0,
"$N ÒÁÚÒÅÛÉÌ ÄÏÓÔÕÐ %s Ë ÓÅÒ×ÅÒÕ.", victim->name);
} else
{
SET_BIT(victim->plr_flags, PLR_DENY);
char_act("äÏÓÔÕÐ Ë ÓÅÒ×ÅÒÕ ÔÅÐÅÒØ ÄÌÑ ÔÅÂÑ ÚÁËÒÙÔ!", victim);
wiznet_printf(ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0,
"$N ÚÁÐÒÅÔÉÌ ÄÏÓÔÕÐ %s Ë ÓÅÒ×ÅÒÕ.", victim->name);
char_act("Ok.", ch);
if (!loaded)
{
save_char_obj(victim, FALSE, FALSE);
stop_fighting(victim, TRUE);
do_quit(victim, str_empty);
}
else
char_nuke(victim);
}
}
DO_FUN(do_disconnect)
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
if (ch->level > 100)
{
trim_ch(ch);
return;
}
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("ëÏÇÏ ÏÔËÌÀÞÉÔØ?", 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_act("Ok.", ch);
return;
}
}
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
char_act("ôÁËÏÇÏ ÉÇÒÏËÁ × ÍÉÒÅ ÎÅÔ.", 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_act("Ok.", ch);
return;
}
bug("Do_disconnect: desc not found.", 0);
char_act("Descriptor not found!", ch);
return;
}
DO_FUN(do_echo)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0')
{
char_act("Global echo what?", 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);
}
}
DO_FUN(do_recho)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0')
{
char_act("Local echo what?", 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);
}
}
DO_FUN(do_zecho)
{
DESCRIPTOR_DATA *d;
if (argument[0] == '\0')
{
char_act("Zone echo what?", 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);
}
}
DO_FUN(do_pecho)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
argument = one_argument(argument, arg, sizeof(arg));
if (argument[0] == '\0' || arg[0] == '\0')
{
char_act("Personal echo what?", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
char_act("ôÁËÉÈ ÔÕÔ ÎÅÔ.", ch);
return;
}
if (victim->level >= ch->level && ch->level != MAX_LEVEL-1)
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;
}
DO_FUN(do_transfer)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
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_act("ðÅÒÅÍÅÓÔÉÔØ ËÏÇÏ (É ËÕÄÁ)?", 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;
}
/*
* Thanks to Grodyn for the optional location parameter.
*/
if (arg2[0])
{
if ((location = find_location(ch, arg2)) == NULL)
{
char_act("íÅÓÔÏ ÎÅ ÎÁÊÄÅÎÏ.", ch);
return;
}
if (room_is_private(location) && ch->level < MAX_LEVEL-1)
{
char_act("That room is private right now.", ch);
return;
}
} else
location = ch->in_room;
if ((victim = get_char_world(ch, arg1)) == NULL)
{
char_act("ôÁËÉÈ ÔÕÔ ÎÅÔ.", ch);
return;
}
if (IS_IMMORTAL(victim) && victim->level > ch->level)
{
char_act("îÉÞÅÇÏ ÎÅ ÐÏÌÕÞÉÌÏÓØ.", ch);
return;
}
if (victim->in_room == NULL)
{
char_act("éÇÒÏË × ðÕÓÔÏÔÅ.", ch);
return;
}
if (victim->fighting != NULL)
stop_fighting(victim, TRUE);
act("$n ÉÓÞÅÚÁÅÔ × ÄÙÍËÅ.", victim, NULL, NULL, TO_ROOM);
char_from_room(victim);
char_to_room(victim, location);
act("$n ÐÏÑ×ÌÑÅÔÓÑ × ÏÂÌÁËÅ ÄÙÍÁ.", victim, NULL, NULL, TO_ROOM);
if (ch != victim)
act("$n ÐÅÒÅÍÅÝÁÅÔ ÔÅÂÑ.", ch, NULL, victim, TO_VICT);
char_act("Ok.", ch);
if (JUST_KILLED(victim))
return;
do_look(victim, "auto");
}
DO_FUN(do_at)
{
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_act("At where what?", ch);
return;
}
if ((location = find_location(ch, arg)) == NULL)
{
char_act("íÅÓÔÏ ÎÅ ÎÁÊÄÅÎÏ.", ch);
return;
}
if (room_is_private(location)
&& ch->level < MAX_LEVEL-1)
{
char_act("That room is private right now.", 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);
if (JUST_KILLED(ch) || ch->extracted)
return;
char_from_room(ch);
char_to_room(ch, original);
if (JUST_KILLED(ch))
return;
ch->on = on;
}
DO_FUN(do_goto)
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
if (argument[0] == '\0')
{
char_act("Goto ËÕÄÁ?", ch);
return;
}
if ((location = find_location(ch, argument)) == NULL)
{
char_act("íÅÓÔÏ ÎÅ ÎÁÊÄÅÎÏ.", ch);
return;
}
if (ch->level < LEVEL_IMMORTAL)
{
AREA_DATA *area;
if (ch->fighting)
{
char_act("îÅ ÓÅÊÞÁÓ! âÏÊ ÅÝÅ ÎÅ ÏËÏÎÞÅÎ!.", ch);
return;
}
if (IS_PUMPED(ch))
{
char_act("óÅÊÞÁÓ ÔÙ ÓÌÉÛËÏÍ ×ÏÚÂÕÖÄÅÎ, ÞÔÏÂÙ ÍÏÌÉÔØÓÑ.", ch);
return;
}
#if 0
if (!IS_SET(ch->in_room->room_flags, ROOM_PEACE))
{
char_act("óÎÁÞÁÌÁ ÎÁÊÄÉ ÂÅÚÏÐÁÓÎÏÅ ÍÅÓÔÏ, ÞÔÏÂÙ ÓÐÏËÏÊÎÏ ÐÏÍÏÌÉÔØÓÑ.", ch);
return;
}
#endif
if ((area = area_vnum_lookup(location->vnum)) == NULL
|| !IS_BUILDER(ch, area))
{
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÐÅÒÅÍÅÓÔÉÔØÓÑ ÔÕÄÁ.", 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 ÉÓÞÅÚÁÅÔ × ÚÙÂËÏÍ ÍÁÒÅ×Å.", ch, NULL,
rch, TO_VICT);
}
char_from_room(ch);
char_to_room(ch, location);
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->bamfin[0] != '\0')
act("$t", ch, ch->pcdata->bamfin, rch, TO_VICT);
else
act("$n ÐÏÑ×ÌÑÅÔÓÑ ÉÚ ÇÕÓÔÏÇÏ ÔÕÍÁÎÁ.", ch, NULL,
rch, TO_VICT);
}
if (JUST_KILLED(ch))
return;
do_look(ch, "auto");
}
DO_FUN(do_violate)
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
if (argument[0] == '\0')
{
char_act("Goto where?", ch);
return;
}
if ((location = find_location(ch, argument)) == NULL)
{
char_act("No such location.", ch);
return;
}
if (!room_is_private(location))
{
char_act("That room isn't private, use goto.", 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 ÉÓÞÅÚÁÅÔ × ÇÕÓÔÏÍ ÔÕÍÁÎÅ.", ch, NULL,
rch, TO_VICT);
}
char_from_room(ch);
char_to_room(ch, location);
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->bamfin[0] != '\0')
act("$t", ch, ch->pcdata->bamfin, rch, TO_VICT);
else
act("$n ÐÏÑ×ÌÑÅÔÓÑ ÉÚ ÇÕÓÔÏÇÏ ÔÕÍÁÎÁ.", ch, NULL,
rch, TO_VICT);
}
if (JUST_KILLED(ch))
return;
do_look(ch, "auto");
return;
}
/* RT to replace the 3 stat commands */
void do_stat (CHAR_DATA *ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
const char *string;
OBJ_DATA *obj;
ROOM_INDEX_DATA *location;
CHAR_DATA *victim;
string = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Syntax:", ch);
char_act(" stat <name>", ch);
char_act(" stat obj <name>", ch);
char_act(" stat mob <name>", ch);
char_act(" stat room <number>", ch);
char_act(" stat desc <number>", ch);
return;
}
if (!str_cmp(arg, "room"))
{
do_rstat(ch, string);
return;
}
if (!str_cmp(arg, "obj"))
{
do_ostat(ch, string);
return;
}
if (!str_cmp(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_act("Nothing by that name found anywhere.", ch);
}
void do_rstat (CHAR_DATA * ch, const char * argument)
{
char arg [MAX_INPUT_LENGTH] ;
ROOM_INDEX_DATA * location ;
ROOM_HISTORY_DATA * rh ;
OBJ_DATA * obj ;
CHAR_DATA * rch ;
BUFFER * output ;
int door, i ;
bool ok = FALSE ;
one_argument(argument, arg, sizeof(arg)) ;
location = (arg[0] == '\0') ? ch->in_room : find_location (ch, arg) ;
if (location == NULL)
{
char_act("No such location.", ch) ;
return ;
}
if (ch->in_room != location &&
room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR))
{
char_act("That room is private right now.", ch) ;
return ;
}
output = buf_new (-1) ;
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GVnum: {W%7d {GZone: {w%s ",
location->vnum, location->area->name) ;
mlstr_dump (output, "{GName: {w", location->name) ;
buf_printf(output,
"{c| {GSector: {w%s {GOwner: {w%s\n"
"{c+-------------------------------------------------------------------------+\n"
"{c| {GLight: {w%d {GSpace max/used: {w%d/%d {GRate heal/mana: {w%d/%d\n"
"{c+-------------------------------------------------------------------------+\n",
flag_string(sector_types, location->sector_type),
!IS_NULLSTR(location->owner) ? location->owner : "none",
location->light, location->space, count_used_space(location),
location->heal_rate, location->mana_rate) ;
if (location->affected_by)
{
buf_printf(output, "{c| {GAffected: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(raffect_flags, location->affected_by), 60,
"{c|{Y ")) ; ok = TRUE ;
}
if (location->room_flags)
{
buf_printf(output, "{c| {GFlags: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(room_flags, location->room_flags), 60,
"{c|{Y ")) ; ok = TRUE ;
}
if (ok)
buf_add(output, "{c+-------------------------------------------------------------------------+\n") ;
mlstr_dump(output, "{c| {GDescription:\n{w", location->description) ;
buf_add(output, "{c+-------------------------------------------------------------------------+\n") ;
if (location->ed != NULL)
{
ED_DATA * ed ;
buf_add(output, "{c| {GExtra desc: {w[{W") ;
for (i = 0, ed = location->ed ; ed ; ed = ed->next)
{
if (i + strlen(ed->keyword) > 59)
{
buf_add(output, "\n{c|{W ") ;
i = 0 ;
}
buf_add(output, ed->keyword) ; i += strlen(ed->keyword) ;
if (ed->next != NULL)
{
buf_add(output, " ") ;
i++ ;
}
}
buf_add(output, "{w]\n") ;
}
buf_add(output, "{c| {GCharacters: {y[{Y") ;
for (i = 0, rch = location->people ; rch ; rch = rch->next_in_room)
{
if (can_see(ch, rch))
{
if (i + strlen(rch->name) > 59)
{
buf_add(output, "\n{c|{Y ") ;
i = 0 ;
}
buf_add(output, rch->name) ; i += strlen(rch->name) ;
if (rch->next_in_room != NULL)
{
buf_add(output, " ") ;
i++ ;
}
}
}
buf_add(output, "{y]\n") ;
buf_add(output, "{c| {GObjects: {y[{Y") ;
for (i = 0, obj = location->contents ; obj ; obj = obj->next_content)
{
if (i + strlen(obj->name) > 59)
{
buf_add(output, "\n{c|{Y ") ;
i = 0 ;
}
buf_add(output, obj->name) ; i += strlen(obj->name) ;
if (obj->next_content != NULL)
{
buf_add(output, " ") ;
i++ ;
}
}
buf_add(output, "{y]\n") ;
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
for (door = 0 ; door <= 5 ; door++)
{
EXIT_DATA * pexit ;
if ((pexit = location->exit[door]) != NULL)
{
buf_printf(output, "{c| {GDoor: {W%-5s {w-> {W%d {GSize: {W%3d {GKey: {W%d {GKwd: {w[%s]\n",
capitalize(dir_name[door]),
pexit->to_room.r == NULL ? -1 : pexit->to_room.r->vnum,
pexit->size, pexit->key,
!IS_NULLSTR(pexit->keyword) ? pexit->keyword : str_empty) ;
buf_printf(output, "{c| {GResets: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(exit_flags, pexit->rs_flags), 63,
"{c|{Y ")) ;
buf_printf(output, "{c| {GFlags: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(exit_flags, pexit->exit_info), 63,
"{c|{Y ")) ;
mlstr_dump(output, "{c| {GDescription:{w ", pexit->description) ;
}
}
buf_add(output, "{c+-------------------------------------------------------------------------+\n"
"{c| {GTracks:\n") ;
for (rh = location->history; rh != NULL; rh = rh->next)
buf_printf(output, "{c| {W%s {wtook door {W%i.\n", rh->name, rh->went);
buf_add(output, "{c+-------------------------------------------------------------------------+\n") ;
send_to_char(buf_string(output), ch) ;
buf_free(output) ;
}
void do_ostat (CHAR_DATA * ch, const char * argument)
{
char arg [MAX_INPUT_LENGTH] ;
OBJ_DATA * obj ;
BUFFER * output ;
AFFECT_DATA * paf ;
int i ;
bool ok = FALSE ;
one_argument(argument, arg, sizeof(arg)) ;
if (arg[0] == '\0')
{
char_act("õËÁÖÉÔÅ ÃÅÌØ.", ch) ;
return ;
}
if ((obj = get_obj_world (ch, argument)) == NULL)
{
char_act("îÉÞÅÇÏ ÐÏÄÏÂÎÏÇÏ ÎÉÇÄÅ ÎÅ ÏÂÎÁÒÕÖÅÎÏ.", ch) ;
return ;
}
output = buf_new (-1) ;
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GVnum: {W%7d {GName: {w%s\n"
"{c| {GRoom: {W%7d {GOwner: {w%s {GCount: {w%d {GTimer: {w%d {GLimit: {%c%d\n"
"{c| {GLevel: {W%7d {GType: {w%s {GResets: {w%d {GCondition: {w%d\n"
"{c+-------------------------------------------------------------------------+\n"
"{c| {GNumber: {w%d {GCost: {w%d {GWeight: {w%d/%d/%d\n"
"{c+-------------------------------------------------------------------------+\n",
obj->pIndexData->vnum, obj->name,
obj->in_room == NULL ? 0 : obj->in_room->vnum,
!IS_NULLSTR(obj->owner) ? obj->owner : "none",
obj->pIndexData->count, obj->timer,
obj->pIndexData->limit > 0 ? 'R' : 'w', obj->pIndexData->limit,
obj->level, flag_string(item_types, obj->pIndexData->item_type),
obj->pIndexData->reset_num, obj->condition,
get_obj_number(obj), obj->cost,
obj->weight, get_obj_weight(obj), get_true_weight(obj)) ;
buf_printf(output,
"{c| {GWear: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(wear_flags, obj->wear_flags), 64,
"{c|{Y ")) ;
buf_printf(output,
"{c| {GExtra: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(extra_flags, obj->extra_flags), 64,
"{c|{Y ")) ;
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
mlstr_dump(output, "{c| {GShort description: {w", obj->short_descr) ;
mlstr_dump(output, "{c| {GLong description: {w", obj->description) ;
if (obj->ed != NULL || obj->pIndexData->ed != NULL)
{
ED_DATA * ed ;
buf_add(output, "{c| {GExtra desc: {w[{W") ;
for (i = 0, ed = obj->ed ; ed ; ed = ed->next)
{
if (i + strlen(ed->keyword) > 59)
{
buf_add(output, "\n{c|{W ") ;
i = 0 ;
}
buf_add(output, ed->keyword) ; i += strlen(ed->keyword) ;
if (ed->next != NULL)
{
buf_add(output, " ") ;
i++ ;
}
}
for (ed = obj->pIndexData->ed ; ed ; ed = ed->next)
{
if (i + strlen(ed->keyword) > 59)
{
buf_add(output, "\n{c|{W ") ;
i = 0 ;
}
buf_add(output, ed->keyword) ; i += strlen(ed->keyword) ;
if (ed->next != NULL)
{
buf_add(output, " ") ;
i++ ;
}
}
buf_add(output, "{w]\n") ;
}
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GIn room: {w%d {GIn object: {w%s {GWearloc: {w%d\n"
"{c| {GCarried: {w%s\n"
"{c| {GValues: {w%d %d %d %d %d\n"
"{c+-------------------------------------------------------------------------+\n",
obj->in_room == NULL ? 0 : obj->in_room->vnum,
obj->in_obj == NULL ? "none" : mlstr_mval(obj->in_obj->short_descr),
obj->wear_loc,
obj->carried_by == NULL ? "none" :
can_see(ch,obj->carried_by) ? obj->carried_by->name : "ÎÅËÔÏ",
obj->value[0], obj->value[1], obj->value[2], obj->value[3], obj->value[4]) ;
ok = TRUE ;
switch (obj->pIndexData->item_type)
{
case ITEM_SCROLL:
case ITEM_POTION:
case ITEM_PILL:
buf_printf(output,
"{c| {GLevel: {W%d {GSpells:", obj->value[0]) ;
for (i = 1 ; i < 5 ; i++)
if (obj->value[i] >= 0)
buf_printf (output, " {c'{C%s{c'", skill_name(obj->value[i])) ;
buf_add(output, "\n") ;
break ;
case ITEM_WAND:
case ITEM_STAFF:
buf_printf(output,
"{c| {GCharges: {W%d/%d {GLevel: {W%d {GSpell: {c'{C%s{c'\n",
obj->value[1], obj->value[2], obj->value[0],
obj->value[3] >= 0 ? skill_name(obj->value[3]) : "unknown") ;
break ;
case ITEM_DRINK_CON:
buf_printf(output,
"{c| {GLiquid: {W%s{w-colored {C%s\n",
liquid_color(obj->value[2])/*liq_table[obj->value[2]].liq_color*/,
liquid_name(obj->value[2])/*liq_table[obj->value[2]].liq_name*/) ;
break ;
case ITEM_WEAPON:
buf_printf(output,
"{c| {GWeapon: {W%s {GDamage: {w%d{Wd{w%d (average {C%d{w) {GType: {C%s\n",
flag_string(weapon_class, obj->value[0]),
obj->value[1], obj->value[2],
(1 + obj->value[2]) * obj->value[1] / 2,
attack_table[obj->value[3]].noun) ;
if (obj->value[4])
buf_printf(output,
"{c| {GFlags: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(weapon_type2, obj->value[4]), 63,
"{c| ")) ;
break ;
case ITEM_ARMOR:
buf_printf(output,
"{c| {GAC pierce/ bash/ slash/ magic\n"
"{c| {C%6d{G/{C%6d{G/{C%6d{G/{C%6d\n",
obj->value[0], obj->value[1], obj->value[2], obj->value[3]) ;
break ;
case ITEM_CONTAINER:
buf_printf(output,
"{c| {GCapacity: {w%d {GMax weight: {w%d {GMultiplier: {w%d%%\n",
obj->value[0], obj->value[3], obj->value[4]) ;
buf_printf(output,
"{c| {GFlags: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(cont_flags, obj->value[1]), 63,
"{c| ")) ;
break ;
default:
ok = FALSE ;
break ;
}
if (ok)
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
if (!IS_SET(obj->extra_flags, ITEM_ENCHANTED))
{
where_t * w ;
for (paf = obj->pIndexData->affected ; paf ; paf = paf->next)
{
if (paf->location != APPLY_NONE && paf->modifier)
{
buf_printf(output,
"{c| {GAffects {C%-20s {wby {C%d\n",
flag_string(apply_flags, paf->location),
paf->modifier);
}
if ((w = where_lookup(paf->where)) && paf->bitvector)
{
buf_add (output, "{c| {GAdds {w") ;
buf_printf (output, w->format,
flag_string(w->table, paf->bitvector)) ;
buf_add (output, "\n") ;
}
}
}
for (paf = obj->affected ; paf ; paf = paf->next)
{
where_t * w ;
if (paf->location != APPLY_NONE && paf->modifier)
{
buf_printf(output,
"{c| {GAffects {C%-20s {wby {C%d{w",
flag_string(apply_flags, paf->location),
paf->modifier) ;
if (paf->duration > -1)
buf_printf(output, " for {C%d{w hours", paf->duration) ;
buf_add(output, "\n") ;
}
if ((w = where_lookup(paf->where)) && paf->bitvector)
{
buf_add (output, "{c| {GAdds {w") ;
buf_printf (output, w->format,
flag_string(w->table, paf->bitvector)) ;
buf_add (output, "\n") ;
}
}
if (obj->pIndexData->oprogs_old)
{
buf_add(output, "{c| {GObject progs:\n") ;
for (i = 0 ; i < OPROG_MAX ; i++)
if (obj->pIndexData->oprogs_old[i] != NULL)
buf_printf(output, "{c| {G%s: {C%s\n",
optype_table[i],
oprog_name_lookup(obj->pIndexData->oprogs_old[i])) ;
}
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GDamage condition: {w%d (%s)\n"
"{c+-------------------------------------------------------------------------+\n",
obj->condition, get_cond_alias(obj)) ;
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 ;
bool ok = FALSE ;
bool loaded = FALSE;
bool super = ch->level >= MAX_LEVEL - 5;
int i;
one_argument(argument, arg, sizeof(arg)) ;
if (arg[0] == '\0')
{
char_act("õËÁÖÉÔÅ ÃÅÌØ.", ch) ;
return ;
}
if ((victim = get_char_world(ch, argument)) == NULL)
{
char_act("ôÁËÉÈ ÎÅÔ × ÍÉÒÅ.", ch) ;
if (super)
{
if ((victim = gq_findchar(arg)) == NULL)
{
loaded = TRUE;
victim = char_load_special(arg);
}
}
}
if (victim == NULL)
return;
if (IS_IMMORTAL(victim) && victim->level > ch->level && !super)
{
char_act("îÉÞÅÇÏ ÎÅ ÐÏÌÕÞÉÌÏÓØ.", ch) ;
return ;
}
output = buf_new(-1) ;
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GVnum: {W%7d {GZone: {w%s {GName: {Y%s %s\n"
"{c| {GRoom: {W%7d {GRace: {w%s (%s) {GGroup: {w%d {GSex: {w%s\n"
"{c| {GLevel: {W%3d%c(%d) {GClass: {w%s {GReligion: {w%s\n"
"{c+-------------------------------------------------------------------------+\n",
IS_NPC(victim) ? victim->pIndexData->vnum : 0,
(IS_NPC(victim) && victim->zone) ? victim->zone->name : "?",
victim->name,
(!IS_NPC(victim) && victim->pcdata->title) ? victim->pcdata->title : str_empty,
victim->in_room == NULL ? 0 : victim->in_room->vnum,
race_name(victim->race), race_name(ORG_RACE(victim)),
IS_NPC(victim) ? victim->group : 0,
flag_string(sex_table, victim->sex),
victim->level, (victim->aff_level >= 0) ? '+' : '-',
victim->aff_level, class_name(victim),
IS_NPC(victim) ? "Chronos" : religion_name(victim->religion)) ;
if (IS_NPC(victim))
buf_printf(output,
"{c| {GCount: {w%d {GKilled: {w%d {GStatus: {w%d\n"
"{c+-------------------------------------------------------------------------+\n",
victim->pIndexData->count, victim->pIndexData->killed, victim->status) ;
if (IS_NPC(victim)) snprintf(buf, sizeof(buf), "%d", victim->alignment) ;
else snprintf(buf, sizeof(buf), "%s", IS_GOOD(victim) ? "good" :
IS_NEUTRAL(victim) ? "neutral" :
IS_EVIL(victim) ? "evil" : "unknown") ;
buf_printf(output,
"{c| {GStr: {C%2d{c(%2d) {c| {GHp : {C%5d/%5d {c| {YGold : %7d\n"
"{c| {GInt: {C%2d{c(%2d) {c| {GMana : {C%5d/%5d {c| {WSilver: %7d\n"
"{c| {GWis: {C%2d{c(%2d) {c| {GMoves: {C%5d/%5d {c| {GAlign : {M%s\n"
"{c| {GDex: {C%2d{c(%2d) {c| {GPr/Tr: {w%5d/%5d {c| {GEthos : {M%s\n"
"{c| {GCon: {C%2d{c(%2d) {c| {GHr/Dr: {Y%5d/%5d {c| {GExp : {w%7d\n"
"{c| {GCha: {C%2d{c(%2d) {c| {GSaves: {W%5d {c| {CAC pierce/ bash/ slash/ magic\n"
"{c| {GLck: {C%2d{c(%2d) {c| {GSize : {W%5d {c| {w%6d{C/{w%6d{C/{w%6d{C/{w%6d\n"
"{c+-------------------------------------------------------------------------+\n",
victim->perm_stat[STAT_STR], get_curr_stat(victim,STAT_STR),
victim->hit, victim->max_hit, victim->gold,
victim->perm_stat[STAT_INT], get_curr_stat(victim,STAT_INT),
victim->mana, victim->max_mana, victim->silver,
victim->perm_stat[STAT_WIS], get_curr_stat(victim,STAT_WIS),
victim->move, victim->max_move, buf,
victim->perm_stat[STAT_DEX], get_curr_stat(victim,STAT_DEX),
IS_NPC(victim) ? 0 : victim->practice,
IS_NPC(victim) ? 0 : victim->train,
IS_NPC(victim) ? "unknown" : flag_string(ethos_table, victim->ethos),
victim->perm_stat[STAT_CON], get_curr_stat(victim,STAT_CON),
GET_HITROLL(victim), GET_DAMROLL(victim), victim->exp,
victim->perm_stat[STAT_CHA], get_curr_stat(victim,STAT_CHA),
victim->saving_throw,
victim->perm_stat[STAT_LCK], get_curr_stat(victim,STAT_LCK),
victim->size, GET_AC(victim, AC_PIERCE), GET_AC(victim, AC_BASH),
GET_AC(victim, AC_SLASH), GET_AC(victim, AC_EXOTIC)) ;
if (IS_NPC(victim))
buf_printf(output,
"{c| {GDamage: {w%d{Wd{w%d {GMessage: {w%s\n"
"{c+-------------------------------------------------------------------------+\n",
victim->damage[DICE_NUMBER], victim->damage[DICE_TYPE],
attack_table[victim->dam_type].noun) ;
buf_printf(output,
"{c| {GWimpy: {w%d {GDeaths: {w%d {GPosition: {w%s {GCarry num/weight: {w%d/%ld\n"
"{c+-------------------------------------------------------------------------+\n",
victim->wimpy, IS_NPC(victim) ? 0 : victim->pcdata->death,
flag_string(position_table, victim->position),
victim->carry_number, get_carry_weight(victim) / 10) ;
if (!IS_NPC(victim))
{
buf_printf(output,
"{c| {GThirst: {w%d {GHunger: {w%d {GFull: {w%d {GDrunk: {w%d {GBloodlust: {w%d {GDesire: {w%d\n"
"{c+-------------------------------------------------------------------------+\n"
"{c| {GPC killed/died: {R%d{w/{W%d\n"
"{c| {GBank gold/silv: {Y%d{w/{W%d {GLimit timer: {R%d\n"
"{c| {GPlayed (hours): {w%d {GClan status: ",
victim->pcdata->condition[COND_THIRST],
victim->pcdata->condition[COND_HUNGER],
victim->pcdata->condition[COND_FULL],
victim->pcdata->condition[COND_DRUNK],
victim->pcdata->condition[COND_BLOODLUST],
victim->pcdata->condition[COND_DESIRE],
victim->pcdata->pc_killed, victim->pcdata->pc_died,
victim->pcdata->bank_g, victim->pcdata->bank_s,
victim->pcdata->limit_timer,
(int) (victim->played + current_time - victim->logon) / 3600) ;
switch (victim->pcdata->clan_status)
{
case CLAN_LEADER: buf_add(output, "{WLeader") ; break ;
case CLAN_SECOND: buf_add(output, "{YSecond") ; break ;
case CLAN_ELITE: buf_add(output, "{CElite") ; break ;
case CLAN_VETERAN: buf_add(output, "{CVeteran") ; break ;
case CLAN_COMMONER: buf_add(output, "{wCommoner") ; break ;
case CLAN_NEWBIE: buf_add(output, "{wNewbie") ; break ;
default: buf_add(output, "{wNone") ; break ;
}
buf_add(output,
"\n{c+-------------------------------------------------------------------------+\n");
}
buf_printf(output,
"{c| {GMaster: {w%s {GLeader: {w%s {GPet: {w%s\n"
"{c+-------------------------------------------------------------------------+\n",
victim->master ? victim->master->name : "none",
victim->leader ? victim->leader->name : "none",
victim->pet ? victim->pet->name : "none");
if (!IS_NPC(victim))
buf_printf(output,
"{c| {GPlr: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(plr_flags, victim->plr_flags), 64,
"{c|{Y ")) ;
if (victim->affected_by)
buf_printf(output,
"{c| {GAff: {y[{Y%s{y]\n",
fmt_wrap_str (flag_string(affect_flags, victim->affected_by), 64,
"{c|{Y ")) ;
if (victim->comm)
buf_printf(output,
"{c| {GComm: {m[{M%s{m]\n",
fmt_wrap_str (flag_string(comm_flags, victim->comm), 64,
"{c|{M ")) ;
if (!IS_NPC(victim))
if (victim->pcdata->wishes)
buf_add(output, wish_list (victim, 64));
if (IS_NPC(victim) && victim->pIndexData->off_flags)
buf_printf(output,
"{c| {GOff: {w[{W%s{w]\n",
fmt_wrap_str (flag_string(off_flags, victim->pIndexData->off_flags), 64,
"{c|{W ")) ;
if (victim->immunes)
buf_printf(output,
"{c| {GImm: {w[{W%s{w]\n",
fmt_wrap_str (flag_string(imm_flags, victim->immunes), 64,
"{c|{W ")) ;
for (i = 0; i < MAX_DAM; i++)
{
if (victim->resists[i])
{
buf_printf(output, "{c| {GRes: {b[{B%-16.16s:%4d%%{b]\n",
flag_string(dam_flags, i), victim->resists[i]);
}
}
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {GForm: {y[{Y%s{y]\n",
fmt_wrap_str(flag_string(form_flags, victim->form), 64, "{c|{Y ")) ;
buf_printf(output,
"{c| {GPart: {y[{Y%s{y]\n"
"{c+-------------------------------------------------------------------------+\n",
fmt_wrap_str (flag_string(part_flags, victim->parts), 64, "{c|{Y ")) ;
if (IS_NPC(victim))
{
mlstr_dump(output,
"{c| {GShort description:{w ", victim->short_descr) ;
mlstr_dump(output,
"{c| {GLong description:\n{w", victim->long_descr) ;
if (victim->spec_fun != 0)
buf_printf(output,
"{c| {GMobile has special procedure:{w %s\n",
spec_name(victim->spec_fun)) ;
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
}
for (paf = victim->affected ; paf != NULL ; paf = paf->next)
{
char color ;
char word[6] ;
switch (paf->where)
{
case TO_RESIST: color = 'B' ; strnzcpy(word, sizeof(word), "res_") ; break ;
default: color = 'W' ; strnzcpy(word, sizeof(word), str_empty) ; break ;
}
// header
if (!ok)
buf_printf(output,
"{c| {GSpell: {GLocation: {GBy: {GHours: {GLvl: {GBitvector:\n");
buf_printf(output,
"{c| {C%-21.21s {C%-13.13s {C%6d {C%6d {C%4d {%c%-s%-s\n",
skill_name(paf->type), flag_string(apply_flags, paf->location),
paf->modifier, paf->duration, paf->level, color, word,
paf->where == TO_RESIST
? flag_string(dam_flags, paf->bitvector)
: flag_string(affect_flags, paf->bitvector));
ok = TRUE ;
}
if (ok)
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
if (!IS_NPC(victim))
{
qtrouble_t * qt ;
int i ;
if (IS_ON_QUEST(victim))
{
buf_printf(output,
"{c| {GQuest Giver: {Y%d {GQuest Points: {Y%d {GQuest Next: {Y%d\n",
victim->pcdata->questgiver,
victim->pcdata->questpoints,
victim->pcdata->questtime < 0 ?
-victim->pcdata->questtime : 0) ;
buf_printf(output,
"{c| {GQuest Count: {Y%d {GQuest Obj: {Y%d {GQuest Mob: {Y%d\n",
victim->pcdata->questtime > 0 ?
victim->pcdata->questtime : 0,
victim->pcdata->questobj,
victim->pcdata->questmob) ;
} else
{
buf_printf(output,
"{c| {GQuest Points: {Y%d {GQuestnext: {Y%d {WNOT QUESTING\n",
victim->pcdata->questpoints,
victim->pcdata->questtime < 0 ?
-victim->pcdata->questtime : 0) ;
}
buf_add(output, "{c| {GQuest Troubles: ") ;
for (i = 0, qt = victim->pcdata->qtrouble ; qt ; qt = qt->next)
{
snprintf(buf, sizeof(buf), "{y[{Y%d{y]{w-{y[{Y%d{y]", qt->vnum, qt->count-1) ;
if (i + strlen (buf) > 98)
{
buf_add(output, "\n{c| ") ;
i = 0 ;
}
buf_add(output, buf) ;
buf_add(output, " ") ;
i += strlen (buf + 1) ;
}
buf_add(output, "\n") ;
buf_printf(output,
"{c| {GQpBalance: {Y%d \n",
victim->pcdata->qpbalance);
buf_printf(output,
"{c| {GBonus Points: {Y%d \n",
victim->pcdata->bonuspoints);
buf_printf(output,
"{c+-------------------------------------------------------------------------+\n"
"{c| {RSecurity: {W%d\n", victim->pcdata->security) ;
if (!IS_NULLSTR(victim->pcdata->granted))
buf_printf(output,
"{c| {RGranted: {w[{W%s{w]\n",
fmt_wrap_str ((char *)victim->pcdata->granted, 61, "{c|{W ")) ;
if (victim->pcdata->freeze + victim->pcdata->nochan +
victim->pcdata->nocast + victim->pcdata->notell +
victim->pcdata->noemote + victim->pcdata->nonote +
victim->pcdata->noquest + victim->pcdata->plevels > 0)
{
int ok = FALSE ;
buf_add(output, "{c| {RPenalty: ") ;
if (victim->pcdata->freeze > 0)
{
buf_printf(output, "{Wfreeze {wuntil %s\n", strtime(victim->pcdata->freeze)) ;
ok = TRUE ;
}
if (victim->pcdata->nochan > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnochan {wuntil %s\n", strtime(victim->pcdata->nochan)) ;
ok = TRUE ;
}
if (victim->pcdata->notell > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnotell {wuntil %s\n", strtime(victim->pcdata->notell)) ;
ok = TRUE ;
}
if (victim->pcdata->noquest > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnoquest {wuntil %s\n", strtime(victim->pcdata->noquest)) ;
ok = TRUE ;
}
if (victim->pcdata->nonote > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnonote {wuntil %s\n", strtime(victim->pcdata->nonote)) ;
ok = TRUE ;
}
if (victim->pcdata->nocast > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnocast {wuntil %s\n", strtime(victim->pcdata->nocast)) ;
ok = TRUE ;
}
if (victim->pcdata->noemote > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wnoemote {wuntil %s\n", strtime(victim->pcdata->noemote)) ;
ok = TRUE ;
}
if (victim->pcdata->plevels > 0)
{
if (ok) buf_add(output, "{c| ") ;
buf_printf(output, "{Wpenalty levels {wby %d\n", victim->pcdata->plevels) ;
}
}
if (!IS_NULLSTR(victim->pcdata->twitlist))
buf_printf(output,
"{c| {GTwitlist: {c[{C%s{c]\n",
fmt_wrap_str ((char *)victim->pcdata->twitlist, 61, "{c|{C ")) ;
buf_add(output,
"{c+-------------------------------------------------------------------------+\n") ;
}
buf_printf(output,
"{c| {GLast fought: {w%s {GLast fight time: {w%d {RFighting: {w%s\n",
victim->last_fought ? victim->last_fought->name : "none",
victim->last_fight_time <= 0 ? -1 : current_time - victim->last_fight_time,
victim->fighting ? victim->fighting->name : "none") ;
if (IS_PUMPED(victim))
buf_add(output,
"{c| {RAdrenalin is gushing.\n") ;
buf_printf(output,
"{c| {GIn_mind: {y[{Y%s{y]\n"
"{c+-------------------------------------------------------------------------+{x\n",
victim->in_mind ? victim->in_mind : "none") ;
page_to_char(buf_string(output), ch) ;
buf_free(output);
if (loaded)
char_nuke(victim);
}
DO_FUN(do_dstat)
{
BUFFER *output;
DESCRIPTOR_DATA *d;
char arg[MAX_INPUT_LENGTH];
int desc;
one_argument(argument, arg, sizeof(arg));
desc = atoi(arg);
for (d = descriptor_list; d; d = d->next)
if (d->descriptor == desc)
break;
if (!d)
{
char_act("dstat: descriptor not found", 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->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);
}
DO_FUN(do_vnum)
{
char arg[MAX_INPUT_LENGTH];
const char *string;
string = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Syntax:", ch);
char_act(" vnum obj <name>", ch);
char_act(" vnum mob <name>", ch);
return;
}
if (!str_cmp(arg, "obj"))
{
do_ofind(ch, string);
return;
}
if (!str_cmp(arg, "mob") || !str_cmp(arg, "char"))
{
do_mfind(ch, string);
return;
}
/* do both */
do_mfind(ch, argument);
do_ofind(ch, argument);
}
DO_FUN(do_mfind)
{
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_act("Find whom?", 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_act("No mobiles by that name.", ch);
}
DO_FUN(do_ofind)
{
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_act("Find what?", 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_act("No objects by that name.", ch);
}
DO_FUN(do_owhere)
{
BUFFER *buffer = NULL;
OBJ_DATA *obj;
OBJ_DATA *in_obj;
int number = 0, max_found = 200;
int vnum = 0;
if (argument[0] == '\0')
{
char_act("Find what?", ch);
return;
}
if (is_number(argument))
vnum = atoi(argument);
for (obj = object_list; obj != NULL; obj = obj->next)
{
if (!can_see_obj(ch, obj) || (!vnum && !is_name(argument, obj->name))
|| (vnum && vnum != obj->pIndexData->vnum) || (ch->level < obj->level && !IS_IMMORTAL(ch)))
continue;
if (buffer == NULL)
buffer = buf_new(-1);
number++;
for (in_obj = obj; in_obj->in_obj != NULL;
in_obj = in_obj->in_obj)
;
if (in_obj->carried_by != NULL
&& can_see(ch,in_obj->carried_by)
&& in_obj->carried_by->in_room != NULL)
buf_printf(buffer,
"%3d) %s is carried by %s [Room %d]\n",
number,
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) %s is in %s [Room %d]\n",
number, mlstr_mval(obj->short_descr),
mlstr_cval(in_obj->in_room->name, ch),
in_obj->in_room->vnum);
else
{
if (auction.item != NULL && auction.item == obj)
buf_printf(buffer, "%3d) %s is on auction\n", number,
mlstr_mval(obj->short_descr));
else
buf_printf(buffer, "%3d) %s is somewhere\n", number,
mlstr_mval(obj->short_descr));
}
if (number >= max_found)
break;
}
if (buffer == NULL)
char_act("Nothing like that in heaven or earth.", ch);
else
{
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
}
}
DO_FUN(do_mwhere)
{
BUFFER *buffer;
CHAR_DATA *victim;
int count = 0, vnum = 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 && 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) %s (in the body of %s) is in %s [%d]\n",
count, d->original->name,
mlstr_mval(victim->short_descr),
mlstr_mval(victim->in_room->name),
victim->in_room->vnum);
else
buf_printf(buffer,"%3d) %s is in %s [%d]\n",
count, victim->name,
mlstr_mval(victim->in_room->name),
victim->in_room->vnum);
}
}
page_to_char(buf_string(buffer),ch);
buf_free(buffer);
return;
}
buffer = NULL;
if (is_number(argument))
vnum = atoi(argument);
for (victim = char_list; victim; victim = victim->next)
if (victim->in_room
&& ((!vnum && is_name(argument, victim->name))
|| (vnum && IS_NPC(victim) && vnum == victim->pIndexData->vnum)))
{
if (buffer == NULL)
buffer = buf_new(-1);
count++;
buf_printf(buffer, "%3d) [%5d] %-28s [%5d] %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);
}
DO_FUN(do_reboo)
{
char_act("If you want to REBOOT, spell it out.", ch);
}
DO_FUN(do_shutdow)
{
char_act("If you want to SHUTDOWN, spell it out.", ch);
}
DO_FUN(do_shutdown)
{
char buf[MAX_STRING_LENGTH];
if (ch->level > 100)
{
trim_ch(ch);
return;
}
if (reboot_counter > 0)
char_printf(ch, "Shutdown in %i ticks.\n", reboot_counter);
else
char_act("Shutdown after next reboot.", ch);
snprintf(buf, sizeof(buf), "Shutdown by %s.", ch->name);
append_file(ch, SHUTDOWN_FILE, buf);
log(buf);
}
DO_FUN(do_protect)
{
CHAR_DATA *victim;
if (argument[0] == '\0')
{
char_act("Protect whom from snooping?", ch);
return;
}
if ((victim = get_char_world(ch,argument)) == NULL)
{
char_act("You can't find them.", 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_act("Your snoop-proofing was just removed.", victim);
REMOVE_BIT(victim->comm, COMM_SNOOP_PROOF);
} else
{
act_puts("$N is now snoop-proof.", ch, NULL, victim, TO_CHAR, POS_DEAD);
// char_act("You are now immune to snooping.", victim);
SET_BIT(victim->comm, COMM_SNOOP_PROOF);
}
}
DO_FUN(do_snoop)
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Snoop whom?", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
char_act("They aren't here.", ch);
return;
}
if (victim->desc == NULL)
{
char_act("No descriptor to snoop.", ch);
return;
}
if (victim == ch)
{
char_act("Cancelling all snoops.", ch);
wiznet("$N stops being such a snoop.", ch, NULL, WIZ_SNOOPS,
WIZ_SECURE, 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_act("Busy already.", 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_act("That character is in a private room.", ch);
return;
}
if ((victim->level >= ch->level
|| (IS_SET(victim->comm, COMM_SNOOP_PROOF))) && !IS_TRUSTED(ch, IMPLEMENTOR))
{
char_act("You failed.", 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_act("No snoop loops.", ch);
return;
}
victim->desc->snoop_by = ch->desc;
wiznet_printf(ch, NULL, WIZ_SNOOPS, WIZ_SECURE, ch->level,
"$N starts snooping on %s",
(IS_NPC(ch) ?
mlstr_mval(victim->short_descr) : victim->name));
char_act("Ok.", ch);
}
DO_FUN(do_switch)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Switch into whom?", ch);
return;
}
if (ch->desc == NULL)
return;
if (ch->desc->original != NULL)
{
char_act("You are already switched.", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
char_act("They aren't here.", ch);
return;
}
if (victim == ch)
{
char_act("Ok.", ch);
return;
}
if (!IS_NPC(victim))
{
char_act("You can only switch into mobiles.", 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_act("That character is in a private room.", ch);
return;
}
if (victim->desc != NULL)
{
char_act("Character in use.", ch);
return;
}
wiznet_printf(ch, NULL, WIZ_SWITCHES, WIZ_SECURE, ch->level,
"$N switches into %s", mlstr_mval(victim->short_descr));
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_dup(ch->prompt);
victim->comm = ch->comm;
victim->lines = ch->lines;
char_act("Ok.", victim);
}
DO_FUN(do_return)
{
if (ch->desc == NULL)
return;
if (ch->desc->original == NULL)
return;
char_act("You return to your original body.", ch);
if (ch->prompt != NULL)
{
free_string(ch->prompt);
ch->prompt = NULL;
}
wiznet_printf(ch->desc->original, 0, WIZ_SWITCHES, WIZ_SECURE,
ch->level, "$N returns from %s.",
mlstr_mval(ch->short_descr));
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 */
DO_FUN(do_clone)
{
char arg[MAX_INPUT_LENGTH];
const char *rest;
CHAR_DATA *mob;
OBJ_DATA *obj;
if (IS_NPC(ch))
return;
rest = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Clone what?", ch);
return;
}
if (!str_prefix(arg,"object"))
{
mob = NULL;
obj = get_obj_here(ch, rest);
if (obj == NULL)
{
char_act("You don't see that here.", ch);
return;
}
} else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character"))
{
obj = NULL;
mob = get_char_room(ch, rest);
if (mob == NULL)
{
char_act("You don't see that here.", ch);
return;
}
} else
{ /* find both */
mob = get_char_room(ch, argument);
obj = get_obj_here(ch, argument);
if (mob == NULL && obj == NULL)
{
char_act("You don't see that here.", ch);
return;
}
}
/* clone an object */
if (obj)
{
OBJ_DATA *clone;
if (!obj_check(ch,obj))
{
char_act("You haven't enough power.", 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,WIZ_SECURE,ch->level);
return;
} else if (mob != NULL)
{
CHAR_DATA *clone;
OBJ_DATA *new_obj;
if (!IS_NPC(mob))
{
char_act("You can only clone mobiles.", ch);
return;
}
if (!mob_check(ch, mob))
{
char_act("You haven't enough power.", 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;
}
char_to_room(clone, ch->in_room);
act("$n has created $N.", ch, NULL, clone, TO_ROOM);
act("You clone $N.", ch, NULL, clone, TO_CHAR);
wiznet_printf(ch, NULL, WIZ_LOAD, WIZ_SECURE, ch->level,
"$N clones %s.", mlstr_mval(clone->short_descr));
}
}
/* RT to replace the two load commands */
DO_FUN(do_load)
{
char arg[MAX_INPUT_LENGTH];
if (ch->level > 100)
{
trim_ch(ch);
return;
}
if (IS_NPC(ch))
return;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Syntax:", ch);
char_act(" load mob <vnum>", ch);
char_act(" load obj <vnum> <level>", 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);
}
DO_FUN(do_mload)
{
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_act("Syntax: load mob <vnum>.", 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);
char_to_room(victim, ch->in_room);
act("$n has created $N!", ch, NULL, victim, TO_ROOM);
wiznet_printf(ch, NULL, WIZ_LOAD, WIZ_SECURE, ch->level,
"$N loads %s.", mlstr_mval(victim->short_descr));
char_act("Ok.", ch);
}
DO_FUN(do_oload)
{
char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
int level = 0;
int vnum;
argument = one_argument(argument, arg1, sizeof(arg1));
one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0' || !is_number(arg1))
{
char_act("Syntax: load obj <vnum>.", ch);
return;
}
vnum = atoi(arg1);
if ((pObjIndex = get_obj_index(vnum)) == NULL)
{
char_printf(ch, "%d: No objects with this vnum.\n", vnum);
return;
}
if (pObjIndex->limit != -1 && ch->pcdata->security < SEC_LOAD_LIMIT)
{
char_act("OLoad: Insufficient security.", ch);
return;
}
obj = create_obj(pObjIndex, level);
if (CAN_WEAR(obj, ITEM_TAKE))
obj_to_char(obj, ch);
else
obj_to_room(obj, ch->in_room);
act("$n ÓÏÚÄÁÅÔ $p!", ch, obj, NULL, TO_ROOM);
wiznet("$N loads $p.", ch, obj, WIZ_LOAD, WIZ_SECURE, ch->level);
char_act("Ok.", ch);
}
DO_FUN(do_purge)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
DESCRIPTOR_DATA *d;
one_argument(argument, arg, sizeof(arg));
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, TRUE);
}
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);
}
act("$n purges the room!", ch, NULL, NULL, TO_ROOM);
char_act("Ok.", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
char_act("They aren't here.", ch);
return;
}
if (!IS_NPC(victim))
{
if (ch == victim)
{
char_act("Ho ho ho.", ch);
return;
}
if (ch->level <= victim->level)
{
char_act("Maybe that wasn't a good idea...", 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, TRUE);
d = victim->desc;
extract_char(victim, TRUE);
if (d)
close_descriptor(d);
return;
}
act("$n purges $N.", ch, NULL, victim, TO_NOTVICT);
extract_char(victim, TRUE);
}
DO_FUN(do_restore)
{
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;
vch->psp = psp_max(vch);
update_pos(vch);
act("$n has restored you.", ch,NULL,vch,TO_VICT);
}
wiznet_printf(ch,NULL,WIZ_RESTORE,WIZ_SECURE,ch->level,
"$N restored room %d.", ch->in_room->vnum);
char_act("Room restored.", ch);
return;
}
if (ch->level >= MAX_LEVEL - 5 && !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;
Showing the first 100 KB of 228.5 KB. Download the archive for the full file.