act_wiz.c
FlCodebase3.1/src/act_wiz.c · 289.0 KB
From the archive FlCodebase3.1.tgz
Download the archive « Back to the archive contents
/***************************************************************************
* 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 Envy Diku Mud, you must comply with *
* the original Diku license in 'license.doc', the Merc license in *
* 'license.txt', as well as the Envy license in 'license.nvy'. *
* 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-1998 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@hypercube.org) *
* Gabrielle Taylor (gtaylor@hypercube.org) *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
* *
* Code Adapted and Improved by Abandoned Realms Mud *
* and Aabahran: The Forsaken Lands Mud by Virigoth *
* *
* Continued Production of this code is available at www.flcodebase.com *
***************************************************************************/
#include <sys/types.h>
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
#include "s_skill.h"
#include "recycle.h"
#include "interp.h"
#include "magic.h"
#include "cabal.h"
#include "vote.h"
#include "tome.h"
#include "bounty.h"
#include "dndspell.h"
#include "comm.h"
#include "clan.h"
extern void show_flag_cmds( CHAR_DATA *ch, const struct flag_type *flag_table );
extern char *flag_string args ( ( const struct flag_type *flag_table, int bits ) );
extern bool hide_note(CHAR_DATA *ch, NOTE_DATA *pnote);
extern void note_remove( CHAR_DATA *ch, NOTE_DATA *pnote, bool delete);
extern bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote );
extern NOTE_DATA *application_list;
extern void trap_update();
void do_wepfind( CHAR_DATA *ch, char *argument );
void do_wiznet( CHAR_DATA *ch, char *argument )
{
int flag;
char buf[MSL];
if ( argument[0] == '\0' )
{
if (IS_SET(ch->wiznet,WIZ_ON))
{
send_to_char("Signing off of Wiznet.\n\r",ch);
REMOVE_BIT(ch->wiznet,WIZ_ON);
}
else
{
send_to_char("Welcome to Wiznet!\n\r",ch);
SET_BIT(ch->wiznet,WIZ_ON);
}
return;
}
if (!str_prefix(argument,"on"))
{
send_to_char("Welcome to Wiznet!\n\r",ch);
SET_BIT(ch->wiznet,WIZ_ON);
return;
}
if (!str_prefix(argument,"off"))
{
send_to_char("Signing off of Wiznet.\n\r",ch);
REMOVE_BIT(ch->wiznet,WIZ_ON);
return;
}
if (!str_prefix(argument,"status"))
{
buf[0] = '\0';
if (!IS_SET(ch->wiznet,WIZ_ON))
strcat(buf,"off ");
for (flag = 0; wiznet_table[flag].name != NULL; flag++)
if (IS_SET(ch->wiznet,wiznet_table[flag].flag))
{
strcat(buf,wiznet_table[flag].name);
strcat(buf," ");
}
strcat(buf,"\n\r");
send_to_char("Wiznet status:\n\r",ch);
send_to_char(buf,ch);
return;
}
if (!str_prefix(argument,"show"))
{
buf[0] = '\0';
for (flag = 0; wiznet_table[flag].name != NULL; flag++)
if (wiznet_table[flag].level <= get_trust(ch))
{
strcat(buf,wiznet_table[flag].name);
strcat(buf," ");
}
strcat(buf,"\n\r");
send_to_char("Wiznet options available to you are:\n\r",ch);
send_to_char(buf,ch);
return;
}
flag = wiznet_lookup(argument);
if (flag == -1 || get_trust(ch) < wiznet_table[flag].level)
{
send_to_char("No such option.\n\r",ch);
return;
}
if (IS_SET(ch->wiznet,wiznet_table[flag].flag))
{
sendf(ch,"You will no longer see %s on wiznet.\n\r", wiznet_table[flag].name);
REMOVE_BIT(ch->wiznet,wiznet_table[flag].flag);
return;
}
else
{
sendf(ch,"You will now see %s on wiznet.\n\r", wiznet_table[flag].name);
SET_BIT(ch->wiznet,wiznet_table[flag].flag);
return;
}
}
void wiznet(char *string, CHAR_DATA *ch, OBJ_DATA *obj,long flag, long flag_skip, int min_level)
{
char buf[MSL], newtime[9];
char *strtime = (char *) ctime( &mud_data.current_time );
DESCRIPTOR_DATA *d;
int pos = 0, i = 1;
do
{
if (i > 11)
buf[pos++] = *strtime;
}
while (*strtime++ && i++ && pos < 8);
buf[pos] = '\0';
strcpy(newtime, buf);
sprintf(buf,"`&W`8i`&ZNET`8 ``%s`8: ``%s", newtime, string);
for ( d = descriptor_list; d != NULL; d = d->next )
{
if (d->connected == CON_PLAYING && IS_IMMORTAL(d->character) && IS_SET(d->character->wiznet,WIZ_ON)
&& (!flag || IS_SET(d->character->wiznet,flag)) && (!flag_skip || !IS_SET(d->character->wiznet,flag_skip))
&& get_trust(d->character) >= min_level && d->character != ch)
act_new(buf,d->character,obj,ch,TO_CHAR,POS_DEAD);
}
}
void do_doof( CHAR_DATA *ch, char *argument )
{
char arg1[MIL];
CHAR_DATA *victim;
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' )
{
send_to_char( "Syntax: forsake <char>\n\r",ch);
return;
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't playing.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Why would you want to forsaken a mob?\n\r",ch);
return;
}
SET_BIT(victim->act, PLR_DOOF);
sendf(ch, "%s has been Forsaken.\n\r", PERS2(victim));
send_to_char( "You have been Forsaken by the Gods.\n\r",victim);
}
// set the most on counter (IMM only)
void do_most( CHAR_DATA *ch, char *argument )
{
int prev = mud_data.max_on;
mud_data.max_on = atoi (argument);
sendf(ch, "Previous Maximum on: %d\n\rNew Maximum on: %d\n\r", prev, mud_data.max_on);
}
// toggle the coding flag in the title (IMM ONLY)
void do_coding( CHAR_DATA *ch, char *argument )
{
/* if immortal and coding, turn coding off */
if ( IS_IMMORTAL(ch) && IS_SET(ch->act2, PLR_CODING)) {
REMOVE_BIT(ch->act2, PLR_CODING);
sendf(ch, "You are no longer CODING.\n\r");
}
/* else if immortal, set coding */
else if ( IS_IMMORTAL(ch)) {
SET_BIT(ch->act2, PLR_CODING);
sendf(ch, "You are now CODING.\n\r");
}
}
void do_plag( CHAR_DATA *ch, char *argument )
{
int lagtime = 120;
char arg1[MIL], arg2[MIL];
CHAR_DATA *victim;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Syntax: plag <char> <(optional) seconds>\n\r",ch);
return;
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't playing.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Why would you want to lag a mob?\n\r",ch);
return;
}
if ( arg2[0] != '\0' )
lagtime = atoi(arg2) * 4;
WAIT_STATE(victim,lagtime);
sendf(ch, "%s is experiencing some technical difficulties.\n\r",PERS2(victim));
}
void do_nochannels( CHAR_DATA *ch, char *argument )
{
char arg[MIL], buf[MSL];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Nochannel whom?", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( get_trust( victim ) > get_trust( ch ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
if ( IS_SET(victim->comm, COMM_NOCHANNELS) )
{
REMOVE_BIT(victim->comm, COMM_NOCHANNELS);
send_to_char( "The gods have restored your channel priviliges.\n\r",victim );
sendf(ch, "NOCHANNELS removed from %s.\n\r", PERS2(victim) );
sprintf(buf,"$N restores channels to %s",victim->name);
wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,get_trust(ch));
}
else
{
SET_BIT(victim->comm, COMM_NOCHANNELS);
send_to_char( "The gods have revoked your channel priviliges.\n\r", victim );
sendf(ch, "NOCHANNELS set on %s.\n\r", PERS2(victim) );
sprintf(buf,"$N revokes %s's channels.",victim->name);
wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,get_trust(ch));
}
}
void do_bamfin( CHAR_DATA *ch, char *argument )
{
if ( !IS_NPC(ch) )
{
smash_tilde( argument );
if (argument[0] == '\0')
{
sendf(ch,"Your poofin is %s\n\r",ch->pcdata->bamfin);
return;
}
if ( strstr(argument,ch->name) == NULL)
{
send_to_char("You must include your name.\n\r",ch);
return;
}
free_string( ch->pcdata->bamfin );
ch->pcdata->bamfin = str_dup( argument );
sendf(ch,"Your poofin is now %s\n\r",ch->pcdata->bamfin);
}
}
void do_bamfout( CHAR_DATA *ch, char *argument )
{
if ( !IS_NPC(ch) )
{
smash_tilde( argument );
if (argument[0] == '\0')
{
sendf(ch,"Your poofout is %s\n\r",ch->pcdata->bamfout);
return;
}
if ( strstr(argument,ch->name) == NULL)
{
send_to_char("You must include your name.\n\r",ch);
return;
}
free_string( ch->pcdata->bamfout );
ch->pcdata->bamfout = str_dup( argument );
sendf(ch,"Your poofout is now %s\n\r",ch->pcdata->bamfout);
}
}
void do_deny( CHAR_DATA *ch, char *argument )
{
char arg[MIL], buf[MSL];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Deny whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( get_trust( victim ) > get_trust( ch ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
SET_BIT(victim->act, PLR_DENY);
send_to_char( "You are denied access!\n\r", victim );
sprintf(buf,"$N denies access to %s",victim->name);
wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,get_trust(ch));
sendf(ch, "You have denied %s.\n\r", PERS2(victim));
if (victim->pcdata->pbounty){
rem_bounty( victim->pcdata->pbounty );
free_bounty( victim->pcdata->pbounty );
}
save_char_obj(victim);
stop_fighting(victim,TRUE);
do_quit( victim, "" );
}
void do_disconnect( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Disconnect whom?\n\r", ch );
return;
}
if (is_number(arg))
{
int desc;
desc = atoi(arg);
for ( d = descriptor_list; d != NULL; d = d->next )
if ( d->descriptor == desc )
{
sendf(ch, "Disconnected %d\n\r", desc);
close_socket( d );
return;
}
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim->desc == NULL )
{
sendf(ch, "%s does not have a descriptor.\n\r", arg);
return;
}
for ( d = descriptor_list; d != NULL; d = d->next )
if ( d == victim->desc )
{
sendf(ch, "Disconnected %s\n\r", arg );
close_socket( d );
return;
}
bug( "Do_disconnect: desc not found.", 0 );
send_to_char( "Descriptor not found!\n\r", ch );
}
void do_pardon( CHAR_DATA *ch, char *argument )
{
char arg1[MIL], arg2[MIL];
CHAR_DATA *victim;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Syntax: pardon <character> <wanted>.\n\r", ch );
send_to_char( "Syntax: pardon <character> <forsaken>.\n\r"\
"Syntax: pardon <character> <pk>.\n\r"\
"Syntax: pardon <character> <stain>.\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( IS_NPC(ch) )
{
send_to_char( "Not by NPC's.\n\r", ch );
return;
}
if ( !str_cmp( arg2, "wanted" ) )
{
if ( IS_SET(victim->act, PLR_WANTED) )
{
REMOVE_BIT( victim->act, PLR_WANTED );
sendf(ch, "%s is no longer WANTED.\n\r", PERS2(victim) );
send_to_char( "You are no longer WANTED.\n\r", victim );
}
return;
}
if ( !str_cmp( arg2, "forsaken" ) )
{
if ( IS_SET(victim->act, PLR_DOOF) )
{
REMOVE_BIT( victim->act, PLR_DOOF );
sendf(ch, "%s is no longer Forsaken.\n\r", PERS2(victim) );
send_to_char( "You have regained the favor of the Gods.\n\r", victim );
}
return;
}
if ( !str_cmp( arg2, "pk" ) )
{
if ( IS_GAME(victim, GAME_PKWARN) ){
REMOVE_BIT( victim->game, GAME_PKWARN );
sendf(ch, "%s is no longer marked PK.\n\r", PERS2(victim) );
send_to_char( "You have been pardoned of your trashy acts.\n\r", victim );
}
return;
}
else if (!str_cmp(arg2, "stain")){
AFFECT_DATA af;
AFFECT_DATA* paf;
int sn = skill_lookup("pardon");
if (IS_NPC(ch)){
send_to_char("Not mobs\n\r", ch);
return;
}
if (!ch->desc){
send_to_char("No while link dead\n\r", ch);
return;
}
if (!IS_GAME(victim, GAME_STAIN)){
send_to_char("That person is not <`!STAINED``>\n\r", ch);
return;
}
if ( (paf = affect_find(victim->affected, sn)) == NULL){
char buf[MIL];
af.type = sn;
af.level = 0;
af.duration = 5;
af.where = TO_NONE;
af.bitvector = 0;
af.location = APPLY_NONE;
af.modifier = 0;
paf = affect_to_char(victim, &af);
string_to_affect(paf, ch->name);
sprintf(buf, "In order for STAIN to be cleared another immortal must use \"pardon\" command on %s within 5 ticks.\n\r", victim->name);
wiznet(buf, ch, NULL,WIZ_DEATHS,WIZ_SECURE, LEVEL_HERO);
send_to_char(buf, ch);
sprintf(buf, "%s attempted to pardon %s\n\r", ch->name, victim->name);
log_string(buf);
return;
}
if (paf->has_string && str_cmp(paf->string, ch->name)){
OBJ_DATA* obj;
CHAR_DATA* vch;
char buf[MIL];
/* get original pardon character to verify ip's */
if ( (vch = get_char(paf->string)) == NULL){
send_to_char("Original pardon owner not found. Aborting...\n\r", ch);
return;
}
/* check ip's */
if (!str_cmp(vch->desc->ident, ch->desc->ident)){
send_to_char("Your ip address matches original pardon. Aborting...\n\r", ch);
return;
}
sprintf(buf, "Stain removed from %s\n\r", victim->name);
wiznet(buf, ch, NULL,WIZ_DEATHS,WIZ_SECURE, LEVEL_HERO);
send_to_char(buf, ch);
sprintf(buf, "%s: Stain removed on %s.", ch->name, victim->name);
log_string(buf);
/* strip affects from pardon */
affect_strip(victim, sn);
/* remove stains on object char. has */
REMOVE_BIT(victim->game, GAME_STAIN);
for ( obj = victim->carrying; obj != NULL; obj = obj->next_content ){
REMOVE_BIT(obj->extra_flags, ITEM_STAIN);
}
}
else{
send_to_char("You need two different Immortals to remove the stain.\n\r", ch);
return;
}
return;
}
do_pardon(ch, "");
}
void do_echo( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
if ( argument[0] == '\0' )
{
send_to_char( "Global echo what?\n\r", ch );
return;
}
for ( d = descriptor_list; d; d = d->next )
if ( d->connected == CON_PLAYING )
{
if (get_trust(d->character) >= get_trust(ch))
send_to_char( "global> ",d->character);
sendf( d->character, "%s\n\r", argument );
}
}
//echos in an area
void aecho( AREA_DATA* area, char* echo ){
DESCRIPTOR_DATA *d;
for ( d = descriptor_list; d; d = d->next ){
if ( d->connected == CON_PLAYING
&& d->character->in_room->area
&& d->character->in_room->area == area
&& IS_AWAKE(d->character)){
send_to_char(echo,d->character);
}
}
}
//echos to playes in same area as ch
void do_zecho( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
if ( argument[0] == '\0' )
{
send_to_char( "Global echo what?\n\r", ch );
return;
}
for ( d = descriptor_list; d; d = d->next )
if ( d->connected == CON_PLAYING && d->character->in_room->area
&& d->character->in_room->area == ch->in_room->area)
{
if (get_trust(d->character) >= get_trust(ch))
send_to_char( "global> ",d->character);
sendf( d->character, "%s\n\r", argument );
}
}
void do_immecho( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
if ( argument[0] == '\0' )
{
send_to_char( "Global echo what?\n\r", ch );
return;
}
for ( d = descriptor_list; d; d = d->next )
if ( d->connected == CON_PLAYING )
{
if (!IS_IMMORTAL(d->character))
continue;
if (get_trust(d->character) >= get_trust(ch))
send_to_char( "global> ",d->character);
sendf( d->character, "%s\n\r", argument );
}
}
ROOM_INDEX_DATA *find_location( CHAR_DATA *ch, char *arg )
{
CHAR_DATA *victim;
OBJ_DATA *obj;
if ( is_number(arg) )
return (atoi(arg) < 0 ? NULL : get_room_index( atoi( arg ) ) );
if ( ( victim = get_char_world( ch, arg ) ) != NULL )
return victim->in_room;
if ( ( obj = get_obj_world( ch, arg ) ) != NULL )
return obj->in_room;
return NULL;
}
/* Written by: Virigoth *
* Returns: void *
* Used: act_wiz.c, *
* Comment: trans target AND his charmies */
void do_gtransfer( CHAR_DATA *ch, char *argument )
{
char arg1[MIL], arg2[MIL];
ROOM_INDEX_DATA *location;
CHAR_DATA *victim, *vch, *vch_next;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Transfer whom (and where)?\n\r", ch );
return;
}
if ( arg2[0] == '\0' )
location = ch->in_room;
else
{
if ( ( location = find_location( ch, arg2 ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( room_is_private( location ) && get_trust(ch) < MAX_LEVEL)
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim->in_room == NULL )
{
sendf( ch, "%s is in limbo.\n\r", PERS2(victim) );
return;
}
/* We move the charmies/followers */
for (vch = victim->in_room->people; vch != NULL; vch = vch_next){
vch_next = vch->next_in_room;
if (vch->master != victim)
continue;
if ( vch->fighting != NULL )
continue;
if (!IS_NPC(vch))
vch->pcdata->transnum = vch->in_room->vnum;
if ( ch->desc )
act( "$n disappears in a mushroom cloud.", vch, NULL, NULL, TO_ROOM );
char_from_room( vch );
char_to_room( vch, location );
if ( ch->desc )
act( "$n arrives from a puff of smoke.", vch, NULL, NULL, TO_ROOM );
else
act( "$n has arrived.", vch, NULL, NULL, TO_ROOM );
if ( ch != vch && ch->desc )
act( "$n has transferred you.", ch, NULL, vch, TO_VICT );
do_look( vch, "auto" );
sendf( ch, "You have transferred %s.\n\r", PERS2(vch) );
}
if ( victim->fighting != NULL )
stop_fighting( victim, TRUE );
if (!IS_NPC(victim))
victim->pcdata->transnum = victim->in_room->vnum;
if ( ch->desc )
act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM );
char_from_room( victim );
char_to_room( victim, location );
if ( ch->desc )
act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM );
else
act( "$n has arrived.", victim, NULL, NULL, TO_ROOM );
if ( ch != victim && ch->desc )
act( "$n has transferred you.", ch, NULL, victim, TO_VICT );
do_look( victim, "auto" );
sendf( ch, "You have transferred %s.\n\r", PERS2(victim) );
}
void do_transfer( CHAR_DATA *ch, char *argument )
{
char arg1[MIL], arg2[MIL];
ROOM_INDEX_DATA *location;
CHAR_DATA *victim, *player;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Transfer whom (and where)?\n\r", ch );
return;
}
if ( !str_cmp( arg1, "all" ) )
{
for ( player = player_list; player != NULL; player = player->next_player )
if ( player != ch && player->in_room != NULL && can_see( ch, player ) )
{
char buf[MSL];
sprintf( buf, "%s %s", player->name, arg2 );
do_transfer( ch, buf );
}
return;
}
if ( arg2[0] == '\0' )
location = ch->in_room;
else
{
if ( ( location = find_location( ch, arg2 ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( room_is_private( location ) && get_trust(ch) < MAX_LEVEL)
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim->in_room == NULL )
{
sendf( ch, "%s is in limbo.\n\r", PERS2(victim) );
return;
}
if ( victim->fighting != NULL )
stop_fighting( victim, TRUE );
if (!IS_NPC(victim))
victim->pcdata->transnum = victim->in_room->vnum;
if ( ch->desc )
act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM );
char_from_room( victim );
char_to_room( victim, location );
if ( ch->desc )
act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM );
else
act( "$n has arrived.", victim, NULL, NULL, TO_ROOM );
if ( ch != victim && ch->desc )
act( "$n has transferred you.", ch, NULL, victim, TO_VICT );
do_look( victim, "auto" );
sendf( ch, "You have transferred %s.\n\r", PERS2(victim) );
}
void do_untransfer( CHAR_DATA *ch, char *argument )
{
char arg1[MIL];
CHAR_DATA *victim, *player;
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' )
{
send_to_char( "Untransfer whom?\n\r", ch );
return;
}
if ( !str_cmp( arg1, "all" ) )
{
for ( player = player_list; player != NULL; player = player->next_player )
if ( player != ch && player->in_room != NULL && can_see( ch, player ) )
{
char buf[MSL];
sprintf( buf, "%s %s", player->name, arg1);
do_untransfer( ch, buf );
}
return;
}
if ( ( victim = get_char_room( ch, NULL, arg1 ) ) == NULL )
{
send_to_char( "They aren't in this room.\n\r", ch );
return;
}
if ( victim->in_room == NULL )
{
sendf( ch, "%s is in limbo.\n\r", PERS2(victim) );
return;
}
if ( !IS_NPC(victim) && victim->pcdata->transnum == 0)
{
sendf( ch, "%s has nowhere to return to.\n\r", PERS2(victim) );
return;
}
if ( victim->fighting != NULL )
stop_fighting( victim, TRUE );
if ( ch->desc )
act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM );
char_from_room( victim );
if (!IS_NPC(victim))
{
if (get_room_index(victim->pcdata->transnum) == NULL){
send_to_char("They have no where to go.\n\r", ch);
return;
}
char_to_room( victim, get_room_index(victim->pcdata->transnum));
victim->pcdata->transnum = 0;
}
else
char_to_room( victim, get_room_index(victim->homevnum));
if ( ch->desc )
act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM );
else
act( "$n has arrived.", victim, NULL, NULL, TO_ROOM );
if ( ch != victim && ch->desc )
act( "$n has transferred you.", ch, NULL, victim, TO_VICT );
do_look( victim, "auto" );
sendf( ch, "You have untransferred %s.\n\r", PERS2(victim) );
}
void do_at( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
ROOM_INDEX_DATA *location, *original;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "At where what?\n\r", ch );
return;
}
if ( ( location = find_location( ch, arg ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( room_is_private( location ) && get_trust(ch) < MAX_LEVEL)
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
original = ch->in_room;
char_from_room( ch );
char_to_room( ch, location );
interpret( ch, argument );
char_from_room( ch );
char_to_room( ch, original );
}
void do_goto( CHAR_DATA *ch, char *argument )
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
int count = 0;
if ( argument[0] == '\0' )
{
send_to_char( "Goto where?\n\r", ch );
return;
}
if ( ( location = find_location( ch, argument ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
count = 0;
for ( rch = location->people; rch != NULL; rch = rch->next_in_room )
count++;
if (room_is_private(location) && (count > 1 || get_trust(ch) < MAX_LEVEL))
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
if ( ch->fighting != NULL )
stop_fighting( ch, TRUE );
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (get_trust(rch) >= ch->invis_level && ch->desc && !IS_SET(ch->act2,PLR_NOWHO))
{
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 );
char_to_room( ch, location );
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (get_trust(rch) >= ch->invis_level && ch->desc && !IS_SET(ch->act2,PLR_NOWHO))
{
if (ch->pcdata != NULL && ch->pcdata->bamfin[0] != '\0')
act("$t",ch,ch->pcdata->bamfin,rch,TO_VICT);
else
act("$n appears in a swirling mist.",ch,NULL,rch,TO_VICT);
}
do_look( ch, "auto" );
}
void do_violate( CHAR_DATA *ch, char *argument )
{
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
if ( argument[0] == '\0' )
{
send_to_char( "Goto where?\n\r", ch );
return;
}
if ( ( location = find_location( ch, argument ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if (!room_is_private( location ))
{
send_to_char( "That room isn't private, use goto.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
if ( ch->fighting != NULL )
stop_fighting( ch, TRUE );
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (get_trust(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 );
char_to_room( ch, location );
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
if (get_trust(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 appears in a swirling mist.",ch,NULL,rch,TO_VICT);
}
do_look( ch, "auto" );
}
void do_sstat ( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
CHAR_DATA *victim;
int col = 0;
int sn = 0;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Stat whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, argument ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if (IS_NPC(victim)){
send_to_char("Not on mobs.\n\r", ch);
return;
}
sendf( ch, "Name: %s's progress:\n\r", victim->name);
for ( sn = 0; sn < MAX_SKILL; sn++ )
{
if ( skill_table[sn].name == NULL )
break;
if ( victim->pcdata->learned[sn] > 0 && sklevel(victim,sn) <= victim->level )
{
sendf( ch, "%-19s %3d(%d)%% ",skill_table[sn].name, victim->pcdata->learned[sn],
URANGE(0, victim->pcdata->learned[sn] + victim->pcdata->to_learned[sn], 110));
if ( ++col % 3 == 0 )
send_to_char( "\n\r", ch );
}
}
if ( col % 3 != 0 )
send_to_char( "\n\r", ch );
sendf( ch, "%d practice sessions left.\n\r",victim->practice );
}
void do_sngstat ( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
CHAR_DATA *victim;
int col = 0;
int sn = 0;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Stat whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, argument ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if (IS_NPC(victim)){
send_to_char("Not on mobs.\n\r", ch);
return;
}
sendf( ch, "Name: %s's songs:\n\r", victim->name);
for ( sn = 0; sn < MAX_SONG; sn++ )
{
if ( song_table[sn].name == NULL )
break;
if ( victim->pcdata->songlearned[sn] > 0 && sglevel(ch,sn) <= victim->level )
{
sendf( ch, "%-19s %3d%% ",song_table[sn].name, victim->pcdata->songlearned[sn] );
if ( ++col % 3 == 0 )
send_to_char( "\n\r", ch );
}
}
if ( col % 3 != 0 )
send_to_char( "\n\r", ch );
sendf( ch, "%d rehearse sessions left.\n\r",victim->practice );
}
void do_stat ( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
OBJ_DATA *obj;
ROOM_INDEX_DATA *location;
CHAR_DATA *victim;
char *string = one_argument(argument, arg);
if ( arg[0] == '\0')
{
send_to_char("Syntax:\n\r",ch);
send_to_char(" stat <name>\n\r",ch);
send_to_char(" stat obj <name>\n\r",ch);
send_to_char(" stat mob/char <name>\n\r",ch);
send_to_char(" stat room <number>\n\r"\
" stat skill <name>\n\r"\
" stat song <name>\n\r",ch);
return;
}
if (!str_cmp(arg,"skill"))
{
do_sstat(ch,string);
return;
}
if (!str_cmp(arg,"song"))
{
do_sngstat(ch,string);
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,"cabal")){
do_cstat(ch,string);
return;
}
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;
}
send_to_char("Nothing by that name found anywhere.\n\r",ch);
}
void do_rstat( CHAR_DATA *ch, char *argument )
{
char buf[MSL], arg[MIL];
ROOM_INDEX_DATA *location;
OBJ_DATA *obj;
CHAR_DATA *rch;
int door;
one_argument( argument, arg );
location = ( arg[0] == '\0' ) ? ch->in_room : find_location( ch, arg );
if ( location == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if (ch->in_room != location && room_is_private( location ) && !IS_TRUSTED(ch,IMPLEMENTOR))
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
if ( !have_access(ch,location))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
sendf( ch, "Name: '%s'\n\rArea: '%s'\n\r", location->name, location->area->name );
sendf( ch, "Vnum: %d Sector: %s Light: %d Healing: %d Mana: %d Temperature: %d\n\r",
location->vnum, sector_bit_name(location->sector_type), location->light,
location->heal_rate, location->mana_rate, location->temp );
sendf( ch, "Room flags: %s Room flags2: %s\n\rDay Description:\n\r%s", room_bit_name(location->room_flags),room2_bit_name(location->room_flags2), location->description );
if (location->description2[0])
sendf( ch, "Night Description:\n\r%s", location->description2);
if ( location->extra_descr != NULL )
{
EXTRA_DESCR_DATA *ed;
send_to_char( "Extra description keywords: '", ch );
for ( ed = location->extra_descr; ed; ed = ed->next )
{
send_to_char( ed->keyword, ch );
if ( ed->next != NULL )
send_to_char( " ", ch );
}
send_to_char( "'.\n\r", ch );
}
send_to_char( "Characters:", ch );
for ( rch = location->people; rch; rch = rch->next_in_room )
if (can_see(ch,rch))
{
send_to_char( " ", ch );
one_argument( rch->name, buf );
send_to_char( buf, ch );
}
send_to_char( ".\n\rObjects: ", ch );
for ( obj = location->contents; obj; obj = obj->next_content )
{
send_to_char( " ", ch );
one_argument( obj->name, buf );
send_to_char( buf, ch );
}
send_to_char( ".\n\r", ch );
for ( door = 0; door <= 5; door++ )
{
EXIT_DATA *pexit;
if ( ( pexit = location->exit[door] ) != NULL )
{
sendf( ch,"Door: %d. To: %d. Key: %d. Exit flags: %d.\n\rKeyword: '%s'. Description: %s",
door, (pexit->to_room == NULL ? -1 : pexit->to_room->vnum), pexit->key, pexit->exit_info,
pexit->keyword, pexit->description[0] != '\0' ? pexit->description : "(none).\n\r" );
}
}
}
/* shows cabal info, some parts are shown to Imms only */
void do_cstat( CHAR_DATA* ch, char* argument ){
CABAL_DATA* pCab = NULL;
CABAL_DATA* pPar = NULL;
CMEMBER_DATA* cMem;
char buf[MSL];
int i = 0;
int cnt = 0;
bool fEld = FALSE;
if (IS_NULLSTR( argument )){
send_to_char("Stat what cabal?\n\r", ch);
return;
}
else if ( (pCab = get_cabal( argument )) == NULL
&& (pCab = get_cabal_vnum( atoi(argument))) == NULL){
send_to_char("No such cabal found.\n\r", ch);
return;
}
else
pPar = get_parent( pCab );
/* leader/imm check */
if (IS_IMMORTAL(ch) && (!str_cmp(ch->name, pCab->immortal) || !str_cmp(ch->name, pPar->immortal)))
fEld = TRUE;
else if (IS_ELDER( ch ) && ch->pCabal && get_parent(ch->pCabal) == pPar)
fEld = TRUE;
else if (get_trust(ch) > CREATOR)
fEld = TRUE;
/* start the cabal info */
sendf( ch, "The following is the current status of %s", pCab->who_name );
if (pPar != pCab){
sendf(ch, " and %s.\n\r", pPar->who_name );
}
else
send_to_char(".\n\r", ch);
sendf(ch, "Flags: %s\n\r", flag_string( cabal_flags, pCab->flags ));
sendf(ch, "Flags2: %s\n\r\n\r", flag_string( cabal_flags2, pCab->flags2 ));
if (pPar->city)
sendf(ch, "City: %s\n\r", pPar->city->name );
/* PRESENT */
sendf( ch, "There are currently %d members present in %s", pCab->present, pCab->who_name );
if (pPar != pCab){
sendf( ch, " out of %d in all of %s.\n\r", pPar->present, pPar->who_name );
}
else
send_to_char(".\n\r", ch);
if (pCab->present_stamp && mud_data.current_time - pCab->present_stamp < CABAL_PRESENT_CAPUTREWAIT){
int num = mud_data.current_time - pCab->present_stamp;
char* str;
if ( (num = num / 60) < 60)
str = "minutes";
else if ( (num = num / 60) < 24)
str = "hours";
else{
num = num / 24;
str = "days";
}
sendf(ch, "Last attack with members present %d %s ago.\n\r", num, str);
}
send_to_char("\n\r", ch);
/* ECONOMY INFO */
sendf( ch, "Coffers: %d cps\n\r", GET_CAB_CP( pPar ));
sendf( ch,
"Support: Income: %d (Trade: %d) (Raid: %ld) Armies: -%d Rooms: -%d Corr: -%d Gain: %d\n\r",
pPar->support[ECO_INCOME],
pPar->support[ECO_TRADE],
pPar->bonus_sup,
pPar->support[ECO_LAST_ARMY],
pPar->support[ECO_LAST_RENT],
pPar->support[ECO_LAST_CORR],
pPar->support[ECO_GAIN]
);
sendf( ch,
"Cps: Income: %ld Trade: %ld Gain: %ld\n\r",
pPar->cp_gain[ECO_INCOME] / CPTS,
pPar->cp_gain[ECO_TRADE] / CPTS,
pPar->cp_gain[ECO_GAIN] / CPTS
);
sendf( ch, "TAX: %d%%\n\r\n\r", pPar->cp_tax);
sprintf( buf, "[%s] Members: [%d/%d] Elders: [%d/%d] Leaders [%d/%d]\n\r",
pPar->who_name,
pPar->cur_member, pPar->pIndexData->max_member,
pPar->cur_elder, pPar->max_elder,
pPar->cur_leader, pPar->max_leader);
send_to_char( buf, ch );
if (pCab->parent){
sprintf( buf, "Cabal rank required to join: %d\n\r", pCab->pIndexData->min_rank );
send_to_char( buf, ch );
}
sprintf( buf, "Align: [%s%s%s] Ethos: [%s%s%s]\n\r",
IS_SET(pCab->pIndexData->align, ALIGN_GOOD) ? "G" : " ",
IS_SET(pCab->pIndexData->align, ALIGN_NEUTRAL) ? "N" : " ",
IS_SET(pCab->pIndexData->align, ALIGN_EVIL) ? "E" : " ",
IS_SET(pCab->pIndexData->ethos, ETHOS_LAWFUL) ? "L" : " ",
IS_SET(pCab->pIndexData->ethos, ETHOS_NEUTRAL) ? "N" : " ",
IS_SET(pCab->pIndexData->ethos, ETHOS_CHAOTIC) ? "C" : " ");
send_to_char( buf, ch );
send_to_char("Entrance and member status:\n\r", ch );
sprintf( buf, "Avatar: %s\n\r", pCab->pIndexData->fAvatar ? "Yes" : "No" );
send_to_char( buf, ch );
if (pCab->pIndexData->race[0] < 0){
sprintf(buf, "Races: All");
}
else{
sprintf(buf, "Race: ");
for (i = 0; i < MAX_PC_RACE; i++){
char temp[MIL];
if (pCab->pIndexData->race[i] > 0){
sprintf(temp, "%-5s ", race_table[i].name);
strcat(buf, temp);
}
}
}
send_to_char( buf, ch );
send_to_char("\n\r", ch);
if (pCab->pIndexData->class[0] < 0){
sprintf(buf, "Class: All");
}
else{
sprintf(buf, "Class: ");
for (i = 0; i < MAX_CLASS; i++){
char temp[MIL];
if (pCab->pIndexData->class[i] > 0 ){
sprintf(temp, "%-5s ", class_table[i].who_name);
strcat(buf, temp);
}
}
}
send_to_char( buf, ch );
send_to_char("\n\r", ch);
/* show members that you can see */
for ( cnt = 0, cMem = pPar->members; cMem; cMem = cMem->next ){
if (cMem->level > 50 && !IS_IMMORTAL(ch))
continue;
if ( cnt == 0 ){
send_to_char("\n\rMEMBERS:\n\r", ch);
send_to_char( "Number Name Class Race Lvl Rank Cp Month Days Ago Cabal\n\r", ch );
send_to_char( "------ ------------- ------- ------- ----- ------ ---- ------- ------- -------\n\r", ch );
}
sprintf( buf, "[%4d] %-15.15s %-6s %-8.8s %-6d %-5d %-5ld %-5d %-5ld %-10s\n\r",
cnt,
cMem->name,
class_table[cMem->class].who_name,
race_table[cMem->race].name,
cMem->level,
cMem->rank,
cMem->cp,
cMem->mhours / 3600,
(mud_data.current_time - cMem->last_login) / VOTE_DAY,
cMem->pCabal->who_name);
send_to_char( buf, ch );
cnt++;
}
send_to_char("\n\r", ch );
if (IS_CABAL(pPar, CABAL_TRADE) || IS_CABAL(pPar, CABAL_NAPACT)
|| IS_CABAL(pPar, CABAL_ALLIANCE) || IS_CABAL(pPar, CABAL_VENDETTA)){
send_to_char("PACTS:\n\r", ch );
show_pacts( ch, pPar );
}
}
void do_ostat( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
AFFECT_DATA *paf;
OBJ_DATA *obj;
OBJ_SPELL_DATA *os;
int i;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Stat what?\n\r", ch );
return;
}
if ( ( obj = get_obj_world( ch, argument ) ) == NULL )
{
send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
return;
}
sendf( ch, "Name(s): %s\n\r", obj->name );
sendf( ch, "Vnum: %d (%d) Format: %s Type: %s Material: %s\n\r",
obj->vnum, obj->pIndexData->vnum, obj->pIndexData->new_format ? "new" : "old", item_name(obj->item_type), obj->material);
sendf( ch, "Resets: %d Factor: %d Allowed %d Count: %d Home: %d Recall %d Pit %d\n\r",
obj->pIndexData->reset_num,
IS_LIMITED(obj) ? obj->pIndexData->cost : 0,
get_maxcount( obj->pIndexData ),
obj->pIndexData->count,
obj->homevnum,
obj->recall,
get_temple_pit(obj->recall));
sendf( ch, "Short description: %s\n\rLong description: %s\n\r", obj->short_descr, obj->description );
sendf( ch, "Wear bits: %s\n\rExtra bits: %s\n\r", wear_bit_name(obj->wear_flags), extra_bit_name( obj->extra_flags ) );
if (obj->pCabal)
sendf(ch, "Cabal: %-10s ", obj->pCabal->name);
if (obj->race)
sendf(ch, "Race: %-10s ", race_table[obj->race].name);
if (obj->class >= 0)
sendf(ch, "Class: %-10s ", class_table[obj->class].name);
if (obj->class >=0 || obj->race || obj->pCabal)
send_to_char("\n\r", ch);
sendf( ch, "Number: %d/%d Weight: %d/%d/%d (10th pounds)\n\r",
1, get_obj_number( obj ), obj->weight, get_obj_weight( obj ),get_true_weight(obj) );
sendf( ch, "Level: %d Cost: %d Condition: %d Timer: %d Idle: %d\n\r", obj->level, obj->cost, obj->condition, obj->timer, obj->idle );
sendf( ch, "In room: %d In object: %s Carried by: %s Wear_loc: %d\n\r",
obj->in_room == NULL ? 0 : obj->in_room->vnum, obj->in_obj == NULL ? "(none)" : obj->in_obj->short_descr,
obj->carried_by == NULL ? "(none)" : can_see(ch,obj->carried_by) ? obj->carried_by->name : "someone", obj->wear_loc );
sendf( ch, "Values: %d %d %d %d %d\n\r", obj->value[0], obj->value[1], obj->value[2], obj->value[3], obj->value[4] );
switch ( obj->item_type )
{
case ITEM_SOCKET:
sendf(ch, "Has following socket flags: %s\n\r",
flag_string( socket_flags, obj->value[0] ) );
sendf(ch, "Adds following to extra flags: %s\n\r",
flag_string( extra_flags, obj->value[1] ) );
sendf(ch, "Adds following to weapon flags: %s\n\r",
flag_string( weapon_type2, obj->value[4] ) );
break;
case ITEM_SCROLL:
case ITEM_ARTIFACT:
case ITEM_POTION:
case ITEM_PILL:
sendf( ch, "Level %d spells of:", obj->value[0] );
for ( i = 1; i <= 4; i++ )
if ( obj->value[i] >= 0 && obj->value[i] < MAX_SKILL && skill_table[obj->value[i]].name != NULL)
sendf( ch, " '%s'", skill_table[obj->value[i]].name);
send_to_char( ".\n\r", ch );
break;
case ITEM_WAND:
case ITEM_STAFF:
sendf( ch, "Has %d(%d) charges of level %d", obj->value[1], obj->value[2], obj->value[0] );
if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL && skill_table[obj->value[3]].name != NULL)
sendf( ch, " '%s'", skill_table[obj->value[3]].name);
send_to_char( ".\n\r", ch );
break;
case ITEM_DRINK_CON:
sendf(ch,"It holds %s-colored %s.\n\r", liq_table[obj->value[2]].liq_color, liq_table[obj->value[2]].liq_name);
break;
case ITEM_WEAPON:
send_to_char("Weapon type is ",ch);
switch (obj->value[0])
{
case(WEAPON_EXOTIC): send_to_char("exotic\n\r",ch); break;
case(WEAPON_SWORD): send_to_char("sword\n\r",ch); break;
case(WEAPON_DAGGER): send_to_char("dagger\n\r",ch); break;
case(WEAPON_SPEAR): send_to_char("spear\n\r",ch); break;
case(WEAPON_STAFF): send_to_char("staff\n\r",ch); break;
case(WEAPON_MACE): send_to_char("mace/club\n\r",ch); break;
case(WEAPON_AXE): send_to_char("axe\n\r",ch); break;
case(WEAPON_FLAIL): send_to_char("flail\n\r",ch); break;
case(WEAPON_WHIP): send_to_char("whip\n\r",ch); break;
case(WEAPON_POLEARM):send_to_char("polearm\n\r",ch); break;
default: send_to_char("unknown\n\r",ch); break;
}
if (obj->pIndexData->new_format)
sendf(ch,"Damage is %dd%d (average %d)\n\r", obj->value[1],obj->value[2], (1+obj->value[2])*obj->value[1]/2);
else
sendf(ch,"Damage is %d to %d (average %d)\n\r", obj->value[1], obj->value[2], (obj->value[1]+obj->value[2])/2);
sendf(ch,"Damage noun is %s.\n\r",
(obj->value[3] > 0 && obj->value[3] < MAX_DAMAGE_MESSAGE) ? attack_table[obj->value[3]].noun : "undefined");
if (obj->value[4])
sendf(ch,"Weapons flags: %s\n\r", weapon_bit_name(obj->value[4]));
break;
case ITEM_ARMOR:
sendf( ch, "Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n\r",
obj->value[0], obj->value[1], obj->value[2], obj->value[3] );
break;
case ITEM_CONTAINER:
sendf(ch,"Capacity: %d# Maximum weight: %d# flags: %s\n\r",
obj->value[3],obj->value[0],cont_bit_name(obj->value[1]));
if (obj->value[4] != 100)
sendf(ch,"Weight multiplier: %d%%\n\r", obj->value[4]);
break;
case ITEM_THROW:
sendf( ch, "Has %d %s left.\n\r",obj->value[0],obj->short_descr);
if (obj->pIndexData->new_format)
sendf(ch,"Damage is %dd%d (average %d).\n\r",obj->value[1],obj->value[2], (1+obj->value[2])*obj->value[1]/2);
else
sendf(ch,"Damage is %d to %d (average %d).\n\r",obj->value[1], obj->value[2], (obj->value[1]+obj->value[2])/2);
if (obj->value[4])
sendf(ch,"Weapons flags: %s\n\r", weapon_bit_name(obj->value[4]));
break;
}
/* TRAP info */
if (obj->traps){
TRAP_DATA* pTrap = obj->traps;
while(pTrap){
sendf(ch, "Trap [%d] %s%s%s: %s, type: %s, lvl: %d, dur: %d, %s\n\r",
pTrap->vnum,
pTrap->owner ? "(" : "",
pTrap->owner ? pTrap->owner->name : "",
pTrap->owner ? ")" : "",
pTrap->name, trap_table[pTrap->type].name,
pTrap->level, pTrap->duration,
pTrap->armed ? "ARMED" : "disarmed");
pTrap = pTrap->next_trap;
}
}
if ( obj->extra_descr != NULL || obj->pIndexData->extra_descr != NULL )
{
EXTRA_DESCR_DATA *ed;
send_to_char( "Extra description keywords: '", ch );
for ( ed = obj->extra_descr; ed != NULL; ed = ed->next )
{
send_to_char( ed->keyword, ch );
if ( ed->next != NULL )
send_to_char( " ", ch );
}
for ( ed = obj->pIndexData->extra_descr; ed != NULL; ed = ed->next )
{
send_to_char( ed->keyword, ch );
if ( ed->next != NULL )
send_to_char( " ", ch );
}
send_to_char( "'\n\r", ch );
}
for ( paf = obj->affected; paf != NULL; paf = paf->next )
{
if (IS_GEN(paf->type))
sendf( ch, "Effect: '%s' modifies %s by %d for %d hours with bits "\
"%s or %s, level %d%s%s\n\r",
effect_table[GN_POS(paf->type)].name,
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->duration,
affect_bit_name( paf->bitvector ),
affect2_bit_name( paf->bitvector ),
paf->level,
(paf->has_string && paf->string != NULL? ".\n\r String: " : ""),
(paf->has_string && paf->string != NULL? paf->string: "") );
//Else we do it the regular way.
else{
sendf( ch, "Spell: '%s' modifies %s by %d for %d hours with bits %s"\
" or %s, level %d%s%s\n\r",
skill_table[(int) paf->type].name,
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->duration,
affect_bit_name( paf->bitvector ),
affect2_bit_name( paf->bitvector ),
paf->level,
(paf->has_string && paf->string != NULL? ".\n\r String: " : ""),
(paf->has_string && paf->string != NULL? paf->string: "") );
if (paf->bitvector){
switch(paf->where){
case TO_AFFECTS: sendf(ch,"Adds %s affect.\n\r", affect_bit_name(paf->bitvector)); break;
case TO_WEAPON: sendf(ch,"Adds %s weapon flags.\n\r", weapon_bit_name(paf->bitvector)); break;
case TO_OBJECT: sendf(ch,"Adds %s object flag.\n\r", extra_bit_name(paf->bitvector)); break;
case TO_IMMUNE: sendf(ch,"Adds immunity to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_RESIST: sendf(ch,"Adds resistance to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_VULN: sendf(ch,"Adds vulnerability to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_SKILL: /* handled above */ break;
default: sendf(ch,"Unknown bit %d: %d\n\r", paf->where,paf->bitvector); break;
}
}
}
}
if (!obj->enchanted)
for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next )
{
if ( paf->location != APPLY_NONE && paf->modifier != 0 )
sendf( ch, "Affects %s by %d, level %d.\n\r",
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->level );
if (paf->bitvector)
{
switch(paf->where)
{
case TO_AFFECTS: sendf(ch,"Adds %s affect.\n\r", affect_bit_name(paf->bitvector)); break;
case TO_OBJECT: sendf(ch,"Adds %s object flag.\n\r", extra_bit_name(paf->bitvector)); break;
case TO_IMMUNE: sendf(ch,"Adds immunity to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_RESIST: sendf(ch,"Adds resistance to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_VULN: sendf(ch,"Adds vulnerability to %s.\n\r", imm_bit_name(paf->bitvector)); break;
case TO_SKILL: /* handled above */ break;
default: sendf(ch,"Unknown bit %d: %d\n\r", paf->where,paf->bitvector); break;
}
}
}
//Select betwen Indexed or dynamic.
if (!obj->eldritched)
os = obj->pIndexData->spell;
else
os = obj->spell;
for (; os != NULL; os = os->next )
if (os->target == SPELL_TAR_SELF || os->target == SPELL_TAR_VICT )
sendf(ch, "Cast spells %s at %s\n\r",
skill_table[os->spell].name, os->target == SPELL_TAR_SELF ? "character" : os->target == SPELL_TAR_VICT ? "victim" : "none");
if (obj->pIndexData->message)
{
sendf(ch, "%s\n\r", obj->pIndexData->message->onself);
sendf(ch, "%s\n\r", obj->pIndexData->message->onself);
sendf(ch, "%s\n\r", obj->pIndexData->message->offself);
sendf(ch, "%s\n\r", obj->pIndexData->message->offother);
}
if (CAN_WEAR(obj, ITEM_UNIQUE))
send_to_char("Unique item.\n\r",ch);
if (CAN_WEAR(obj, ITEM_RARE))
send_to_char("Rare item.\n\r",ch);
if (CAN_WEAR(obj, ITEM_PARRY))
send_to_char("Can be dual parried.\n\r",ch);
}
void do_mstat( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
AFFECT_DATA *paf;
CHAR_DATA *victim;
int i;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Stat whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, argument ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
sendf( ch, "Name: %s (T: %d)", victim->name, get_trust( victim) );
if (!IS_NPC(victim))
sendf(ch, " (SaveVer %d)", victim->save_ver);
if (!IS_NPC(victim))
sendf(ch, " Rel: %s.", deity_table[victim->pcdata->way].way);
if(!IS_NPC(victim) && IS_SET(victim->act2, PLR_MASQUERADE))
sendf(ch, " `5[`%%MASQUE`5]``\n\r");
else
send_to_char("\n\r",ch);
if (!IS_NPC(victim) && victim->pcdata->alias && victim->pcdata->alias[0] != '\0')
sendf( ch, "Alias: The last thing you see is %s.\n\r", victim->pcdata->alias);
sendf( ch, "Vnum: %d Format: %s Race: %s %s%s%sGroup: %d Sex/P: %s/%s Room: %d\n\r",
IS_NPC(victim) ? victim->pIndexData->vnum : 0,
IS_NPC(victim) ? victim->pIndexData->new_format ?"new":"old":"pc",
IS_QRACE(victim) ? victim->pcdata->race : race_table[victim->race].name,
IS_QRACE(victim) ? "(" : "",
IS_QRACE(victim) ? race_table[victim->race].name: "",
IS_QRACE(victim) ? ") " : "",
IS_NPC(victim) ? victim->group : 0,
victim->sex == 0 ? "sexless" : victim->sex == 1 ? "male" : "female",
!IS_NPC(victim) ? (victim->pcdata->true_sex == 0 ? "sexless" : victim->pcdata->true_sex == 1 ? "male" : "female") : "mob",
victim->in_room == NULL ? 0 : victim->in_room->vnum);
if (!IS_NPC(victim)){
sendf(ch, "Hometown: %s, Ethos: %s, Tattoo: %s\n\r",
hometown_table[victim->hometown].name,
ethos_table[victim->pcdata->ethos].name,
deity_table[victim->tattoo].god);
}
else{
sendf(ch, "Count: %d Killed: %d Home: %d Cabal: %s\n\r",
victim->pIndexData->count,
victim->pIndexData->killed,
victim->homevnum,
victim->pCabal ? victim->pCabal->name : "None");
}
sendf( ch, "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n\r",
victim->perm_stat[STAT_STR], get_curr_stat(victim,STAT_STR),
victim->perm_stat[STAT_INT], get_curr_stat(victim,STAT_INT),
victim->perm_stat[STAT_WIS], get_curr_stat(victim,STAT_WIS),
victim->perm_stat[STAT_DEX], get_curr_stat(victim,STAT_DEX),
victim->perm_stat[STAT_CON], get_curr_stat(victim,STAT_CON) );
/* PC ONLY SPECIALS */
if (!IS_NPC(victim))
{
sendf( ch, "Luck: %d(%d)", victim->perm_stat[STAT_LUCK], get_curr_stat(victim,STAT_LUCK));
/* Beast Type */
if (!IS_NPC(victim) && victim->race == grn_werebeast){
sendf(ch," Beast Type: %d",victim->pcdata->beast_type);
}
/* Divine Favor */
if (victim->pcdata->divfavor != 0)
sendf(ch," Divine Favor: %d", victim->pcdata->divfavor);
send_to_char("\n\r",ch);
}
sendf( ch, "Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d Trains %d\n\r",
victim->hit, victim->max_hit, victim->mana, victim->max_mana, victim->move, victim->max_move,
IS_NPC(ch) ? 0 : victim->practice, IS_NPC(ch) ? 0 : victim->train );
sendf( ch, "Lv: %d Class: %s Align: %d Gold: %ld CabalPts: %d\n\r",
victim->level, IS_NPC(victim) ? "mobile" : class_table[victim->class].name, victim->alignment, victim->gold,
GET_CP(victim));
if (!IS_NPC(victim) && victim->pcdata->member && IS_CABAL(get_parent(victim->pCabal), CABAL_AREA)){
sendf(ch, "Armies: %d.%d\n\r", GARR_NOR( victim ), GARR_UPG( victim ));
}
if (!IS_NPC(victim))
sendf( ch, "Exp: %ld Exp to level: %ld Max Exp: %ld Pk Range: %ld to %ld \n\r",
victim->exp, total_exp(victim) - victim->exp, victim->max_exp, 7 * victim->max_exp /10, 13 * victim->max_exp / 10);
sendf(ch,"Armor: pierce: %d bash: %d slash: %d magic: %d\n\r",
GET_AC(victim,AC_PIERCE), GET_AC(victim,AC_BASH), GET_AC(victim,AC_SLASH), GET_AC(victim,AC_EXOTIC));
sendf(ch, "Hit: %d Dam: %d Size: %s Position: %s Wimpy: %d\n\r",
GET_HITROLL(victim), GET_DAMROLL(victim), size_table[victim->size].name,
position_table[victim->position].name, victim->wimpy );
if (!IS_NPC(victim)){
sendf(ch, "Weapon Position: %s.\n\r",
victim->pcdata->wep_pos == WEPPOS_HIGH ? "high" :
victim->pcdata->wep_pos == WEPPOS_LOW ? "low" :
victim->pcdata->wep_pos == WEPPOS_NORMAL? "normal" : "unkown");
}
sendf(ch, "Affl: %d Maled: %d Mental: %d Breath: %d Spell: %d\n\r",
victim->savingaffl, victim->savingmaled, victim->savingmental, victim->savingbreath, victim->savingspell);
sendf(ch, "Level Modifier: Affl %d Maled %d Mental %d Spell %d.\n\r",
victim->aff_mod[MOD_AFFL_LEVEL],
victim->aff_mod[MOD_MALED_LEVEL],
victim->aff_mod[MOD_MENTAL_LEVEL],
victim->aff_mod[MOD_SPELL_LEVEL]);
sendf(ch, "Waitstate: %d(%%) Spel/Skill Rate: %d/%d(%%) Spell Cost: %d(%%) Hit/Mana/Move Rate: %d/%d/%d(%%).\n\r",
(100 + victim->aff_mod[MOD_WAIT_STATE]),
(100 + victim->aff_mod[MOD_SPELL_LEARN]),
(100 + victim->aff_mod[MOD_SKILL_LEARN]),
(100 + victim->aff_mod[MOD_SPELL_COST]),
(100 + victim->aff_mod[MOD_HIT_GAIN]),
(100 + victim->aff_mod[MOD_MANA_GAIN]),
(100 + victim->aff_mod[MOD_MOVE_GAIN]));
if (IS_NPC(victim) && victim->pIndexData->new_format)
sendf(ch, "Damage: %dd%d ",victim->damage[DICE_NUMBER],victim->damage[DICE_TYPE]);
sendf(ch, "Message: %s\n\r",attack_table[victim->dam_type].noun);
sendf( ch, "Fighting: %s\n\r",victim->fighting ? victim->fighting->name : "(none)" );
if ( !IS_NPC(victim) )
{
sendf( ch, "Thirst: %d Hunger: %d Drunk: %d\n\r",
victim->pcdata->condition[COND_THIRST], victim->pcdata->condition[COND_HUNGER], victim->pcdata->condition[COND_DRUNK] );
sendf( ch, "Carry number: %d Carry weight: %d Guarding: %s Guarded by: %s\n\r",
victim->carry_number, get_carry_weight(victim) / 10, victim->pcdata->guarding ? victim->pcdata->guarding->name : "(none)",
victim->pcdata->guarded_by ? victim->pcdata->guarded_by->name : "(none)" );
sendf( ch, "Age: %d Played: %d Last Level: %d Timer: %d\n\r",
get_age(victim), (int) (victim->played + mud_data.current_time - victim->logon) / 3600,
victim->pcdata->last_level, victim->timer );
}
sendf(ch, "Act: %s\n\r",act_bit_name(victim->act,TRUE,IS_NPC(victim) ? TRUE : FALSE));
sendf(ch, "Act2: %s\n\r",act_bit_name(victim->act2,FALSE,IS_NPC(victim) ? TRUE : FALSE));
if (victim->game)
sendf(ch,"Game: %s\n\r",game_bit_name(victim->game));
if (!IS_NPC(victim) && victim->pcdata->perk_bits)
sendf(ch,"Perks: %s\n\r", perk_bit_name( victim->pcdata->perk_bits ));
if (victim->comm)
sendf(ch,"Comm: %s\n\r",comm_bit_name(victim->comm));
if (IS_COLOR(victim, COLOR_ON))
sendf(ch,"Color: %s\n\r",color_bit_name(victim->color));
else
sendf(ch,"Color: OFF (%s)\n\r", color_bit_name(victim->color));
if (IS_NPC(victim) && victim->special)
sendf(ch, "Special: %s\n\r",special_bit_name(victim->special));
if (IS_NPC(victim) && victim->off_flags)
sendf(ch, "Offense: %s\n\r",off_bit_name(victim->off_flags));
if (victim->imm_flags)
sendf(ch, "Immune: %s\n\r",imm_bit_name(victim->imm_flags));
if (victim->res_flags)
sendf(ch, "Resist: %s\n\r", imm_bit_name(victim->res_flags));
if (victim->vuln_flags)
sendf(ch, "Vulnerable: %s\n\r", imm_bit_name(victim->vuln_flags));
if (victim->affected_by)
sendf(ch, "Affected by %s\n\r", affect_bit_name(victim->affected_by));
if (victim->affected2_by)
sendf(ch, "Also affected by %s\n\r", affect2_bit_name(victim->affected2_by));
if (victim->form)
sendf(ch, "Form: %s\n\r", form_bit_name(victim->form));
if (victim->parts)
sendf(ch, "Parts: %s\n\r", part_bit_name(victim->parts));
sendf( ch, "Master: %s Leader: %s Pet: %s Summoner: %s Path: %d\n\r",
victim->master ? victim->master->name : "(none)", victim->leader ? victim->leader->name : "(none)",
victim->pet ? victim->pet->name : "(none)",
victim->summoner ? victim->summoner->name : "none",
victim->spec_path ? get_path_vnum(victim) : 0);
if (!IS_NPC(victim))
{
int total = victim->pcdata->mplayed;
if (victim->logon != 0)
total += ((int) ((mud_data.current_time - victim->logon)/60));
sendf( ch, "Month: %d -- %d Hours and %d Mins -- Total: %d\n\r",victim->pcdata->month, total/60, total % 60, total );
sendf( ch, "Security: %d.\n\r", victim->pcdata->security );
sendf( ch, "Times flagged: %d.\n\r", victim->pcdata->flagged );
sendf( ch, "Player Rank: %d.\n\r", victim->pcdata->rank );
sendf( ch, "Player Kills: %d, Player Deaths: %d, Mob Kills: %d, Mob Deaths: %d, Total Deaths: %d\n\r",
victim->pcdata->kpc, victim->pcdata->dpc, victim->pcdata->knpc, victim->pcdata->dnpc, victim->pcdata->dall);
}
if (IS_NPC(victim) || IS_IMMORTAL(victim))
sendf( ch, "Short description: %s\n\rLong description: %s",
victim->short_descr, victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r" );
if ( IS_NPC(victim) && victim->spec_fun != 0 )
sendf(ch,"Mobile has special procedure %s.\n\r", spec_name(victim->spec_fun));
if ( IS_NPC(victim) && victim->pIndexData->progtypes )
{
TRIGFILE_DATA *ptrigfile;
for ( ptrigfile = victim->pIndexData->trigfile; ptrigfile; ptrigfile = ptrigfile->next )
sendf(ch,"Mobile program %s at %d.\n\r",ptrigfile->name,ptrigfile->dowhen);
}
if ( IS_NPC(victim) && victim->hunting != NULL )
sendf(ch, "Hunting victim [%d]: %s (%s)\n\r",
5 - victim->level/10 - victim->hunttime,
IS_NPC(victim->hunting) ? victim->hunting->short_descr : victim->hunting->name,
IS_NPC(victim->hunting) ? "MOB" : "PLAYER" );
if ( !IS_NPC(victim) && is_ghost(victim,300) )
send_to_char("Is a ghost right now.\n\r",ch);
if (victim->class == class_lookup("monk"))
{
OBJ_DATA *obj;
send_to_char("Anatomy:", ch);
for (i = 0; anatomy_table[i].name != NULL; i++)
sendf(ch, " %s: %d", anatomy_table[i].name, victim->pcdata->anatomy[i]);
send_to_char("\n\r", ch);
send_to_char("Encumberance:", ch);
for (i = 0; i < 8; i++)
if ((obj = get_eq_char(victim, monk_table[i].value)) != NULL && obj->weight > monk_table[i].weight * 10)
sendf(ch, " %s", monk_table[i].wear);
send_to_char("\n\r", ch);
}
if (is_affected(victim, gen_study))
sendf(ch, "%s", study_info(victim, TRUE, ch));
/* TRAP info */
for (i = 0; i < MAX_TRAPS; i++){
TRAP_DATA* pTrap = victim->traps[i];
if (pTrap == NULL)
continue;
if (pTrap->on_obj)
sendf(ch, "Trap O: %s [%d] ", pTrap->on_obj->short_descr,
pTrap->on_obj->vnum);
else if (pTrap->on_exit)
sendf(ch, "Trap E: %s [%d] ",
pTrap->on_exit->to_room ? pTrap->on_exit->to_room->name : "error",
pTrap->on_exit->to_room ? pTrap->on_exit->to_room->vnum : 0);
else
sendf(ch, "Trap ");
sendf(ch, "Vn:[%d] %s%s%s, type: %s, lvl: %d, dur: %d, %s\n\r",
pTrap->vnum,
pTrap->owner ? "(" : "",
pTrap->owner ? pTrap->owner->name : "",
pTrap->owner ? ")" : "",
trap_table[pTrap->type].name,
pTrap->level, pTrap->duration,
pTrap->armed ? "ARMED" : "disarmed");
pTrap = pTrap->next_trap;
}
if (!IS_NPC(victim) && victim->pcdata->fight_delay != (time_t)NULL && victim->pcdata->fight_delay >= 0)
if (difftime(mud_data.current_time,victim->pcdata->fight_delay) < 120)
sendf(ch, "Lagged %d second fight time so far.\n\r",(int)difftime(mud_data.current_time,victim->pcdata->fight_delay));
if (!IS_NPC(victim) && victim->pcdata->pk_delay != (time_t)NULL && victim->pcdata->pk_delay >= 0)
if (difftime(mud_data.current_time,victim->pcdata->pk_delay) < 360)
sendf(ch, "Lagged %d second pk time so far.\n\r",(int)difftime(mud_data.current_time,victim->pcdata->pk_delay));
if ( !IS_NPC(victim) )
sendf(ch, "EXP COST: %d\n\r", pc_race_table[victim->race].class_mult - 1500 + class_table[victim->class].extra_exp);
//Show SPELLS ON character
for ( paf = victim->affected; paf != NULL; paf = paf->next )
{
//We show spells and effects diferently.
if (IS_GEN(paf->type))
sendf( ch, "Effect: '%s' modifies %s by %d for %d hours with bits"\
"%s or %s, level %d%s%s\n\r",
effect_table[GN_POS(paf->type)].name,
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->duration,
affect_bit_name( paf->bitvector ),
affect2_bit_name( paf->bitvector ),
paf->level,
(paf->has_string && paf->string != NULL? ".\n\r String: " : ""),
(paf->has_string && paf->string != NULL? paf->string: "") );
//Else we do it the regular way.
else
sendf( ch, "Spell: '%s' modifies %s by %d for %d hours with bits %s"\
" or %s, level %d%s%s\n\r",
skill_table[(int) paf->type].name,
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->duration,
affect_bit_name( paf->bitvector ),
affect2_bit_name( paf->bitvector ),
paf->level,
(paf->has_string && paf->string != NULL? ".\n\r String: " : ""),
(paf->has_string && paf->string != NULL? paf->string: "") );
}//end for
for ( paf = victim->affected2; paf != NULL; paf = paf->next )
sendf( ch, "Song: '%s' modifies %s by %d for %d hours with bits %s or %s, level %d.\n\r",
song_table[(int) paf->type].name,
(paf->where == TO_SKILL ? skill_table[paf->location].name : affect_loc_name( paf->location )),
paf->modifier,
paf->duration,
affect_bit_name( paf->bitvector ),
affect2_bit_name( paf->bitvector ), paf->level );
}//end mstat
void do_tfind( CHAR_DATA *ch, char *argument ){
char buf[MSL];
BUFFER *buffer;
TRAP_INDEX_DATA *pTrap;
bool fAll = FALSE, found = FALSE;
/* arg check */
if ( IS_NULLSTR(argument)){
send_to_char( "Find what trap?\n\r", ch );
return;
}
if (!str_cmp("all", argument)){
fAll = TRUE;
}
/* start the search */
buffer=new_buf();
for ( pTrap = trap_index_list; pTrap; pTrap = pTrap->next ){
if ( fAll || is_name( argument, pTrap->name ) ){
found = TRUE;
sprintf( buf, "[%5d] %s\n\r", pTrap->vnum, pTrap->name );
add_buf( buffer, buf );
}
}
if ( !found )
send_to_char( "No traps by that name.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_hfind( CHAR_DATA *ch, char *argument ){
char buf[MSL];
BUFFER *buffer;
HELP_DATA *pHelp;
bool found = FALSE;
/* arg check */
if ( IS_NULLSTR(argument)){
send_to_char( "Find what help?\n\r", ch );
return;
}
/* start the search */
buffer=new_buf();
for ( pHelp = help_first; pHelp; pHelp = pHelp->next ){
if ( is_name( argument, pHelp->keyword ) ){
found = TRUE;
sprintf( buf, "[%5d] %s\n\r", pHelp->vnum, pHelp->keyword );
add_buf( buffer, buf );
}
}
if ( !found )
send_to_char( "No helps with that keyword.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_cfind( CHAR_DATA *ch, char *argument ){
char buf[MSL];
BUFFER *buffer;
CABAL_INDEX_DATA *pCab;
bool found = FALSE;
bool fAll = FALSE;
/* arg check */
if ( IS_NULLSTR(argument)){
send_to_char( "Find what cabal?\n\r", ch );
return;
}
if (!str_cmp( "all", argument)){
fAll = TRUE;
}
/* start the search */
buffer=new_buf();
for ( pCab = cabal_index_list; pCab; pCab = pCab->next ){
if ( fAll || is_name( argument, pCab->name ) ){
found = TRUE;
sprintf( buf, "[%5d] %s\n\r", pCab->vnum, pCab->name );
add_buf( buffer, buf );
}
}
if ( !found )
send_to_char( "No cabals with that name.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_vnum(CHAR_DATA *ch, char *argument)
{
char arg[MIL];
char *string;
string = one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("Syntax:\n\r",ch);
send_to_char(" vnum obj [material] <name>\n\r",ch);
send_to_char(" vnum weapon <type>\n\r",ch);
send_to_char(" vnum mob <name>\n\r",ch);
send_to_char(" vnum trap <name>\n\r",ch);
send_to_char(" vnum help <keyword>\n\r",ch);
send_to_char(" vnum skill <skill or spell>\n\r",ch);
send_to_char(" vnum unique\n\r",ch);
send_to_char(" vnum rare\n\r",ch);
send_to_char(" vnum weight\n\r",ch);
send_to_char(" vnum extra <extra flag>\n\r",ch);
send_to_char(" vnum affect <affect number>\n\r",ch);
send_to_char(" vnum special\n\r",ch);
send_to_char(" vnum shop\n\r",ch);
send_to_char(" vnum wear <wear number>\n\r",ch);
send_to_char(" vnum gold\n\r",ch);
send_to_char(" vnum immune\n\r",ch);
return;
}
if (!str_cmp(arg,"obj"))
{ do_ofind(ch,string); return; }
if (!str_cmp(arg,"weapon"))
{ do_wepfind(ch,string); return; }
if (!str_cmp(arg,"trap"))
{ do_tfind(ch,string); return; }
if (!str_cmp(arg,"help"))
{ do_hfind(ch,string); return; }
if (!str_cmp(arg,"cabal"))
{ do_cfind(ch,string); return; }
if (!str_cmp(arg,"mob") || !str_cmp(arg,"char"))
{ do_mfind(ch,string); return; }
if (!str_cmp(arg,"skill") || !str_cmp(arg,"spell") || !str_cmp(arg,"effect") )
{ do_slookup(ch,string); return; }
if (!str_cmp(arg,"unique"))
{ do_lfind(ch,argument); return; }
if (!str_cmp(arg,"rare"))
{ do_rfind(ch,argument); return; }
if (!str_cmp(arg,"weight"))
{ do_wfind(ch,argument);return; }
if (!str_cmp(arg,"extra"))
{ do_efind(ch,string); return; }
if (!str_cmp(arg,"affect"))
{ do_sfind(ch,string); return; }
if (!str_cmp(arg,"special"))
{ do_ssfind(ch,string); return; }
if (!str_cmp(arg,"shop"))
{ do_skfind(ch,string); return; }
if (!str_cmp(arg,"wear"))
{ do_wefind(ch,string); return; }
if (!str_cmp(arg,"gold"))
{ do_gofind(ch,string); return; }
if (!str_cmp(arg,"immune"))
{ do_imfind(ch,string); return; }
do_mfind(ch,argument);
do_ofind(ch,argument);
}
void do_mfind( CHAR_DATA *ch, char *argument )
{
extern int top_mob_index;
char buf[MSL];
BUFFER *buffer;
char arg[MIL];
MOB_INDEX_DATA *pMobIndex;
int vnum, nMatch = 0;
bool fAll = FALSE, found = FALSE;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Find whom?\n\r", ch );
return;
}
buffer=new_buf();
for ( vnum = 0; nMatch < top_mob_index; vnum++ )
if ( ( pMobIndex = get_mob_index( vnum ) ) != NULL )
{
nMatch++;
if ( fAll || is_name( argument, pMobIndex->player_name ) )
{
found = TRUE;
sprintf( buf, "[%5d] %s\n\r", pMobIndex->vnum, pMobIndex->short_descr );
add_buf( buffer, buf );
}
}
if ( !found )
send_to_char( "No mobiles by that name.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_ofind( CHAR_DATA *ch, char *argument )
{
extern int top_obj_index;
char buf[MSL], buf2[MSL], arg[MIL];
BUFFER *buffer;
OBJ_INDEX_DATA *pObjIndex;
int vnum, nMatch = 0;
bool found = FALSE;
bool fMat = FALSE;
bool fOprog = FALSE;
bool fType = FALSE;
if ( IS_NULLSTR(argument))
{
send_to_char( "ofind [material/oprog/type] <name>?\n\r", ch );
return;
}
argument = one_argument( argument, arg );
if (!str_cmp(arg, "material")){
fMat = TRUE;
}
else if (!str_cmp(arg, "type")){
fType = TRUE;
if (flag_value( type_flags, argument ) == NO_FLAG) {
send_to_char("No such item type found.\n\r", ch);
return;
}
}
else if (!str_cmp(arg, "oprog")){
fOprog = TRUE;
if (!is_number(argument)){
send_to_char("This option requires a numerical argument.\n\r", ch);
return;
}
}
buffer=new_buf();
for ( vnum = 0; nMatch < top_obj_index; vnum++ ){
if ( ( pObjIndex = get_obj_index( vnum ) ) != NULL ){
nMatch++;
if ( fMat ){
if (str_cmp(pObjIndex->material, argument))
continue;
}
else if ( fOprog ){
if (pObjIndex->oprogs == NULL
|| pObjIndex->oprogs->vnum != atoi(argument))
continue;
}
else if ( fType ){
if (pObjIndex->item_type != flag_value( type_flags, argument ) )
continue;
}
else if (!is_name( arg, pObjIndex->name ) )
continue;
found = TRUE;
if (CAN_WEAR(pObjIndex, ITEM_UNIQUE))
sprintf(buf2, "u");
else if (CAN_WEAR(pObjIndex, ITEM_RARE))
sprintf(buf2, "r");
else
sprintf(buf2, " ");
sprintf( buf, "[%5d] [%1s] %s\n\r", pObjIndex->vnum, buf2, pObjIndex->short_descr );
add_buf( buffer, buf );
}
}
if ( !found )
send_to_char( "No objects by that name.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_wepfind( CHAR_DATA *ch, char *argument ){
extern int top_obj_index;
OBJ_INDEX_DATA *pObjIndex;
char buf[MSL], buf2[MSL], arg[MIL], arg2[MIL], arg3[MIL];
BUFFER *buffer;
int vnum, nMatch = 0, type = 0, wear = 0, extra = 0, spec = 0;
bool found = FALSE;
argument = one_argument(argument, arg);
argument = one_argument(argument, arg2);
argument = one_argument(argument, arg3);
if ( IS_NULLSTR(arg)){
send_to_char( "wfind <type> [wearflags] [extraflags]\n\r", ch );
return;
}
else if (!str_prefix(arg, "exotic"))
type = WEAPON_EXOTIC;
else if ( (type = weapon_table[weapon_lookup(arg)].type) < 0){
send_to_char("No such weapon type.\n\r", ch);
return;
}
if ( (wear = flag_lookup2(arg2, wear_flags)) == NO_FLAG)
wear = 0;
if ( (extra = flag_lookup2(arg3, extra_flags)) == NO_FLAG)
extra = 0;
if ( (spec = flag_lookup2(argument, weapon_type2)) == NO_FLAG)
spec = 0;
buffer=new_buf();
for ( vnum = 0; nMatch < top_obj_index; vnum++ ){
if ( ( pObjIndex = get_obj_index( vnum ) ) == NULL)
continue;
nMatch++;
if (pObjIndex->value[0] != type
|| pObjIndex->item_type != ITEM_WEAPON)
continue;
if (wear && !CAN_WEAR(pObjIndex, wear))
continue;
if (extra && !IS_SET(pObjIndex->extra_flags, extra))
continue;
if (spec && !IS_SET(pObjIndex->value[4], spec))
continue;
found = TRUE;
if (CAN_WEAR(pObjIndex, ITEM_UNIQUE))
sprintf(buf2, "u");
else if (CAN_WEAR(pObjIndex, ITEM_RARE))
sprintf(buf2, "r");
else
sprintf(buf2, " ");
sprintf( buf, "[%5d] [%1s] %s\n\r", pObjIndex->vnum, buf2, pObjIndex->short_descr );
add_buf( buffer, buf );
}
if ( !found )
send_to_char( "No weapons of that type.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_owhere(CHAR_DATA *ch, char *argument )
{
char buf[MSL];
BUFFER *buffer;
OBJ_DATA *obj, *in_obj;
bool found = FALSE;
int number = 0, max_found = 200;
buffer = new_buf();
if (argument[0] == '\0')
{
send_to_char("Find what?\n\r",ch);
return;
}
for ( obj = object_list; obj != NULL; obj = obj->next )
{
/* skip stained stuff on imms */
if (!str_cmp(argument, "stained")
&& obj->carried_by
&& IS_IMMORTAL(obj->carried_by))
continue;
if ( can_see_obj( ch, obj )
&& obj->level <= 60
&& (is_name( argument, obj->name )
|| (is_number(argument) && atoi(argument) == obj->pIndexData->vnum)
|| (!str_cmp(argument, "stained")
&& IS_SET(obj->extra_flags, ITEM_STAIN))))
{
found = TRUE;
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)
sprintf( buf, "%3d) %s is carried by %s [Room %d]\n\r",
number, obj->short_descr, PERS2(in_obj->carried_by), in_obj->carried_by->in_room->vnum );
else if (in_obj->in_room != NULL && can_see_room(ch,in_obj->in_room))
sprintf( buf, "%3d) %s is in %s [Room %d]\n\r",
number, obj->short_descr, in_obj->in_room->name,in_obj->in_room->vnum);
else
sprintf( buf, "%3d) %s is somewhere\n\r",number, obj->short_descr);
}
buf[0] = UPPER(buf[0]);
add_buf(buffer,buf);
if (number >= max_found)
break;
}
}
if ( !found )
send_to_char( "Nothing like that in heaven or earth.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_twhere(CHAR_DATA *ch, char *argument )
{
char buf[MSL];
BUFFER *buffer;
TRAP_DATA *pTrap;
bool found = FALSE;
bool fAll = FALSE;
int number = 0, max_found = 200;
buffer = new_buf();
if (argument[0] == '\0'){
send_to_char("Find what trap or \"all\"?\n\r",ch);
return;
}
if (!str_cmp("all", argument))
fAll = TRUE;
for ( pTrap = trap_list; pTrap != NULL; pTrap = pTrap->next ){
if (!fAll && !is_name( argument, pTrap->name )
&& (!is_number(argument) || atoi(argument) != pTrap->vnum))
continue;
found = TRUE;
number++;
if (pTrap->on_obj){
OBJ_DATA* obj = pTrap->on_obj;
CHAR_DATA* carried = in_char( obj );
OBJ_DATA* stored = in_obj( obj );
sprintf( buf, "%3d) %s is on object %s [Room %d]\n\r",
number,
pTrap->name,
obj->short_descr,
carried ? carried->in_room->vnum : stored->in_room->vnum);
}
else if (pTrap->on_exit){
EXIT_DATA* pExit = pTrap->on_exit;
sprintf( buf, "%3d) %s is on exit to %s [to Room %d]\n\r",
number,
pTrap->name,
pExit->to_room ? pExit->to_room->name : "somewhere",
pExit->to_room ? pExit->to_room->vnum : 0);
}
else
sprintf( buf, "%3d) %s is nowhere.\n\r", number, pTrap->name);
buf[0] = UPPER(buf[0]);
add_buf(buffer,buf);
if (number >= max_found)
break;
}
if ( !found )
send_to_char( "Nothing like that in heaven or earth.\n\r", ch );
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
/* Viri:
Searches for rooms with given flag in "room" or "room2" amogst given
range of vnums
*/
void do_rwhere( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
char arg1[MIL];
char arg2[MIL];
char arg3[MIL];
const struct flag_type *flag_table = room_flags;
ROOM_INDEX_DATA* room;
BUFFER *buffer;
int min = 0;
int max = 0;
int flag = 0;
int tot_flag = 0;
int i = 0;
int count = 0;
int value = 0;
bool fFlag = FALSE;
bool fHeal = FALSE;
bool fMana = FALSE;
bool fLessThen = FALSE;
if ( argument[0] == '\0' ){
send_to_char("rwhere [room/room2/heal/mana] <flag1 flag2 flag3..flagN> <min_vnum max_vnum>\n\r"\
"searches rooms between min_vnum and max_vnum for given flags.\n\r"\
"Displays a match. If min_vnum is ommited, searches ALL rooms in the mud.\n\r", ch);
return;
}
/* get the type of flags we will be looking for */
argument = one_argument(argument, arg1);
if (!str_cmp(arg1, "room")){
fFlag = TRUE;
flag_table = room_flags;
}
else if (!str_cmp(arg1, "room2")){
fFlag = TRUE;
flag_table = room_flags2;
}
else if (!str_cmp(arg1, "heal"))
fHeal = TRUE;
else if (!str_cmp(arg1, "mana"))
fMana = TRUE;
else{
do_rwhere(ch,"");
return;
}
/* get the actual flags we are matching */
argument = one_argument(argument, arg2);
if (arg2[0] == '\0'){
do_rwhere(ch, "");
return;
}
if (fFlag){
while ( arg2[0] != '\0' && (flag = atoi(arg2)) == 0){
if ( (flag = flag_value( flag_table, arg2)) == NO_FLAG){
sendf(ch, "\"%s\" No such flag found in %s.\n\r", arg2, arg1);
show_flag_cmds( ch, flag_table);
tot_flag = 0;
break;
}
tot_flag |= flag;
argument = one_argument(argument, arg2);
}
}
else if ( (value = atoi (arg2)) < 0){
value *= -1;
fLessThen = TRUE;
}
/* Get the vnum bounds for search now */
argument = one_argument(argument, arg3);
min = atoi(arg2);
max = atoi(arg3);
/* small logic check */
if (min > max){
int temp = max;
max = min;
min = temp;
}
/* In case of failure to find flags */
if (fFlag && tot_flag < 1){
send_to_char("Incorrect flag passed.\n\r", ch);
return;
}
if (min)
sendf(ch, "Running search on given flags from %d through to %d.\n\r", min, max);
else
send_to_char("Running search on given flags on all rooms!\n\r", ch);
/* start running through allrooms matching correct flag */
buf[0] = '\0'; /* Lazyman's flag for found match */
buffer = new_buf();
for (i = 0; i < MAX_KEY_HASH; i++){
for (room = room_index_hash[i]; room != NULL; room = room->next){
/* if min/max specified we match them now */
if (min && (room->vnum < min || room->vnum > max))
continue;
/* match flags */
if (fFlag && flag_table == room_flags && tot_flag == (room->room_flags & tot_flag)){
sprintf(buf, "%3d) [%5d] %-38s [%5d] %s\n\r",
++count, room->vnum, room->name,
room->area->vnum, room->area->name);
add_buf(buffer,buf);
}
else if (fFlag && flag_table == room_flags2 && tot_flag == (room->room_flags2 & tot_flag)){
sprintf(buf, "%3d) [%5d] %-38s [%5d] %s\n\r",
++count, room->vnum, room->name,
room->area->vnum, room->area->name);
add_buf(buffer,buf);
}
else if (fMana && ( (fLessThen && room->mana_rate < value)
|| (!fLessThen && room->mana_rate >= value))){
sprintf(buf, "%3d) [%5d] %-38s [%5d] %s\n\r",
++count, room->vnum, room->name,
room->area->vnum, room->area->name);
add_buf(buffer,buf);
}
else if (fHeal && ( (fLessThen && room->heal_rate < value)
|| (!fLessThen && room->heal_rate >= value))){
sprintf(buf, "%3d) [%5d] %-38s [%5d] %s\n\r",
++count, room->vnum, room->name,
room->area->vnum, room->area->name);
add_buf(buffer,buf);
}
}//END for (room =
}//END for (i = 0
if ( buf[0] == '\0' )
send_to_char("No Match.\n\r", ch);
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_mwhere( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
BUFFER *buffer;
CHAR_DATA *victim;
bool found = FALSE;
int count = 0;
if ( argument[0] == '\0' )
return;
buffer = new_buf();
for ( victim = char_list; victim != NULL; victim = victim->next )
{
if ( victim->in_room == NULL )
continue;
if ((is_name( argument, victim->name ) && can_see(ch,victim))
|| (IS_NPC(victim) && is_number(argument) && atoi(argument) == victim->pIndexData->vnum))
{
found = TRUE;
count++;
sprintf( buf, "%3d) [%5d] %-28s [%5d] %s\n\r",
count, IS_NPC(victim) ? victim->pIndexData->vnum : 0, IS_NPC(victim) ? victim->short_descr : victim->name,
victim->in_room->vnum, victim->in_room->name );
add_buf(buffer,buf);
}
}
if ( !found )
sendf(ch, "You didn't find any %s.\n\r",argument);
else
page_to_char(buf_string(buffer),ch);
free_buf(buffer);
}
void do_reboo( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to REBOOT, spell it out.\n\r", ch );
}
void do_reboot( CHAR_DATA *ch, char *argument )
{
char buf[MSL], arg[MIL];
extern bool merc_down;
CHAR_DATA *player, *player_next;
int num_ticks;
bool found = FALSE;
AREA_DATA *pArea;
argument = one_argument(argument,arg);
if (argument[0] && reboot_buffer[0] == '\0')
strcpy(reboot_buffer, argument);
num_ticks = is_number (arg) ? atoi (arg) : -1979;
if ( num_ticks == -1979)
{
send_to_char ("Value must be numeric.\n\r", ch);
return;
}
else if (num_ticks == 9999)
{
sprintf( buf, "Reboot by %s.", ch->name );
do_immecho( ch, buf );
merc_down = TRUE;
for ( player = player_list; player != NULL; player = player_next )
{
player_next = player->next_player;
save_char_obj(player);
if (player->desc)
close_socket(player->desc);
}
return;
}
else if (num_ticks == 9000)
{
sprintf( buf, "[`&The Voice of God`7]`8 - Shared strings near max allowed. Rebooting soon.``" );
do_immecho(NULL,buf);
do_reboot(NULL,"5");
return;
}
else if (num_ticks == 9001)
{
sprintf( buf, "[`&The Voice of God`7]`8 - Perm blocks near max allowed. Shifting world soon.``" );
do_immecho(NULL,buf);
do_reboot(NULL,"5");
return;
}
if (ch != NULL && num_ticks >= 0)
for (player = player_list; player != NULL; player = player_next)
{
player_next = player->next_player;
if (player->pcdata->pnote && player->pcdata->pnote->text != NULL && player->pcdata->pnote->text[0] != '\0')
{
sprintf( buf, "[`&The Voice of God`7]`8 - `&%s`8 is writing a note. World shift delayed by 2 hours.``", player->name);
do_immecho(NULL,buf);
num_ticks+=2;
}
else if (player->pcdata->pvote && !IS_NULLSTR(player->pcdata->pvote->string))
{
sprintf( buf, "[`&The Voice of God`7]`8 - `&%s`8 is creating a vote. World shift delayed by 2 hours.``", player->name);
do_immecho(NULL,buf);
num_ticks+=2;
}
else if (player->pcdata->ptome != NULL
&& !IS_NULLSTR(player->pcdata->ptome->text))
{
sprintf( buf, "[`&The Voice of God`7]`8 - `&%s`8 is scribing a tome. World shift delayed by 2 hours.``", player->name);
do_immecho(NULL,buf);
num_ticks+=2;
}
else if (player->pcdata->pcvroom)
{
sprintf( buf, "[`&The Voice of God`7]`8 - `&%s`8 is constructing a room. World shift delayed by 2 hours.``", player->name);
do_immecho(NULL,buf);
num_ticks+=2;
}
else if (player->pcdata->pbbid )
{
sprintf( buf, "[`&The Voice of God`7]`8 - `&%s`8 is setting a bounty. World shift delayed by 2 hours.``", player->name);
do_immecho(NULL,buf);
num_ticks+=2;
}
}
if (ch != NULL && num_ticks >= 0)
{
CABAL_INDEX_DATA* pCab;
/* check areas */
for( pArea = area_first; pArea; pArea = pArea->next )
if ( IS_SET(pArea->area_flags, AREA_CHANGED) )
found = TRUE;
if (found)
{
sprintf( buf, "[`&The Voice of God`7]`8 - A modified area is unsaved. World shift delayed by 2 hours.``");
do_immecho(NULL,buf);
num_ticks+=2;
}
/* check cabals */
found = FALSE;
for(pCab = cabal_index_list; pCab; pCab = pCab->next){
if (IS_SET(pCab->flags, CABAL_CHANGED)){
found = TRUE;
break;
}
}
if (found)
{
sprintf( buf, "[`&The Voice of God`7]`8 - A modified cabal is unsaved. World shift delayed by 2 hours.``");
do_immecho(NULL,buf);
num_ticks+=2;
}
}
if (num_ticks > 0)
{
if (reboot_tick_counter < 1 )
{
if (ch == NULL || ch->invis_level > LEVEL_HERO)
sprintf( buf, "[`&The Voice of God`7]`8 - World shift initiated by someone.``");
else
sprintf( buf, "[`&The Voice of God`7]`8 - World shift initiated by %s.``", PERS2(ch));
do_echo(NULL,buf);
}
reboot_tick_counter = num_ticks;
sprintf( buf, "[`&The Voice of God`7]`8 - World shift in %d hour%s.``", reboot_tick_counter, reboot_tick_counter == 1 ? "" : "s");
do_echo(NULL,buf);
return;
}
else if (num_ticks == 0)
{
sprintf(buf,"[`&The Voice of God`7]`8 - World shifting now.``");
do_echo(NULL,buf);
do_hotreboot(ch, "");
}
else if (reboot_tick_counter > 0 )
{
if (ch == NULL || ch->invis_level > LEVEL_HERO)
sprintf( buf, "[`&The Voice of God`7]`8 - World shift halted by someone.``");
else
sprintf( buf, "[`&The Voice of God`7]`8 - World shift halted by %s.``", ch->name);
reboot_buffer[0] = '\0';
do_echo(NULL,buf);
reboot_tick_counter = -1;
return;
}
}
void do_shutdow( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch );
}
void do_shutdown( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
extern bool merc_down;
CHAR_DATA *player, *player_next;
if (ch->invis_level <= LEVEL_HERO)
sprintf( buf, "Shutdown by %s.", ch->name );
append_file( ch, SHUTDOWN_FILE, buf );
strcat( buf, "\n\r" );
if (ch->invis_level <= LEVEL_HERO)
do_echo( ch, buf );
merc_down = TRUE;
for ( player = player_list; player != NULL; player = player_next)
{
player_next = player->next_player;
save_char_obj(player);
if (player->desc)
close_socket(player->desc);
}
}
void do_protect( CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
if (argument[0] == '\0')
{
send_to_char("Protect whom from snooping?\n\r",ch);
return;
}
if ((victim = get_char_world(ch,argument)) == NULL)
{
send_to_char("You can't find them.\n\r",ch);
return;
}
if (IS_SET(victim->comm,COMM_SNOOP_PROOF))
{
sendf(ch, "%s is no longer snoop-proof.\n\r", PERS2(victim));
send_to_char("Your snoop-proofing was just removed.\n\r",victim);
REMOVE_BIT(victim->comm,COMM_SNOOP_PROOF);
}
else
{
sendf(ch, "%s is now snoop-proof.\n\r", PERS2(victim));
send_to_char("You are now immune to snooping.\n\r",victim);
SET_BIT(victim->comm,COMM_SNOOP_PROOF);
}
}
int check_snoop_loop (Double_List *snoop, CHAR_DATA *victim) {
Double_List * tmp_list;
Double_List * tmp_list2;
tmp_list = snoop;
while (tmp_list != NULL) {
if ((((DESCRIPTOR_DATA *)tmp_list->cur_entry)->character == victim) ||
(((DESCRIPTOR_DATA *)tmp_list->cur_entry)->original == victim)) {
return (-1);
}
tmp_list2 = ((DESCRIPTOR_DATA *)tmp_list->cur_entry)->snoop_by;
while (tmp_list2 != NULL) {
if (check_snoop_loop (tmp_list2, victim) != 0) {
return (-1);
}
tmp_list2 = tmp_list2->next_node;
}
tmp_list = tmp_list->next_node;
}
return (0);
}
void do_snoop( CHAR_DATA *ch, char *argument )
{
char arg[MIL], buf[MSL];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
Double_List * tmp_list;
Double_List * tmp_list2;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Snoop whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim->desc == NULL )
{
sendf(ch, "%s has no descriptor to snoop.\n\r", PERS2(victim));
return;
}
if ( victim == ch )
{
send_to_char( "Cancelling all snoops.\n\r", ch );
wiznet("$N stops being such a snoop.", ch,NULL,WIZ_SNOOPS,WIZ_SECURE,get_trust(ch));
/* loop over all the descriptors in the game */
for ( d = descriptor_list; d != NULL; d = d->next ) {
tmp_list = d->snoop_by;
/* - loop over all the people snooping this descriptor */
while (tmp_list != NULL) {
/* -- if one of those people is us, remove us from the list of snoopers */
if (((DESCRIPTOR_DATA *) tmp_list->cur_entry) == ch->desc) {
/* --- if we are first on the list, handle the remove */
if (tmp_list == d->snoop_by) {
d->snoop_by = tmp_list->next_node;
if (tmp_list->next_node != NULL) {
tmp_list->next_node->prev_node = NULL;
}
tmp_list2 = tmp_list;
tmp_list = tmp_list->next_node;
free (tmp_list2);
}
/* --- otherwise we are somewhere else in the list, handle the remove */
else {
tmp_list->prev_node->next_node = tmp_list->next_node;
if (tmp_list->next_node != NULL) {
tmp_list->next_node->prev_node = tmp_list->prev_node;
}
tmp_list2 = tmp_list;
tmp_list = tmp_list->next_node;
free (tmp_list2);
}
}
else {
tmp_list = tmp_list->next_node;
}
}
}
return;
}
if ( ch->in_room != victim->in_room && room_is_private(victim->in_room) && !IS_TRUSTED(ch,IMPLEMENTOR))
{
sendf(ch, "%s is in a private room.\n\r", PERS2(victim));
return;
}
if ( !have_access(ch,victim->in_room))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
if ( get_trust( victim ) > get_trust( ch ) || IS_SET(victim->comm,COMM_SNOOP_PROOF))
{
sendf(ch, "You failed to snoop %s.\n\r", PERS2(victim) );
return;
}
if ( ch->desc != NULL ) {
if (check_snoop_loop (ch->desc->snoop_by, victim) != 0) {
send_to_char( "No snoop loops.\n\r", ch );
return;
}
}
/* if victim is not being snooped yet, set up a new snoop node */
if (victim->desc->snoop_by == NULL) {
victim->desc->snoop_by = (Double_List *) malloc (sizeof (Double_List));
tmp_list = victim->desc->snoop_by;
tmp_list->prev_node = NULL;
tmp_list->next_node = NULL;
tmp_list->cur_entry = (void *) ch->desc;
}
/* otherwise, add a new snoop node to the end of the list */
else {
tmp_list = victim->desc->snoop_by;
if ((DESCRIPTOR_DATA *)tmp_list->cur_entry == ch->desc) {
sendf (ch, "You are already snooping %s.\n\r", PERS2(victim));
return;
}
while (tmp_list->next_node != NULL) {
if ((DESCRIPTOR_DATA *)tmp_list->cur_entry == ch->desc) {
sendf (ch, "You are already snooping %s.\n\r", PERS2(victim));
return;
}
tmp_list = tmp_list->next_node;
}
tmp_list->next_node = (Double_List *) malloc (sizeof (Double_List));
tmp_list->next_node->prev_node = tmp_list;
tmp_list->next_node->next_node = NULL;
tmp_list->next_node->cur_entry = (void *) ch->desc;
}
sprintf(buf,"$N starts snooping on %s", (IS_NPC(ch) ? victim->short_descr : victim->name));
wiznet(buf,ch,NULL,WIZ_SNOOPS,WIZ_SECURE,get_trust(ch));
sendf(ch, "You are now snooping %s.\n\r", PERS2(victim) );
}
void do_switch( CHAR_DATA *ch, char *argument )
{
char arg[MIL], buf[MSL];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Switch into whom?\n\r", ch );
return;
}
if ( ch->desc == NULL )
return;
if ( ch->desc->original != NULL )
{
send_to_char( "You are already switched.\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "Yah, switch into yourself.\n\r", ch );
return;
}
if (!IS_NPC(victim))
{
send_to_char("You can only switch into mobiles.\n\r",ch);
return;
}
if ( ch->in_room != victim->in_room && room_is_private(victim->in_room) && !IS_TRUSTED(ch,IMPLEMENTOR))
{
sendf(ch, "%s is in a private room.\n\r", PERS2(victim));
return;
}
if ( !have_access(ch,victim->in_room))
{
send_to_char( "Don't think so.\n\r",ch);
return;
}
if ( victim->desc != NULL )
{
sendf(ch, "Somebody has already switched into %s.\n\r", PERS2(victim) );
return;
}
sprintf(buf,"$N switches into %s",victim->short_descr);
wiznet(buf,ch,NULL,WIZ_SWITCHES,WIZ_SECURE,get_trust(ch));
ch->desc->character = victim;
ch->desc->original = ch;
victim->desc = ch->desc;
ch->desc = NULL;
if (ch->prompt != NULL)
victim->prompt = str_dup(ch->prompt);
victim->comm = ch->comm;
victim->lines = ch->lines;
sendf(victim, "You have switched into %s.\n\r", PERS2(victim) );
return;
}
void do_return( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
if ( ch->desc == NULL )
return;
if ( ch->desc->original == NULL )
{
send_to_char( "You aren't switched.\n\r", ch );
return;
}
send_to_char( "You return to your original body.\n\r", ch );
if (buf_string(ch->desc->original->pcdata->buffer)[0] != '\0')
send_to_char("Type replay to see missed tells.\n\r", ch );
if (ch->prompt != NULL)
{
free_string(ch->prompt);
ch->prompt = NULL;
}
sprintf(buf,"$N returns from %s.",ch->short_descr);
wiznet(buf,ch->desc->original,0,WIZ_SWITCHES,WIZ_SECURE,get_trust(ch));
ch->comm = COMM_NOCHANNELS|COMM_NOYELL|COMM_NOTELL;
ch->desc->character = ch->desc->original;
ch->desc->original = NULL;
ch->desc->character->desc = ch->desc;
ch->desc = NULL;
}
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)
{
t_obj = create_object(c_obj->pIndexData,0);
clone_object(c_obj,t_obj);
obj_to_obj(t_obj,clone);
recursive_clone(ch,c_obj,t_obj);
}
}
void do_clone(CHAR_DATA *ch, char *argument )
{
CHAR_DATA *mob;
OBJ_DATA *obj;
char arg[MIL];
char *rest = one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("Clone what?\n\r",ch);
return;
}
if (!str_prefix(arg,"object"))
{
mob = NULL;
obj = get_obj_here(ch, NULL,rest);
if (obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character"))
{
obj = NULL;
mob = get_char_room(ch, NULL, rest);
if (mob == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else
{
mob = get_char_room(ch, NULL, argument);
obj = get_obj_here(ch, NULL,argument);
if (mob == NULL && obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
if (obj != NULL)
{
OBJ_DATA *clone;
clone = create_object(obj->pIndexData,0);
clone_object(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,get_trust(ch));
return;
}
else if (mob != NULL)
{
CHAR_DATA *clone;
OBJ_DATA *new_obj;
char buf[MSL];
if (!IS_NPC(mob))
{
send_to_char("You can only clone mobiles.\n\r",ch);
return;
}
clone = create_mobile(mob->pIndexData);
clone_mobile(mob,clone);
for (obj = mob->carrying; obj != NULL; obj = obj->next_content)
{
new_obj = create_object(obj->pIndexData,0);
clone_object(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);
sprintf(buf,"$N clones %s.",clone->short_descr);
wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
}
}
void do_load(CHAR_DATA *ch, char *argument )
{
char arg[MIL];
argument = one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("Syntax:\n\r",ch);
send_to_char(" load mob <vnum>\n\r",ch);
send_to_char(" load obj <vnum> <level>\n\r",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;
}
do_load(ch,"");
}
void do_mload( CHAR_DATA *ch, char *argument )
{
char arg[MIL], buf[MSL];
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' || !is_number(arg) )
{
send_to_char( "Syntax: load mob <vnum>.\n\r", ch );
return;
}
if ( ( pMobIndex = get_mob_index( atoi( arg ) ) ) == NULL )
{
send_to_char( "No mob has that vnum.\n\r", ch );
return;
}
victim = create_mobile( pMobIndex );
char_to_room( victim, ch->in_room );
act( "$n has created $N!", ch, NULL, victim, TO_ROOM );
act( "You have created $N!", ch, NULL, victim, TO_CHAR );
sprintf(buf,"$N loads %s.",victim->short_descr);
wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
}
void do_oload( CHAR_DATA *ch, char *argument )
{
char arg1[MIL];
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
int level = get_trust(ch);
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' || !is_number(arg1))
{
send_to_char( "Syntax: load obj <vnum>.\n\r", ch );
return;
}
if ( ( pObjIndex = get_obj_index( atoi( arg1 ) ) ) == NULL )
{
send_to_char( "No object has that vnum.\n\r", ch );
return;
}
obj = create_object( pObjIndex, level);
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 );
act( "You have created $p!", ch, obj, NULL, TO_CHAR );
wiznet("$N loads $p.",ch,obj,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
}
void purge( CHAR_DATA* victim ){
DESCRIPTOR_DATA *d;
if ( !IS_NPC(victim) ){
save_char_obj( victim );
d = victim->desc;
extract_char( victim, TRUE );
if ( d != NULL )
close_socket( d );
}
else
extract_char( victim, TRUE );
}
void do_purge( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
CHAR_DATA *victim;
OBJ_DATA *obj;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
CHAR_DATA *vnext;
OBJ_DATA *obj_next;
for ( victim = ch->in_room->people; victim != NULL; victim = vnext )
{
vnext = victim->next_in_room;
if ( IS_NPC(victim) && !IS_SET(victim->act,ACT_NOPURGE) && victim != ch )
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);
act( "You have purged the room!",ch, NULL, NULL, TO_CHAR);
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( !IS_NPC(victim) )
{
if (ch == victim)
{
send_to_char("Ho ho ho.\n\r",ch);
return;
}
if (get_trust(ch) < get_trust(victim))
{
send_to_char("Maybe that wasn't a good idea...\n\r",ch)Showing the first 100 KB of 289.0 KB. Download the archive for the full file.